mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 18:00:02 +01:00
Further simplify storage service syncing.
This commit is contained in:
committed by
Alex Hart
parent
1493581a4d
commit
cdc7f1565e
@@ -62,7 +62,7 @@ public final class SignalStore {
|
||||
registrationValues().onFirstEverAppLaunch();
|
||||
pinValues().onFirstEverAppLaunch();
|
||||
remoteConfigValues().onFirstEverAppLaunch();
|
||||
storageServiceValues().onFirstEverAppLaunch();
|
||||
storageService().onFirstEverAppLaunch();
|
||||
uiHints().onFirstEverAppLaunch();
|
||||
tooltips().onFirstEverAppLaunch();
|
||||
misc().onFirstEverAppLaunch();
|
||||
@@ -83,7 +83,7 @@ public final class SignalStore {
|
||||
keys.addAll(registrationValues().getKeysToIncludeInBackup());
|
||||
keys.addAll(pinValues().getKeysToIncludeInBackup());
|
||||
keys.addAll(remoteConfigValues().getKeysToIncludeInBackup());
|
||||
keys.addAll(storageServiceValues().getKeysToIncludeInBackup());
|
||||
keys.addAll(storageService().getKeysToIncludeInBackup());
|
||||
keys.addAll(uiHints().getKeysToIncludeInBackup());
|
||||
keys.addAll(tooltips().getKeysToIncludeInBackup());
|
||||
keys.addAll(misc().getKeysToIncludeInBackup());
|
||||
@@ -124,7 +124,7 @@ public final class SignalStore {
|
||||
return INSTANCE.remoteConfigValues;
|
||||
}
|
||||
|
||||
public static @NonNull StorageServiceValues storageServiceValues() {
|
||||
public static @NonNull StorageServiceValues storageService() {
|
||||
return INSTANCE.storageServiceValues;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package org.thoughtcrime.securesms.keyvalue;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.whispersystems.signalservice.api.storage.SignalStorageManifest;
|
||||
import org.whispersystems.signalservice.api.storage.StorageKey;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -11,6 +13,7 @@ public class StorageServiceValues extends SignalStoreValues {
|
||||
|
||||
private static final String LAST_SYNC_TIME = "storage.last_sync_time";
|
||||
private static final String NEEDS_ACCOUNT_RESTORE = "storage.needs_account_restore";
|
||||
private static final String MANIFEST = "storage.manifest";
|
||||
|
||||
StorageServiceValues(@NonNull KeyValueStore store) {
|
||||
super(store);
|
||||
@@ -44,4 +47,18 @@ public class StorageServiceValues extends SignalStoreValues {
|
||||
public void setNeedsAccountRestore(boolean value) {
|
||||
putBoolean(NEEDS_ACCOUNT_RESTORE, value);
|
||||
}
|
||||
|
||||
public void setManifest(@NonNull SignalStorageManifest manifest) {
|
||||
putBlob(MANIFEST, manifest.serialize());
|
||||
}
|
||||
|
||||
public @NonNull SignalStorageManifest getManifest() {
|
||||
byte[] data = getBlob(MANIFEST, null);
|
||||
|
||||
if (data != null) {
|
||||
return SignalStorageManifest.deserialize(data);
|
||||
} else {
|
||||
return SignalStorageManifest.EMPTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user