diff options
Diffstat (limited to 'app/src/main/java/se/leap')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/Dashboard.java | 10 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/StartActivity.java | 8 |
2 files changed, 16 insertions, 2 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java index 25c1f64e..dc58b865 100644 --- a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java +++ b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java @@ -405,13 +405,21 @@ public class Dashboard extends ButterKnifeActivity { private void switchProvider() { if (provider.hasEIP()) eip_fragment.stopEipIfPossible(); + clearDataOfLastProvider(); + + switching_provider = false; + startActivityForResult(new Intent(this, ConfigurationWizard.class), REQUEST_CODE_SWITCH_PROVIDER); + } + + private void clearDataOfLastProvider() { Map<String, ?> allEntries = preferences.getAll(); List<String> lastProvidersKeys = new ArrayList<>(); for (Map.Entry<String, ?> entry : allEntries.entrySet()) { //sort out all preferences that don't belong to the last provider if (entry.getKey().startsWith(Provider.KEY + ".") || entry.getKey().startsWith(Provider.CA_CERT + ".") || - entry.getKey().startsWith(Provider.CA_CERT_FINGERPRINT + ".") + entry.getKey().startsWith(Provider.CA_CERT_FINGERPRINT + "." )|| + entry.getKey().equals(Constants.PREFERENCES_APP_VERSION) ) { continue; } diff --git a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java index 856b104b..614c6b8d 100644 --- a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java @@ -48,6 +48,8 @@ public class StartActivity extends Activity { break; case FIRST: + storeAppVersion(); + // TODO start ProfileCreation & replace below code // (new Intent(getActivity(), ConfigurationWizard.class), Constants.REQUEST_CODE_SWITCH_PROVIDER); break; @@ -120,7 +122,7 @@ public class StartActivity extends Activity { } // ensure all upgrades have passed before storing new information - preferences.edit().putInt(Constants.PREFERENCES_APP_VERSION, versionCode).apply(); + storeAppVersion(); } /** @@ -132,4 +134,8 @@ public class StartActivity extends Activity { return previousVersionCode < featureVersionCode && versionCode >= featureVersionCode; } + private void storeAppVersion() { + preferences.edit().putInt(Constants.PREFERENCES_APP_VERSION, versionCode).apply(); + } + } |