Browse Source

Highlight restore backup setting when navigating from onboarding step

arkon 1 year ago
parent
commit
93cbeca5c0

+ 3 - 1
app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDataScreen.kt

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

+ 6 - 0
app/src/main/java/eu/kanade/tachiyomi/ui/more/OnboardingScreen.kt

@@ -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))
             },
         )