Add failsafe for clearing abandoned backup progress.

This commit is contained in:
Greyson Parrelli
2025-09-04 12:19:21 -04:00
parent 0d3727f08b
commit ccf1be2359
3 changed files with 10 additions and 3 deletions

View File

@@ -205,7 +205,7 @@ public class ApplicationContext extends Application implements AppForegroundObse
.addNonBlocking(AppDependencies::getBillingApi)
.addNonBlocking(this::ensureProfileUploaded)
.addNonBlocking(() -> AppDependencies.getExpireStoriesManager().scheduleIfNecessary())
.addNonBlocking(BackupRepository::maybeFixAnyDanglingAttachmentUploads)
.addNonBlocking(BackupRepository::maybeFixAnyDanglingUploadProgress)
.addPostRender(() -> AppDependencies.getDeletedCallEventManager().scheduleIfNecessary())
.addPostRender(() -> RateLimitUtil.retryAllRateLimitedMessages(this))
.addPostRender(this::initializeExpiringMessageManager)

View File

@@ -116,6 +116,7 @@ import org.thoughtcrime.securesms.keyvalue.BackupValues.ArchiveServiceCredential
import org.thoughtcrime.securesms.keyvalue.KeyValueStore
import org.thoughtcrime.securesms.keyvalue.SignalStore
import org.thoughtcrime.securesms.keyvalue.isDecisionPending
import org.thoughtcrime.securesms.keyvalue.protos.ArchiveUploadProgressState
import org.thoughtcrime.securesms.logsubmit.SubmitDebugLogRepository
import org.thoughtcrime.securesms.net.SignalNetwork
import org.thoughtcrime.securesms.notifications.NotificationChannels
@@ -548,7 +549,13 @@ object BackupRepository {
}
@JvmStatic
fun maybeFixAnyDanglingAttachmentUploads() {
fun maybeFixAnyDanglingUploadProgress() {
if (SignalStore.backup.archiveUploadState?.backupPhase == ArchiveUploadProgressState.BackupPhase.Message && AppDependencies.jobManager.find { it.factoryKey == BackupMessagesJob.KEY }.isEmpty()) {
SignalStore.backup.archiveUploadState = null
BackupMessagesJob.enqueue()
return
}
if (!SignalStore.backup.backsUpMedia || !AppDependencies.jobManager.areQueuesEmpty(UploadAttachmentToArchiveJob.QUEUES)) {
return
}

View File

@@ -159,7 +159,7 @@ class RemoteBackupsSettingsViewModel : ViewModel() {
}
viewModelScope.launch(Dispatchers.IO) {
BackupRepository.maybeFixAnyDanglingAttachmentUploads()
BackupRepository.maybeFixAnyDanglingUploadProgress()
}
}