mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-24 02:39:55 +01:00
Detect storage space issues during restore.
This commit is contained in:
committed by
Greyson Parrelli
parent
b4472833b8
commit
7f1a866e79
@@ -57,6 +57,9 @@ class BackupValues(store: KeyValueStore) : SignalStoreValues(store) {
|
||||
private const val KEY_BACKUP_FAIL_ACKNOWLEDGED_SNOOZE_TIME = "backup.failed.acknowledged.snooze.time"
|
||||
private const val KEY_BACKUP_FAIL_ACKNOWLEDGED_SNOOZE_COUNT = "backup.failed.acknowledged.snooze.count"
|
||||
private const val KEY_BACKUP_FAIL_SHEET_SNOOZE_TIME = "backup.failed.sheet.snooze"
|
||||
private const val KEY_BACKUP_FAIL_SPACE_REMAINING = "backup.failed.space.remaining"
|
||||
|
||||
private const val KEY_USER_MANUALLY_SKIPPED_MEDIA_RESTORE = "backup.user.manually.skipped.media.restore"
|
||||
|
||||
private const val KEY_MEDIA_ROOT_BACKUP_KEY = "backup.mediaRootBackupKey"
|
||||
|
||||
@@ -89,6 +92,8 @@ class BackupValues(store: KeyValueStore) : SignalStoreValues(store) {
|
||||
var lastMediaSyncTime: Long by longValue(KEY_LAST_BACKUP_MEDIA_SYNC_TIME, -1)
|
||||
var backupFrequency: BackupFrequency by enumValue(KEY_BACKUP_FREQUENCY, BackupFrequency.MANUAL, BackupFrequency.Serializer)
|
||||
|
||||
var userManuallySkippedMediaRestore: Boolean by booleanValue(KEY_USER_MANUALLY_SKIPPED_MEDIA_RESTORE, false)
|
||||
|
||||
/**
|
||||
* Key used to backup messages.
|
||||
*/
|
||||
@@ -172,10 +177,19 @@ class BackupValues(store: KeyValueStore) : SignalStoreValues(store) {
|
||||
/** True if we believe we have successfully uploaded a backup, otherwise false. */
|
||||
var hasBackupBeenUploaded: Boolean by booleanValue(KEY_BACKUP_UPLOADED, false)
|
||||
|
||||
val hasBackupFailure: Boolean = getBoolean(KEY_BACKUP_FAIL, false)
|
||||
val hasBackupFailure: Boolean get() = getBoolean(KEY_BACKUP_FAIL, false)
|
||||
val nextBackupFailureSnoozeTime: Duration get() = getLong(KEY_BACKUP_FAIL_ACKNOWLEDGED_SNOOZE_TIME, 0L).milliseconds
|
||||
val nextBackupFailureSheetSnoozeTime: Duration get() = getLong(KEY_BACKUP_FAIL_SHEET_SNOOZE_TIME, getNextBackupFailureSheetSnoozeTime(lastBackupTime.milliseconds).inWholeMilliseconds).milliseconds
|
||||
|
||||
/**
|
||||
* Denotes how many bytes are still available on the disk for writing. Used to display
|
||||
* the disk full error and sheet. Set when we believe there might be an "out of space"
|
||||
* failure in BackupRestoreMediaJob and each time the application is brought into the
|
||||
* foreground. We never clear this value, so it can't be used as an indicator that
|
||||
* something bad happened, it can only be utilized as a reference for comparison.
|
||||
*/
|
||||
var spaceAvailableOnDiskBytes: Long by longValue(KEY_BACKUP_FAIL_SPACE_REMAINING, -1L)
|
||||
|
||||
/**
|
||||
* Call when the user disables backups. Clears/resets all relevant fields.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user