Backup now: run storage backup before app backup
This commit is contained in:
parent
9ca6cf2aae
commit
d6bd36ad8b
1 changed files with 5 additions and 0 deletions
|
@ -31,6 +31,7 @@ import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.calyxos.backup.storage.api.StorageBackup
|
import org.calyxos.backup.storage.api.StorageBackup
|
||||||
import org.calyxos.backup.storage.backup.BackupJobService
|
import org.calyxos.backup.storage.backup.BackupJobService
|
||||||
|
import org.calyxos.backup.storage.backup.NotificationBackupObserver
|
||||||
import java.util.concurrent.TimeUnit.HOURS
|
import java.util.concurrent.TimeUnit.HOURS
|
||||||
|
|
||||||
private const val TAG = "SettingsViewModel"
|
private const val TAG = "SettingsViewModel"
|
||||||
|
@ -152,6 +153,10 @@ internal class SettingsViewModel(
|
||||||
if (notificationManager.hasActiveBackupNotifications()) {
|
if (notificationManager.hasActiveBackupNotifications()) {
|
||||||
Toast.makeText(app, R.string.notification_backup_already_running, LENGTH_LONG).show()
|
Toast.makeText(app, R.string.notification_backup_already_running, LENGTH_LONG).show()
|
||||||
} else viewModelScope.launch(Dispatchers.IO) {
|
} else viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
if (settingsManager.isStorageBackupEnabled()) {
|
||||||
|
val backupObserver = NotificationBackupObserver(app)
|
||||||
|
storageBackup.runBackup(backupObserver)
|
||||||
|
}
|
||||||
requestBackup(app)
|
requestBackup(app)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue