diff options
author | cyberta <cyberta@riseup.net> | 2021-04-28 10:40:18 +0200 |
---|---|---|
committer | cyberta <cyberta@riseup.net> | 2021-04-28 10:40:18 +0200 |
commit | d4c418faf893d28e3c543f19a276fada23e2fd6e (patch) | |
tree | 36aef38d5f073ff072cf2686cc6b0668c90451de /app/src/main/java/se/leap/bitmaskclient/eip | |
parent | eb99ac65e9faf306e196d1651a466244d38f9341 (diff) |
ask to disable manual gateway selection if current combination of transport and location fails
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/eip')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/eip/EIP.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java index 74226250..d632c09e 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java @@ -84,6 +84,7 @@ import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_PROFILE; import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_VPN_CERTIFICATE; import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES; import static se.leap.bitmaskclient.base.utils.ConfigHelper.ensureNotOnMainThread; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getPreferredCity; import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUsePluggableTransports; import static se.leap.bitmaskclient.eip.EIP.EIPErrors.ERROR_INVALID_PROFILE; import static se.leap.bitmaskclient.eip.EIP.EIPErrors.ERROR_INVALID_VPN_CERTIFICATE; @@ -317,7 +318,12 @@ public final class EIP extends JobIntentService implements Observer { Connection.TransportType transportType = getUsePluggableTransports(this) ? OBFS4 : OPENVPN; if (gateway == null || (profile = gateway.getProfile(transportType)) == null) { - setErrorResult(result, NO_MORE_GATEWAYS.toString(), getStringResourceForNoMoreGateways(), getString(R.string.app_name)); + String preferredLocation = getPreferredCity(getApplicationContext()); + if (preferredLocation != null) { + setErrorResult(result, NO_MORE_GATEWAYS.toString(), getStringResourceForNoMoreGateways(), getString(R.string.app_name), preferredLocation); + } else { + setErrorResult(result, NO_MORE_GATEWAYS.toString(), getStringResourceForNoMoreGateways(), getString(R.string.app_name)); + } return; } @@ -527,7 +533,10 @@ public final class EIP extends JobIntentService implements Observer { private @StringRes int getStringResourceForNoMoreGateways() { - if (ProviderObservable.getInstance().getCurrentProvider().supportsPluggableTransports()) { + boolean isManualGatewaySelection = PreferenceHelper.getLastConnectedVpnProfile(getApplicationContext()) != null; + if (isManualGatewaySelection) { + return R.string.warning_no_more_gateways_manual_gw_selection; + } else if (ProviderObservable.getInstance().getCurrentProvider().supportsPluggableTransports()) { if (PreferenceHelper.getUsePluggableTransports(getApplicationContext())) { return R.string.warning_no_more_gateways_use_ovpn; } else { |