Update backup functionality

* Add option to disable automatic backups
* Add link to backup documentation
* Rearrange backup sections
pull/1122/head
Alex Baker 4 years ago
parent 5ed4d89e43
commit a1e239eee5

@ -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) {

@ -373,6 +373,7 @@
<string name="p_show_whats_new">show_whats_new</string>
<string name="p_just_updated">just_updated</string>
<string name="p_clicked_rate">clicked_rate</string>
<string name="p_backups_enabled">backups_enabled</string>
<string name="p_backups_android_backup_enabled">backups_android_backup_enabled</string>
<string name="p_backups_android_backup_last">backups_android_backup_last</string>
<string name="p_current_version">cv</string>

@ -637,6 +637,7 @@ File %1$s contained %2$s.\n\n
<string name="reset_sort_order">Reset sort order</string>
<string name="permission_read_tasks">Full access to Tasks database</string>
<string name="account_not_found">Account not found</string>
<string name="automatic_backups">Automatic backups</string>
<string name="android_auto_backup">Android Backup Service</string>
<string name="android_auto_backup_device_summary">You must also opt in to backup service through your device settings. Not all devices provide backup service.</string>
<string name="last_backup">Last backup: %s</string>

@ -2,9 +2,20 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<Preference
android:title="@string/documentation"
android:icon="@drawable/ic_open_in_new_24px">
<intent
android:action="android.intent.action.VIEW"
android:data="https://tasks.org/backups" />
</Preference>
<Preference
android:key="@string/p_backup_dir"
android:title="@string/backup_directory" />
android:title="@string/backup_directory"
app:allowDividerAbove="true" />
<Preference
android:key="@string/backup_BAc_import"
@ -15,17 +26,13 @@
android:title="@string/backup_BAc_export" />
<PreferenceCategory
android:title="@string/google_drive_backup">
android:title="@string/automatic_backups">
<SwitchPreferenceCompat
android:key="@string/google_drive_backup"
android:key="@string/p_backups_enabled"
android:defaultValue="true"
android:title="@string/enabled" />
<Preference
android:key="@string/p_google_drive_backup_account"
android:title="@string/account"
android:summary="@string/none"/>
</PreferenceCategory>
<PreferenceCategory
@ -45,4 +52,18 @@
</PreferenceCategory>
<PreferenceCategory
android:title="@string/google_drive_backup">
<SwitchPreferenceCompat
android:key="@string/google_drive_backup"
android:title="@string/enabled" />
<Preference
android:key="@string/p_google_drive_backup_account"
android:title="@string/account"
android:summary="@string/none"/>
</PreferenceCategory>
</PreferenceScreen>
Loading…
Cancel
Save