Allow restoration over cellular

This commit is contained in:
Michelle Tang
2024-12-05 13:02:36 -05:00
committed by Greyson Parrelli
parent 0c86ff1f84
commit a7d7c1da8d
11 changed files with 128 additions and 10 deletions

View File

@@ -7,6 +7,7 @@ import org.signal.core.util.logging.Log
import org.thoughtcrime.securesms.backup.RestoreState
import org.thoughtcrime.securesms.backup.v2.BackupFrequency
import org.thoughtcrime.securesms.backup.v2.MessageBackupTier
import org.thoughtcrime.securesms.jobmanager.impl.RestoreAttachmentConstraintObserver
import org.thoughtcrime.securesms.keyvalue.protos.ArchiveUploadProgressState
import org.thoughtcrime.securesms.util.Util
import org.whispersystems.signalservice.api.archive.ArchiveServiceCredential
@@ -48,6 +49,7 @@ class BackupValues(store: KeyValueStore) : SignalStoreValues(store) {
private const val KEY_CDN_MEDIA_PATH = "backup.cdn.mediaPath"
private const val KEY_BACKUP_OVER_CELLULAR = "backup.useCellular"
private const val KEY_RESTORE_OVER_CELLULAR = "backup.restore.useCellular"
private const val KEY_OPTIMIZE_STORAGE = "backup.optimizeStorage"
private const val KEY_BACKUPS_INITIALIZED = "backup.initialized"
@@ -82,6 +84,13 @@ class BackupValues(store: KeyValueStore) : SignalStoreValues(store) {
var optimizeStorage: Boolean by booleanValue(KEY_OPTIMIZE_STORAGE, false)
var backupWithCellular: Boolean by booleanValue(KEY_BACKUP_OVER_CELLULAR, false)
var restoreWithCellular: Boolean
get() = getBoolean(KEY_RESTORE_OVER_CELLULAR, false)
set(value) {
putBoolean(KEY_RESTORE_OVER_CELLULAR, value)
RestoreAttachmentConstraintObserver.onChange()
}
var nextBackupTime: Long by longValue(KEY_NEXT_BACKUP_TIME, -1)
var lastBackupTime: Long
get() = getLong(KEY_LAST_BACKUP_TIME, -1)