summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/Dashboard.java28
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/EipFragment.java1
2 files changed, 18 insertions, 11 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
index 52b22695..cf65c9b8 100644
--- a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
+++ b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
@@ -81,6 +81,7 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
private Provider provider;
private static boolean authed_eip;
public ProviderAPIResultReceiver providerAPI_result_receiver;
+ private boolean switching_provider;
@Override
protected void onSaveInstanceState(@NotNull Bundle outState) {
@@ -288,15 +289,11 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
startActivity(startLW);
return true;
case R.id.switch_provider:
- if (provider.hasEIP()){
- if (preferences.getBoolean(Constants.AUTHED_EIP, false)) {
- logOut();
- }
- eip_fragment.askToStopEIP();
- }
- preferences.edit().clear().apply();
- startActivityForResult(new Intent(this,ConfigurationWizard.class), SWITCH_PROVIDER);
- return true;
+ switching_provider = true;
+ if (preferences.getBoolean(Constants.AUTHED_EIP, false)) {
+ logOut();
+ } else switchProvider();
+ return true;
case R.id.login_button:
logInDialog(Bundle.EMPTY);
return true;
@@ -307,7 +304,7 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
signUpDialog(Bundle.EMPTY);
return true;
default:
- return super.onOptionsItemSelected(item);
+ return super.onOptionsItemSelected(item);
}
}
@@ -402,6 +399,13 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
startService(provider_API_command);
}
+ private void switchProvider() {
+ if (provider.hasEIP()) eip_fragment.askToStopEIP();
+ preferences.edit().clear().apply();
+ switching_provider = false;
+ startActivityForResult(new Intent(this,ConfigurationWizard.class), SWITCH_PROVIDER);
+ }
+
/**
* Asks ProviderAPI to download an authenticated OpenVPN certificate.
*/
@@ -456,7 +460,9 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
authed_eip = false;
preferences.edit().putBoolean(Constants.AUTHED_EIP, authed_eip).apply();
-
+
+ if(switching_provider) switchProvider();
+
} else if(resultCode == ProviderAPI.LOGOUT_FAILED) {
changeStatusMessage(resultCode);
hideProgressBar();
diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java
index 420da7a1..59e9ca5a 100644
--- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java
@@ -211,6 +211,7 @@ public class EipFragment extends Fragment implements Observer {
String status = parent_activity.getString(R.string.eip_state_not_connected);
status_message.setText(status);
+
eipCommand(Constants.ACTION_STOP_EIP);
}