Skip to content
Snippets Groups Projects
Commit f3de2025 authored by cyberta's avatar cyberta
Browse files

Merge branch 'bugfix/startActivity' into '0.9.8'

save app version on first start

See merge request !22
parents 68d6eb91 f58e202c
No related branches found
No related tags found
1 merge request!22save app version on first start
......@@ -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
......
......@@ -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();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment