Implement backups settings fragment.

This commit is contained in:
Alex Hart
2024-04-17 14:49:06 -03:00
committed by Greyson Parrelli
parent 75bd113545
commit 58282e589b
17 changed files with 806 additions and 61 deletions

View File

@@ -25,6 +25,11 @@ internal class BackupValues(store: KeyValueStore) : SignalStoreValues(store) {
private const val KEY_OPTIMIZE_STORAGE = "backup.optimizeStorage"
/**
* Specifies whether remote backups are enabled on this device.
*/
private const val KEY_BACKUPS_ENABLED = "backup.enabled"
private val cachedCdnCredentialsExpiresIn: Duration = 12.hours
}
@@ -40,6 +45,8 @@ internal class BackupValues(store: KeyValueStore) : SignalStoreValues(store) {
var restoreState: RestoreState by enumValue(KEY_RESTORE_STATE, RestoreState.NONE, RestoreState.serializer)
var optimizeStorage: Boolean by booleanValue(KEY_OPTIMIZE_STORAGE, false)
var areBackupsEnabled: Boolean by booleanValue(KEY_BACKUPS_ENABLED, false)
/**
* Retrieves the stored credentials, mapped by the day they're valid. The day is represented as
* the unix time (in seconds) of the start of the day. Wrapped in a [ArchiveServiceCredentials]