Move encrypt database setting and add a warning
This commit is contained in:
parent
28ffdd53a0
commit
3dd86c3f77
@ -45,6 +45,7 @@ import eu.kanade.presentation.more.settings.Preference
|
||||
import eu.kanade.presentation.more.settings.screen.debug.DebugInfoScreen
|
||||
import eu.kanade.presentation.util.collectAsState
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.core.security.SecurityPreferences
|
||||
import eu.kanade.tachiyomi.data.cache.ChapterCache
|
||||
import eu.kanade.tachiyomi.data.cache.PagePreviewCache
|
||||
import eu.kanade.tachiyomi.data.download.DownloadCache
|
||||
@ -677,6 +678,7 @@ object SettingsAdvancedScreen : SearchableSettings {
|
||||
val sourcePreferences = remember { Injekt.get<SourcePreferences>() }
|
||||
val unsortedPreferences = remember { Injekt.get<UnsortedPreferences>() }
|
||||
val delegateSourcePreferences = remember { Injekt.get<DelegateSourcePreferences>() }
|
||||
val securityPreferences = remember { Injekt.get<SecurityPreferences>() }
|
||||
return Preference.PreferenceGroup(
|
||||
title = stringResource(R.string.developer_tools),
|
||||
preferenceItems = listOf(
|
||||
@ -723,6 +725,53 @@ object SettingsAdvancedScreen : SearchableSettings {
|
||||
stringResource(R.string.app_name),
|
||||
),
|
||||
),
|
||||
kotlin.run {
|
||||
var enableEncryptDatabase by rememberSaveable { mutableStateOf(false) }
|
||||
|
||||
if (enableEncryptDatabase) {
|
||||
val dismiss = { enableEncryptDatabase = false }
|
||||
AlertDialog(
|
||||
onDismissRequest = dismiss,
|
||||
title = { Text(text = stringResource(R.string.encrypt_database)) },
|
||||
text = {
|
||||
Text(
|
||||
text = remember {
|
||||
HtmlCompat.fromHtml(context.getString(R.string.encrypt_database_message), HtmlCompat.FROM_HTML_MODE_COMPACT)
|
||||
.toAnnotatedString()
|
||||
},
|
||||
)
|
||||
},
|
||||
dismissButton = {
|
||||
TextButton(onClick = dismiss) {
|
||||
Text(text = stringResource(R.string.action_cancel))
|
||||
}
|
||||
},
|
||||
confirmButton = {
|
||||
TextButton(
|
||||
onClick = {
|
||||
dismiss()
|
||||
securityPreferences.encryptDatabase().set(true)
|
||||
},
|
||||
) {
|
||||
Text(text = stringResource(android.R.string.ok))
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
Preference.PreferenceItem.SwitchPreference(
|
||||
title = stringResource(R.string.encrypt_database),
|
||||
pref = securityPreferences.encryptDatabase(),
|
||||
subtitle = stringResource(R.string.encrypt_database_subtitle),
|
||||
onValueChanged = {
|
||||
if (it) {
|
||||
enableEncryptDatabase = true
|
||||
false
|
||||
} else {
|
||||
true
|
||||
}
|
||||
},
|
||||
)
|
||||
},
|
||||
Preference.PreferenceItem.TextPreference(
|
||||
title = stringResource(R.string.open_debug_menu),
|
||||
subtitle = remember {
|
||||
|
@ -126,11 +126,6 @@ object SettingsSecurityScreen : SearchableSettings {
|
||||
.associateWith { stringResource(it.titleResId) },
|
||||
),
|
||||
// SY -->
|
||||
Preference.PreferenceItem.SwitchPreference(
|
||||
title = stringResource(R.string.encrypt_database),
|
||||
pref = securityPreferences.encryptDatabase(),
|
||||
subtitle = stringResource(R.string.encrypt_database_subtitle),
|
||||
),
|
||||
Preference.PreferenceItem.SwitchPreference(
|
||||
pref = securityPreferences.passwordProtectDownloads(),
|
||||
title = stringResource(R.string.password_protect_downloads),
|
||||
|
@ -221,7 +221,10 @@
|
||||
<string name="friday">Friday</string>
|
||||
<string name="saturday">Saturday</string>
|
||||
<string name="encrypt_database">Encrypt database</string>
|
||||
<string name="encrypt_database_subtitle">Requires app restart to take effect \nClearing app data and loading a backup is highly recommended</string>
|
||||
<string name="encrypt_database_subtitle">Requires app restart to take effect</string>
|
||||
<string name="encrypt_database_message">
|
||||
<![CDATA[<font color=\'red\'>ENABLING THIS WILL CREATE A NEW DATABASE. USE THESE STEPS TO KEEP YOUR DATA<br>1. SETTINGS -> BACKUP -> CREATE<br>2. SYSTEM SETTINGS -> CLEAR APP DATA<br>3. SYSTEM SETTINGS -> FORCE RESTART<br>4. SETTINGS -> BACKUP -> RESTORE</font>]]>
|
||||
</string>
|
||||
<string name="set_cbz_zip_password">Set CBZ archive password</string>
|
||||
<string name="password_protect_downloads">Password protect downloads</string>
|
||||
<string name="password_protect_downloads_summary">Encrypts CBZ archive downloads with the given password.\nWARNING: DATA INSIDE THE ARCHIVES WILL BE LOST FOREVER IF YOU FORGET THE PASSWORD</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user