mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 10:20:25 +01:00
Implement additional message request improvements.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package org.thoughtcrime.securesms.keyvalue;
|
||||
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
|
||||
public final class RemoteConfigValues {
|
||||
|
||||
private static final String TAG = Log.tag(RemoteConfigValues.class);
|
||||
|
||||
private static final String CURRENT_CONFIG = "remote_config";
|
||||
private static final String PENDING_CONFIG = "pending_remote_config";
|
||||
private static final String LAST_FETCH_TIME = "remote_config_last_fetch_time";
|
||||
|
||||
private final KeyValueStore store;
|
||||
|
||||
RemoteConfigValues(KeyValueStore store) {
|
||||
this.store = store;
|
||||
}
|
||||
|
||||
public String getCurrentConfig() {
|
||||
return store.getString(CURRENT_CONFIG, null);
|
||||
}
|
||||
|
||||
public void setCurrentConfig(String value) {
|
||||
store.beginWrite().putString(CURRENT_CONFIG, value).apply();
|
||||
}
|
||||
|
||||
public String getPendingConfig() {
|
||||
return store.getString(PENDING_CONFIG, getCurrentConfig());
|
||||
}
|
||||
|
||||
public void setPendingConfig(String value) {
|
||||
store.beginWrite().putString(PENDING_CONFIG, value).apply();
|
||||
}
|
||||
|
||||
public long getLastFetchTime() {
|
||||
return store.getLong(LAST_FETCH_TIME, 0);
|
||||
}
|
||||
|
||||
public void setLastFetchTime(long time) {
|
||||
store.beginWrite().putLong(LAST_FETCH_TIME, time).apply();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package org.thoughtcrime.securesms.keyvalue;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
@@ -12,9 +10,8 @@ import org.thoughtcrime.securesms.logging.SignalUncaughtExceptionHandler;
|
||||
*/
|
||||
public final class SignalStore {
|
||||
|
||||
private static final String REMOTE_CONFIG = "remote_config";
|
||||
private static final String REMOTE_CONFIG_LAST_FETCH_TIME = "remote_config_last_fetch_time";
|
||||
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 SignalStore() {}
|
||||
|
||||
@@ -30,20 +27,8 @@ public final class SignalStore {
|
||||
return new PinValues(getStore());
|
||||
}
|
||||
|
||||
public static String getRemoteConfig() {
|
||||
return getStore().getString(REMOTE_CONFIG, null);
|
||||
}
|
||||
|
||||
public static void setRemoteConfig(String value) {
|
||||
putString(REMOTE_CONFIG, value);
|
||||
}
|
||||
|
||||
public static long getRemoteConfigLastFetchTime() {
|
||||
return getStore().getLong(REMOTE_CONFIG_LAST_FETCH_TIME, 0);
|
||||
}
|
||||
|
||||
public static void setRemoteConfigLastFetchTime(long time) {
|
||||
putLong(REMOTE_CONFIG_LAST_FETCH_TIME, time);
|
||||
public static @NonNull RemoteConfigValues remoteConfigValues() {
|
||||
return new RemoteConfigValues(getStore());
|
||||
}
|
||||
|
||||
public static long getLastPrekeyRefreshTime() {
|
||||
@@ -54,6 +39,14 @@ public final class SignalStore {
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures any pending writes are finished. Only intended to be called by
|
||||
* {@link SignalUncaughtExceptionHandler}.
|
||||
|
||||
Reference in New Issue
Block a user