summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcyberta <cyberta@riseup.net>2018-01-11 07:30:54 -0800
committercyberta <cyberta@riseup.net>2018-01-11 07:30:54 -0800
commitf3de2025db7bf73cdfdaaedd63aa00a1bf020d80 (patch)
tree2fee4a139c2489db379353485843232cf7334fe0
parent68d6eb91436d0d145fd340056fd8000f7dd1ff34 (diff)
parentf58e202cddeb468b61a50df8809bd6e7548456e6 (diff)
Merge branch 'bugfix/startActivity' into '0.9.8'
save app version on first start See merge request leap/bitmask_android!22
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/Dashboard.java12
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/StartActivity.java7
2 files changed, 15 insertions, 4 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
index 861ce801..755aaf33 100644
--- a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
+++ b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
@@ -408,13 +408,21 @@ public class Dashboard extends Activity implements ProviderAPIResultReceiver.Rec
private void switchProvider() {
if (provider.hasEIP()) eip_fragment.stopEipIfPossible();
+ clearDataOfLastProvider();
+
+ switching_provider = false;
+ startActivityForResult(new Intent(this, ConfigurationWizard.class), 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;
}
@@ -427,8 +435,6 @@ public class Dashboard extends Activity implements ProviderAPIResultReceiver.Rec
}
preferenceEditor.apply();
- switching_provider = false;
- startActivityForResult(new Intent(this, ConfigurationWizard.class), SWITCH_PROVIDER);
}
@Override
diff --git a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java
index 2bfe650a..ec972a75 100644
--- a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java
+++ b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java
@@ -48,6 +48,7 @@ public class StartActivity extends Activity {
break;
case FIRST:
+ storeAppVersion();
// TODO start ProfileCreation & replace below code
break;
@@ -120,7 +121,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 +133,8 @@ public class StartActivity extends Activity {
return previousVersionCode < featureVersionCode && versionCode >= featureVersionCode;
}
+ private void storeAppVersion() {
+ preferences.edit().putInt(Constants.PREFERENCES_APP_VERSION, versionCode).apply();
+ }
+
}