Improve link device good citizenship with backups.

This commit is contained in:
Cody Henthorne
2025-08-12 14:33:47 -04:00
committed by GitHub
parent 2190a4a58d
commit 0bbbee645d
12 changed files with 65 additions and 10 deletions

View File

@@ -199,6 +199,15 @@ class BackupValues(store: KeyValueStore) : SignalStoreValues(store) {
}
set(value) {
lock.withLock {
val currentValue: ByteArray? = getBlob(KEY_MEDIA_ROOT_BACKUP_KEY, null)
if (currentValue != null) {
val current = MediaRootBackupKey(currentValue)
if (current == value) {
Log.i(TAG, "MediaRootBackupKey the same, skipping.")
return
}
}
Log.i(TAG, "Setting MediaRootBackupKey...", Throwable(), true)
store.beginWrite().putBlob(KEY_MEDIA_ROOT_BACKUP_KEY, value.value).commit()
mediaCredentials.clearAll()