summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java3
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java6
2 files changed, 5 insertions, 4 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java b/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java
index 6e557236..58b057b7 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java
@@ -276,7 +276,8 @@ public class StartActivity extends Activity{
String hash = message.hash();
lastSeenHashes.add(hash);
p.setMotdLastSeenHashes(lastSeenHashes);
- PreferenceHelper.persistProvider(this, p);
+ p.setLastMotdSeen(System.currentTimeMillis());
+ PreferenceHelper.persistProviderAsync(this, p);
ProviderObservable.getInstance().updateProvider(p);
}
showMotdFragment(message);
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java
index 76e54794..ff3b5ab1 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java
@@ -95,7 +95,7 @@ public class PreferenceHelper {
return preferences.getStringSet(toFetch + "." + providerDomain, new HashSet<>());
}
- public static void persistProvider(Context context, Provider provider) {
+ public static void persistProviderAsync(Context context, Provider provider) {
SharedPreferences preferences = context.getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE);
storeProviderInPreferences(preferences, provider, true);
}
@@ -106,7 +106,7 @@ public class PreferenceHelper {
// TODO: replace commit with apply after refactoring EIP
//FIXME: don't save private keys in shared preferences! use the keystore
- public static void storeProviderInPreferences(SharedPreferences preferences, Provider provider, boolean apply) {
+ public static void storeProviderInPreferences(SharedPreferences preferences, Provider provider, boolean async) {
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean(PROVIDER_CONFIGURED, true).
putString(Provider.PROVIDER_IP, provider.getProviderIp()).
@@ -123,7 +123,7 @@ public class PreferenceHelper {
putStringSet(PROVIDER_MOTD_HASHES, provider.getMotdLastSeenHashes()).
putLong(PROVIDER_MOTD_LAST_SEEN, provider.getLastMotdSeen()).
putLong(PROVIDER_MOTD_LAST_UPDATED, provider.getLastMotdUpdate());
- if (apply) {
+ if (async) {
editor.apply();
} else {
editor.commit();