diff options
author | cyBerta <cyberta@riseup.net> | 2022-08-05 18:26:34 +0200 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2022-08-05 18:26:34 +0200 |
commit | 5d9072d9739882386fe30419a25ceb80166a5990 (patch) | |
tree | 2bcbadf887fbd5d5331da20dd08ae524d7e71188 /app | |
parent | 9234a7b970109970cfb33f3b6351f702a05c66cb (diff) |
localize 'Unknown Location'
Diffstat (limited to 'app')
3 files changed, 8 insertions, 5 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/ObfuscationProxyDialog.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/ObfuscationProxyDialog.java index e2247e1e..6829d9f1 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/ObfuscationProxyDialog.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/ObfuscationProxyDialog.java @@ -68,6 +68,7 @@ public class ObfuscationProxyDialog extends AppCompatDialogFragment { PreferenceHelper.setObfuscationPinningCert(v.getContext(), cert); PreferenceHelper.setObfuscationPinningKCP(v.getContext(), kcpSwitch.isChecked()); PreferenceHelper.setUseObfuscationPinning(v.getContext(), ip != null && port != null && cert != null); + PreferenceHelper.setObfuscationPinningGatewayLocation(v.getContext(), gatewaysManager.getLocationNameForIP(ip, v.getContext())); dismiss(); }); diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java index e5795941..521d095e 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java @@ -238,12 +238,13 @@ public class GatewaysManager { } } - public String getLocationNameForHost(String name) { - Gateway gateway = gateways.get(name); - if (gateway != null) { - return gateway.getName(); + public String getLocationNameForIP(String ip, Context context) { + for (Gateway gateway : gateways.values()) { + if (gateway.getRemoteIP().equals(ip)) { + return gateway.getName(); + } } - return "Unknown Location"; + return context.getString(R.string.unknown_location); } @Nullable diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 659af92d..ab0744c4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -201,5 +201,6 @@ <string name="disabled_while_udp_on">Disabled while UDP is on.</string> <string name="advanced_settings">Advanced settings</string> <string name="cancel_connection">Disconnect</string> + <string name="unknown_location">Unknown location</string> </resources> |