Tell user about non enabled backup
* Pressing "Backup now" should not just ignore you when it's not actually enabled * Add a toast message telling you it's not enabled Fixes: #390 Change-Id: I5d698a244652e094b0acfc42cdea017a0af9a20b
This commit is contained in:
parent
c97375b294
commit
19ed570a4e
3 changed files with 6 additions and 1 deletions
|
@ -50,7 +50,7 @@ open class App : Application() {
|
|||
factory<IBackupManager> { IBackupManager.Stub.asInterface(getService(BACKUP_SERVICE)) }
|
||||
factory { AppListRetriever(this@App, get(), get(), get()) }
|
||||
|
||||
viewModel { SettingsViewModel(this@App, get(), get(), get(), get(), get(), get()) }
|
||||
viewModel { SettingsViewModel(this@App, get(), get(), get(), get(), get(), get(), get()) }
|
||||
viewModel { RecoveryCodeViewModel(this@App, get(), get(), get(), get(), get(), get()) }
|
||||
viewModel { BackupStorageViewModel(this@App, get(), get(), get(), get()) }
|
||||
viewModel { RestoreStorageViewModel(this@App, get(), get()) }
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.stevesoltys.seedvault.settings
|
||||
|
||||
import android.app.Application
|
||||
import android.app.backup.IBackupManager
|
||||
import android.app.job.JobInfo.NETWORK_TYPE_NONE
|
||||
import android.app.job.JobInfo.NETWORK_TYPE_UNMETERED
|
||||
import android.content.Intent
|
||||
|
@ -49,6 +50,7 @@ internal class SettingsViewModel(
|
|||
private val metadataManager: MetadataManager,
|
||||
private val appListRetriever: AppListRetriever,
|
||||
private val storageBackup: StorageBackup,
|
||||
private val backupManager: IBackupManager,
|
||||
) : RequireProvisioningViewModel(app, settingsManager, keyManager) {
|
||||
|
||||
private val contentResolver = app.contentResolver
|
||||
|
@ -157,6 +159,8 @@ internal class SettingsViewModel(
|
|||
// maybe replace the check below with one that checks if our transport service is running
|
||||
if (notificationManager.hasActiveBackupNotifications()) {
|
||||
Toast.makeText(app, R.string.notification_backup_already_running, LENGTH_LONG).show()
|
||||
} else if (!backupManager.isBackupEnabled) {
|
||||
Toast.makeText(app, R.string.notification_backup_disabled, LENGTH_LONG).show()
|
||||
} else viewModelScope.launch(Dispatchers.IO) {
|
||||
if (settingsManager.isStorageBackupEnabled()) {
|
||||
val i = Intent(app, StorageBackupService::class.java)
|
||||
|
|
|
@ -111,6 +111,7 @@
|
|||
<string name="notification_channel_title">Backup notification</string>
|
||||
<string name="notification_title">Backup running</string>
|
||||
<string name="notification_backup_already_running">Backup already in progress</string>
|
||||
<string name="notification_backup_disabled">Backup not enabled</string>
|
||||
|
||||
<string name="notification_success_title">Backup finished</string>
|
||||
<string name="notification_success_text">%1$d of %2$d apps backed up. Tap to learn more.</string>
|
||||
|
|
Loading…
Reference in a new issue