mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 19:38:52 +01:00
Add ability to stop restore
This commit is contained in:
@@ -115,6 +115,7 @@ class BackupController : QkController<BackupView, BackupState, BackupPresenter>(
|
||||
progressTitle.setText(R.string.backup_backing_up)
|
||||
progressSummary.text = state.backupProgress.getLabel(activity!!)
|
||||
progressSummary.isVisible = progressSummary.text.isNotEmpty()
|
||||
progressCancel.isVisible = false
|
||||
val running = (state.backupProgress as? BackupRepository.Progress.Running)
|
||||
progressBar.isVisible = state.backupProgress.indeterminate || running?.max ?: 0 > 0
|
||||
progressBar.isIndeterminate = state.backupProgress.indeterminate
|
||||
@@ -129,6 +130,7 @@ class BackupController : QkController<BackupView, BackupState, BackupPresenter>(
|
||||
progressTitle.setText(R.string.backup_restoring)
|
||||
progressSummary.text = state.restoreProgress.getLabel(activity!!)
|
||||
progressSummary.isVisible = progressSummary.text.isNotEmpty()
|
||||
progressCancel.isVisible = true
|
||||
val running = (state.restoreProgress as? BackupRepository.Progress.Running)
|
||||
progressBar.isVisible = state.restoreProgress.indeterminate || running?.max ?: 0 > 0
|
||||
progressBar.isIndeterminate = state.restoreProgress.indeterminate
|
||||
|
||||
@@ -103,7 +103,7 @@ class BackupPresenter @Inject constructor(
|
||||
|
||||
view.stopRestoreConfirmed()
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe()
|
||||
.subscribe { backupRepo.stopRestore() }
|
||||
|
||||
view.fabClicks()
|
||||
.withLatestFrom(billingManager.upgradeStatus) { _, upgraded -> upgraded }
|
||||
|
||||
@@ -86,19 +86,15 @@ class RestoreBackupService : Service() {
|
||||
when (progress) {
|
||||
is BackupRepository.Progress.Idle -> stop()
|
||||
|
||||
is BackupRepository.Progress.Running -> {
|
||||
notification
|
||||
.setProgress(progress.max, progress.count, progress.indeterminate)
|
||||
.setContentText(progress.getLabel(this))
|
||||
notificationManager.notify(NOTIFICATION_ID, notification.build())
|
||||
}
|
||||
is BackupRepository.Progress.Running -> notification
|
||||
.setProgress(progress.max, progress.count, progress.indeterminate)
|
||||
.setContentText(progress.getLabel(this))
|
||||
.let { notificationManager.notify(NOTIFICATION_ID, it.build()) }
|
||||
|
||||
else -> {
|
||||
notification
|
||||
.setProgress(0, 0, progress.indeterminate)
|
||||
.setContentText(progress.getLabel(this))
|
||||
notificationManager.notify(NOTIFICATION_ID, notification.build())
|
||||
}
|
||||
else -> notification
|
||||
.setProgress(0, 0, progress.indeterminate)
|
||||
.setContentText(progress.getLabel(this))
|
||||
.let { notificationManager.notify(NOTIFICATION_ID, it.build()) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user