Update some BackupValues stuff.

This commit is contained in:
Greyson Parrelli
2024-10-09 11:42:27 -04:00
parent 88ea258b45
commit 229a78305f
7 changed files with 71 additions and 34 deletions

View File

@@ -84,7 +84,10 @@ class BackupMessagesJob private constructor(parameters: Parameters) : Job(parame
FileInputStream(tempBackupFile).use {
when (val result = BackupRepository.uploadBackupFile(it, tempBackupFile.length())) {
is NetworkResult.Success -> Log.i(TAG, "Successfully uploaded backup file.")
is NetworkResult.Success -> {
Log.i(TAG, "Successfully uploaded backup file.")
SignalStore.backup.hasBackupBeenUploaded = true
}
is NetworkResult.NetworkError -> return Result.retry(defaultBackoff())
is NetworkResult.StatusCodeError -> return Result.retry(defaultBackoff())
is NetworkResult.ApplicationError -> throw result.throwable
@@ -110,11 +113,11 @@ class BackupMessagesJob private constructor(parameters: Parameters) : Job(parame
stopwatch.split("used-space")
stopwatch.stop(TAG)
if (SignalDatabase.attachments.doAnyAttachmentsNeedArchiveUpload()) {
if (SignalStore.backup.backsUpMedia && SignalDatabase.attachments.doAnyAttachmentsNeedArchiveUpload()) {
Log.i(TAG, "Enqueuing attachment backfill job.")
AppDependencies.jobManager.add(ArchiveAttachmentBackfillJob())
} else {
Log.i(TAG, "No attachments need to be uploaded, we can finish.")
Log.i(TAG, "No attachments need to be uploaded, we can finish. Tier: ${SignalStore.backup.backupTier}")
ArchiveUploadProgress.onMessageBackupFinishedEarly()
}