Commit ca3197b5 authored by Jose Blaya's avatar Jose Blaya
Browse files

Update Region country flag for Automatic server with correct country flag

parent b9be3929
...@@ -156,14 +156,17 @@ extension Theme { ...@@ -156,14 +156,17 @@ extension Theme {
Asset.Piax.Regions.noResultsLight.image Asset.Piax.Regions.noResultsLight.image
} }
public func mapImageByServerName(_ serverName: String) -> String { public func mapImageByServerName(_ serverName: String, andTargetServer targetServer: String? = nil) -> String {
let prefix = palette.appearance == .dark ? "Dark-Map-" : "Light-Map-" let prefix = palette.appearance == .dark ? "Dark-Map-" : "Light-Map-"
if serverName != L10n.Global.automatic { if serverName != L10n.Global.automatic {
return prefix + serverName return prefix + serverName
} else { } else {
return prefix + "Spain" if let targetServer = targetServer {
return prefix + targetServer
} else {
return prefix + "Spain"
}
} }
} }
public func dragDropImage() -> UIImage { public func dragDropImage() -> UIImage {
......
...@@ -57,9 +57,10 @@ class RegionTile: UIView, Tileable { ...@@ -57,9 +57,10 @@ class RegionTile: UIView, Tileable {
@objc private func updateServer() { @objc private func updateServer() {
let effectiveServer = Client.preferences.displayedServer let effectiveServer = Client.preferences.displayedServer
let targetServer = Client.providers.serverProvider.targetServer
let vpn = Client.providers.vpnProvider let vpn = Client.providers.vpnProvider
self.serverName.text = effectiveServer.name(forStatus: vpn.vpnStatus) self.serverName.text = effectiveServer.name(forStatus: vpn.vpnStatus)
self.mapImageView.image = UIImage(named: Theme.current.mapImageByServerName(effectiveServer.name)) self.mapImageView.image = UIImage(named: Theme.current.mapImageByServerName(effectiveServer.name, andTargetServer: targetServer.name))
} }
@objc private func viewShouldRestyle() { @objc private func viewShouldRestyle() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment