Highlight restore backup setting when navigating from onboarding step

This commit is contained in:
arkon 2023-12-24 16:35:18 -05:00
parent 19f0175a56
commit 93cbeca5c0
2 changed files with 9 additions and 1 deletions

View File

@ -54,6 +54,8 @@ import uy.kohesive.injekt.api.get
object SettingsDataScreen : SearchableSettings {
val restorePreferenceKeyString = MR.strings.label_backup
@ReadOnlyComposable
@Composable
override fun getTitleRes() = MR.strings.label_data_storage
@ -143,7 +145,7 @@ object SettingsDataScreen : SearchableSettings {
preferenceItems = listOf(
// Manual actions
Preference.PreferenceItem.CustomPreference(
title = stringResource(MR.strings.label_backup),
title = stringResource(restorePreferenceKeyString),
) {
BasePreferenceWidget(
subcomponent = {

View File

@ -8,8 +8,11 @@ import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
import eu.kanade.domain.base.BasePreferences
import eu.kanade.presentation.more.onboarding.OnboardingScreen
import eu.kanade.presentation.more.settings.screen.SearchableSettings
import eu.kanade.presentation.more.settings.screen.SettingsDataScreen
import eu.kanade.presentation.util.Screen
import eu.kanade.tachiyomi.ui.setting.SettingsScreen
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@ -28,6 +31,8 @@ class OnboardingScreen : Screen() {
navigator.pop()
}
val restoreSettingKey = stringResource(SettingsDataScreen.restorePreferenceKeyString)
BackHandler(
enabled = !shownOnboardingFlow,
onBack = {
@ -39,6 +44,7 @@ class OnboardingScreen : Screen() {
onComplete = finishOnboarding,
onRestoreBackup = {
finishOnboarding()
SearchableSettings.highlightKey = restoreSettingKey
navigator.push(SettingsScreen(SettingsScreen.Destination.DataAndStorage))
},
)