mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 04:58:45 +00:00
Ensure that restore status gets reset on failure.
This commit is contained in:
committed by
Cody Henthorne
parent
9997ac2ef9
commit
2a3888472f
@@ -91,6 +91,12 @@ object ArchiveRestoreProgress {
|
||||
update()
|
||||
}
|
||||
|
||||
fun onRestoreFailed() {
|
||||
Log.i(TAG, "onRestoreFailed")
|
||||
SignalStore.backup.restoreState = RestoreState.NONE
|
||||
update()
|
||||
}
|
||||
|
||||
fun onStartMediaRestore() {
|
||||
Log.i(TAG, "onStartMediaRestore")
|
||||
SignalStore.backup.restoreState = RestoreState.CALCULATING_MEDIA
|
||||
|
||||
@@ -2151,9 +2151,13 @@ object BackupRepository {
|
||||
try {
|
||||
DataRestoreConstraint.isRestoringData = true
|
||||
return withContext(Dispatchers.IO) {
|
||||
return@withContext BackupProgressService.start(context, context.getString(R.string.BackupProgressService_title)).use {
|
||||
val result = BackupProgressService.start(context, context.getString(R.string.BackupProgressService_title)).use {
|
||||
restoreRemoteBackup(controller = it, cancellationSignal = { !isActive })
|
||||
}
|
||||
if (result !is RemoteRestoreResult.Success) {
|
||||
ArchiveRestoreProgress.onRestoreFailed()
|
||||
}
|
||||
return@withContext result
|
||||
}
|
||||
} finally {
|
||||
DataRestoreConstraint.isRestoringData = false
|
||||
|
||||
Reference in New Issue
Block a user