Show notification right away when requesting manual backup

This commit is contained in:
Torsten Grote 2019-09-13 12:48:51 -03:00
parent 6d8178f6b1
commit 4efaa08881
No known key found for this signature in database
GPG key ID: 3E5F77D92CF891FF
2 changed files with 8 additions and 1 deletions

View file

@ -1,6 +1,8 @@
package com.stevesoltys.backup.settings
import android.app.Application
import com.stevesoltys.backup.Backup
import com.stevesoltys.backup.R
import com.stevesoltys.backup.transport.requestBackup
import com.stevesoltys.backup.ui.RequireProvisioningViewModel
@ -10,6 +12,10 @@ class SettingsViewModel(app: Application) : RequireProvisioningViewModel(app) {
override val isRestoreOperation = false
fun backupNow() = Thread { requestBackup(app) }.start()
fun backupNow() {
val nm = (app as Backup).notificationManager
nm.onBackupUpdate(app.getString(R.string.notification_backup_starting), 0, 1, true)
Thread { requestBackup(app) }.start()
}
}

View file

@ -73,6 +73,7 @@
<!-- Notification -->
<string name="notification_channel_title">Backup Notification</string>
<string name="notification_title">Backup running</string>
<string name="notification_backup_starting">Starting Backup…</string>
<string name="notification_backup_result_complete">Backup complete</string>
<string name="notification_backup_result_rejected">Not backed up</string>
<string name="notification_backup_result_error">Backup failed</string>