summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/fragments/MainActivityErrorDialog.java45
-rw-r--r--app/src/main/res/values-de/strings.xml2
2 files changed, 33 insertions, 14 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/MainActivityErrorDialog.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/MainActivityErrorDialog.java
index 27d61a69..ae25c61c 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/MainActivityErrorDialog.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/MainActivityErrorDialog.java
@@ -16,8 +16,22 @@
*/
package se.leap.bitmaskclient.base.fragments;
+import static se.leap.bitmaskclient.R.string.warning_option_try_ovpn;
+import static se.leap.bitmaskclient.R.string.warning_option_try_pt;
+import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_STOP_BLOCKING_VPN;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getPreferredCity;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUseBridges;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.setPreferredCity;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.useBridges;
+import static se.leap.bitmaskclient.eip.EIP.EIPErrors.UNKNOWN;
+import static se.leap.bitmaskclient.eip.EIP.EIPErrors.valueOf;
+import static se.leap.bitmaskclient.eip.EIP.ERRORID;
+import static se.leap.bitmaskclient.eip.EIP.ERRORS;
+import static se.leap.bitmaskclient.providersetup.ProviderAPI.UPDATE_INVALID_VPN_CERTIFICATE;
+
import android.app.Dialog;
import android.content.Context;
+import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
@@ -31,20 +45,9 @@ import se.leap.bitmaskclient.R;
import se.leap.bitmaskclient.base.models.Provider;
import se.leap.bitmaskclient.eip.EIP;
import se.leap.bitmaskclient.eip.EipCommand;
+import se.leap.bitmaskclient.eip.VoidVpnService;
import se.leap.bitmaskclient.providersetup.ProviderAPICommand;
-import static se.leap.bitmaskclient.R.string.warning_option_try_ovpn;
-import static se.leap.bitmaskclient.R.string.warning_option_try_pt;
-import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getPreferredCity;
-import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUseBridges;
-import static se.leap.bitmaskclient.base.utils.PreferenceHelper.setPreferredCity;
-import static se.leap.bitmaskclient.base.utils.PreferenceHelper.useBridges;
-import static se.leap.bitmaskclient.eip.EIP.EIPErrors.UNKNOWN;
-import static se.leap.bitmaskclient.eip.EIP.EIPErrors.valueOf;
-import static se.leap.bitmaskclient.eip.EIP.ERRORID;
-import static se.leap.bitmaskclient.eip.EIP.ERRORS;
-import static se.leap.bitmaskclient.providersetup.ProviderAPI.UPDATE_INVALID_VPN_CERTIFICATE;
-
/**
* Implements an error dialog for the main activity.
*
@@ -56,6 +59,8 @@ public class MainActivityErrorDialog extends DialogFragment {
final public static String TAG = "downloaded_failed_dialog";
final private static String KEY_REASON_TO_FAIL = "key reason to fail";
final private static String KEY_PROVIDER = "key provider";
+ final private static String KEY_DOWNLOAD_ERROR = "key_download_error";
+ final private static String KEY_ARGS = "key_args";
private String reasonToFail;
private String[] args;
private EIP.EIPErrors downloadError = UNKNOWN;
@@ -124,7 +129,11 @@ public class MainActivityErrorDialog extends DialogFragment {
builder.setNegativeButton(R.string.cancel, (dialog, id) -> {});
break;
case NO_MORE_GATEWAYS:
- builder.setNegativeButton(R.string.cancel, (dialog, id) -> {});
+ builder.setNegativeButton(R.string.vpn_button_turn_off_blocking, (dialog, id) -> {
+ Intent stopVoidVpnIntent = new Intent (getContext(), VoidVpnService.class);
+ stopVoidVpnIntent.setAction(EIP_ACTION_STOP_BLOCKING_VPN);
+ getContext().startService(stopVoidVpnIntent);
+ });
if (getPreferredCity(applicationContext) != null) {
builder.setPositiveButton(R.string.warning_option_try_best, (dialog, which) -> {
new Thread(() -> {
@@ -166,6 +175,10 @@ public class MainActivityErrorDialog extends DialogFragment {
super.onSaveInstanceState(outState);
outState.putString(KEY_REASON_TO_FAIL, reasonToFail);
outState.putParcelable(KEY_PROVIDER, provider);
+ outState.putString(KEY_DOWNLOAD_ERROR, downloadError.toString());
+ if (args != null) {
+ outState.putStringArray(KEY_ARGS, args);
+ }
}
private void restoreFromSavedInstance(Bundle savedInstanceState) {
@@ -178,6 +191,12 @@ public class MainActivityErrorDialog extends DialogFragment {
if (savedInstanceState.containsKey(KEY_REASON_TO_FAIL)) {
this.reasonToFail = savedInstanceState.getString(KEY_REASON_TO_FAIL);
}
+ if (savedInstanceState.containsKey(KEY_DOWNLOAD_ERROR)) {
+ this.downloadError = EIP.EIPErrors.valueOf(savedInstanceState.getString(KEY_DOWNLOAD_ERROR));
+ }
+ if (savedInstanceState.containsKey(KEY_ARGS)) {
+ this.args = savedInstanceState.getStringArray(KEY_ARGS);
+ }
}
}
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 007cebdc..7aa4c105 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -79,7 +79,7 @@
<string name="signing_up">Am Registrieren</string>
<string name="vpn.button.turn.on">Einschalten</string>
<string name="vpn.button.turn.off">Ausschalten</string>
- <string name="vpn_button_turn_off_blocking">Blocken beenden.</string>
+ <string name="vpn_button_turn_off_blocking">Blocken beenden</string>
<string name="vpn_securely_routed">Dein Internetverkehr wird sicher durchgeleitet durch:</string>
<string name="vpn_securely_routed_no_internet">Keine Internetverbindung vorhanden. Sobald du wieder online bist verbindest du dich automatisch mit:</string>
<string name="log_fragment_title">Log</string>