mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 12:21:50 +01:00
Allow disabling automatic backups for whatever reason
This commit is contained in:
parent
93827aba34
commit
2cf1009f70
@ -343,6 +343,8 @@ class SettingsBackupScreen : SearchableSettings {
|
|||||||
backupPreferences: BackupPreferences,
|
backupPreferences: BackupPreferences,
|
||||||
): Preference.PreferenceGroup {
|
): Preference.PreferenceGroup {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
val backupIntervalPref = backupPreferences.backupInterval()
|
||||||
|
val backupInterval by backupIntervalPref.collectAsState()
|
||||||
val backupDirPref = backupPreferences.backupsDirectory()
|
val backupDirPref = backupPreferences.backupsDirectory()
|
||||||
val backupDir by backupDirPref.collectAsState()
|
val backupDir by backupDirPref.collectAsState()
|
||||||
val pickBackupLocation = rememberLauncherForActivityResult(
|
val pickBackupLocation = rememberLauncherForActivityResult(
|
||||||
@ -363,9 +365,10 @@ class SettingsBackupScreen : SearchableSettings {
|
|||||||
title = stringResource(R.string.pref_backup_service_category),
|
title = stringResource(R.string.pref_backup_service_category),
|
||||||
preferenceItems = listOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
pref = backupPreferences.backupInterval(),
|
pref = backupIntervalPref,
|
||||||
title = stringResource(R.string.pref_backup_interval),
|
title = stringResource(R.string.pref_backup_interval),
|
||||||
entries = mapOf(
|
entries = mapOf(
|
||||||
|
0 to stringResource(R.string.off),
|
||||||
6 to stringResource(R.string.update_6hour),
|
6 to stringResource(R.string.update_6hour),
|
||||||
12 to stringResource(R.string.update_12hour),
|
12 to stringResource(R.string.update_12hour),
|
||||||
24 to stringResource(R.string.update_24hour),
|
24 to stringResource(R.string.update_24hour),
|
||||||
@ -379,6 +382,7 @@ class SettingsBackupScreen : SearchableSettings {
|
|||||||
),
|
),
|
||||||
Preference.PreferenceItem.TextPreference(
|
Preference.PreferenceItem.TextPreference(
|
||||||
title = stringResource(R.string.pref_backup_directory),
|
title = stringResource(R.string.pref_backup_directory),
|
||||||
|
enabled = backupInterval != 0,
|
||||||
subtitle = remember(backupDir) {
|
subtitle = remember(backupDir) {
|
||||||
(UniFile.fromUri(context, backupDir.toUri())?.filePath)?.let {
|
(UniFile.fromUri(context, backupDir.toUri())?.filePath)?.let {
|
||||||
"$it/automatic"
|
"$it/automatic"
|
||||||
@ -394,6 +398,7 @@ class SettingsBackupScreen : SearchableSettings {
|
|||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
pref = backupPreferences.numberOfBackups(),
|
pref = backupPreferences.numberOfBackups(),
|
||||||
|
enabled = backupInterval != 0,
|
||||||
title = stringResource(R.string.pref_backup_slots),
|
title = stringResource(R.string.pref_backup_slots),
|
||||||
entries = listOf(2, 3, 4, 5).associateWith { it.toString() },
|
entries = listOf(2, 3, 4, 5).associateWith { it.toString() },
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user