summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2014-12-18 16:40:07 +0100
committerParménides GV <parmegv@sdf.org>2014-12-22 12:30:19 +0100
commita3e93c14fbd82d7f4229f30bbcb622e5ddb71983 (patch)
tree9e0ece94ae2db76d66736c2ab294edeb6626a539
parent38cbf4b517e99961dc977db30ce8395ce10a7b0d (diff)
Log out before starting Configuration Wizard.
-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);
}