Integrate the backup size into backup settings.

This commit is contained in:
Clark
2024-05-06 12:55:13 -04:00
committed by Alex Hart
parent b2efc42357
commit de3b0d4ca2
6 changed files with 46 additions and 6 deletions

View File

@@ -243,6 +243,17 @@ object BackupRepository {
}
}
fun getRemoteBackupUsedSpace(): NetworkResult<Long?> {
val api = ApplicationDependencies.getSignalServiceAccountManager().archiveApi
val backupKey = SignalStore.svr().getOrCreateMasterKey().deriveBackupKey()
return initBackupAndFetchAuth(backupKey)
.then { credential ->
api.getBackupInfo(backupKey, credential)
.map { it.usedSpace }
}
}
/**
* Returns an object with details about the remote backup state.
*/
@@ -551,6 +562,7 @@ object BackupRepository {
return initBackupAndFetchAuth(backupKey)
.then { credential ->
api.getBackupInfo(backupKey, credential).map {
SignalStore.backup().usedBackupMediaSpace = it.usedSpace ?: 0L
BackupDirectories(it.backupDir!!, it.mediaDir!!)
}
}