Fix upload media progress bar not showing after backup create.

This commit is contained in:
Cody Henthorne
2025-09-10 11:49:38 -04:00
committed by GitHub
parent d44bed0379
commit dd67398a70
2 changed files with 22 additions and 5 deletions

View File

@@ -168,8 +168,9 @@ object ArchiveUploadProgress {
fun onAttachmentSectionStarted(totalAttachmentBytes: Long) {
debugAttachmentStartTime = System.currentTimeMillis()
attachmentProgress.clear()
updateState {
it.copy(
ArchiveUploadProgressState(
state = ArchiveUploadProgressState.State.UploadMedia,
mediaUploadedBytes = 0,
mediaTotalBytes = totalAttachmentBytes
@@ -203,15 +204,24 @@ object ArchiveUploadProgress {
}
fun onMessageBackupFinishedEarly() {
updateState { PROGRESS_NONE }
resetState()
}
fun onValidationFailure() {
updateState { PROGRESS_NONE }
resetState()
}
fun onMainBackupFileUploadFailure() {
updateState { PROGRESS_NONE }
resetState()
}
private fun resetState() {
val shouldRevertToUploadMedia = SignalStore.backup.backsUpMedia && !AppDependencies.jobManager.areQueuesEmpty(UploadAttachmentToArchiveJob.QUEUES)
if (shouldRevertToUploadMedia) {
onAttachmentSectionStarted(SignalDatabase.attachments.getPendingArchiveUploadBytes())
} else {
updateState { PROGRESS_NONE }
}
}
private fun updateState(

View File

@@ -556,7 +556,14 @@ object BackupRepository {
return
}
if (!SignalStore.backup.backsUpMedia || !AppDependencies.jobManager.areQueuesEmpty(UploadAttachmentToArchiveJob.QUEUES)) {
if (!SignalStore.backup.backsUpMedia) {
return
}
if (!AppDependencies.jobManager.areQueuesEmpty(UploadAttachmentToArchiveJob.QUEUES)) {
if (SignalStore.backup.archiveUploadState?.state == ArchiveUploadProgressState.State.None) {
ArchiveUploadProgress.onAttachmentSectionStarted(SignalDatabase.attachments.getPendingArchiveUploadBytes())
}
return
}