Optimistically fetch profiles.

This commit is contained in:
Greyson Parrelli
2020-06-12 10:22:46 -07:00
committed by Greyson Parrelli
parent f5626f678d
commit ce940235b0
11 changed files with 169 additions and 29 deletions

View File

@@ -0,0 +1,42 @@
package org.thoughtcrime.securesms.keyvalue;
import androidx.annotation.NonNull;
public final class MiscellaneousValues extends SignalStoreValues {
private static final String LAST_PREKEY_REFRESH_TIME = "last_prekey_refresh_time";
private static final String MESSAGE_REQUEST_ENABLE_TIME = "message_request_enable_time";
private static final String LAST_PROFILE_REFRESH_TIME = "misc.last_profile_refresh_time";
MiscellaneousValues(@NonNull KeyValueStore store) {
super(store);
}
@Override
void onFirstEverAppLaunch() {
}
public long getLastPrekeyRefreshTime() {
return getLong(LAST_PREKEY_REFRESH_TIME, 0);
}
public void setLastPrekeyRefreshTime(long time) {
putLong(LAST_PREKEY_REFRESH_TIME, time);
}
public long getMessageRequestEnableTime() {
return getLong(MESSAGE_REQUEST_ENABLE_TIME, 0);
}
public void setMessageRequestEnableTime(long time) {
putLong(MESSAGE_REQUEST_ENABLE_TIME, time);
}
public long getLastProfileRefreshTime() {
return getLong(LAST_PROFILE_REFRESH_TIME, 0);
}
public void setLastProfileRefreshTime(long time) {
putLong(LAST_PROFILE_REFRESH_TIME, time);
}
}

View File

@@ -12,9 +12,6 @@ import org.thoughtcrime.securesms.logging.SignalUncaughtExceptionHandler;
*/
public final class SignalStore {
private static final String LAST_PREKEY_REFRESH_TIME = "last_prekey_refresh_time";
private static final String MESSAGE_REQUEST_ENABLE_TIME = "message_request_enable_time";
private static final SignalStore INSTANCE = new SignalStore();
private final KeyValueStore store;
@@ -25,6 +22,7 @@ public final class SignalStore {
private final StorageServiceValues storageServiceValues;
private final UiHints uiHints;
private final TooltipValues tooltipValues;
private final MiscellaneousValues misc;
private SignalStore() {
this.store = ApplicationDependencies.getKeyValueStore();
@@ -35,6 +33,7 @@ public final class SignalStore {
this.storageServiceValues = new StorageServiceValues(store);
this.uiHints = new UiHints(store);
this.tooltipValues = new TooltipValues(store);
this.misc = new MiscellaneousValues(store);
}
public static void onFirstEverAppLaunch() {
@@ -71,26 +70,14 @@ public final class SignalStore {
return INSTANCE.tooltipValues;
}
public static @NonNull MiscellaneousValues misc() {
return INSTANCE.misc;
}
public static @NonNull GroupsV2AuthorizationSignalStoreCache groupsV2AuthorizationCache() {
return new GroupsV2AuthorizationSignalStoreCache(getStore());
}
public static long getLastPrekeyRefreshTime() {
return getStore().getLong(LAST_PREKEY_REFRESH_TIME, 0);
}
public static void setLastPrekeyRefreshTime(long time) {
putLong(LAST_PREKEY_REFRESH_TIME, time);
}
public static long getMessageRequestEnableTime() {
return getStore().getLong(MESSAGE_REQUEST_ENABLE_TIME, 0);
}
public static void setMessageRequestEnableTime(long time) {
putLong(MESSAGE_REQUEST_ENABLE_TIME, time);
}
public static @NonNull PreferenceDataStore getPreferenceDataStore() {
return new SignalPreferenceDataStore(getStore());
}