diff --git a/app/src/main/java/org/tasks/jobs/BackupWork.kt b/app/src/main/java/org/tasks/jobs/BackupWork.kt index 96c110ca2..2980eb9e5 100644 --- a/app/src/main/java/org/tasks/jobs/BackupWork.kt +++ b/app/src/main/java/org/tasks/jobs/BackupWork.kt @@ -34,6 +34,10 @@ class BackupWork @WorkerInject constructor( override suspend fun scheduleNext() = workManager.scheduleBackup() private suspend fun startBackup(context: Context?) { + if (!preferences.getBoolean(R.string.p_backups_enabled, true)) { + Timber.d("Automatic backups disabled") + return + } try { deleteOldLocalBackups() } catch (e: Exception) { diff --git a/app/src/main/res/values/keys.xml b/app/src/main/res/values/keys.xml index 1130db8ca..2c6769363 100644 --- a/app/src/main/res/values/keys.xml +++ b/app/src/main/res/values/keys.xml @@ -373,6 +373,7 @@ show_whats_new just_updated clicked_rate + backups_enabled backups_android_backup_enabled backups_android_backup_last cv diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 72ce47392..9fe80f745 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -637,6 +637,7 @@ File %1$s contained %2$s.\n\n Reset sort order Full access to Tasks database Account not found + Automatic backups Android Backup Service You must also opt in to backup service through your device settings. Not all devices provide backup service. Last backup: %s diff --git a/app/src/main/res/xml/preferences_backups.xml b/app/src/main/res/xml/preferences_backups.xml index 5f44d309b..733df2930 100644 --- a/app/src/main/res/xml/preferences_backups.xml +++ b/app/src/main/res/xml/preferences_backups.xml @@ -2,9 +2,20 @@ + + + + + + + android:title="@string/backup_directory" + app:allowDividerAbove="true" /> + android:title="@string/automatic_backups"> - - + + + + + + + + \ No newline at end of file