From 9c91ddd4e3b27d42afac91efeae9e528798f114c Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 6 Jan 2024 18:26:39 -0500 Subject: [PATCH] Add link to storage FAQ in settings screen --- .../more/onboarding/StorageStep.kt | 2 +- .../more/settings/screen/SettingsDataScreen.kt | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/presentation/more/onboarding/StorageStep.kt b/app/src/main/java/eu/kanade/presentation/more/onboarding/StorageStep.kt index fa1e73fe4..4b6409746 100644 --- a/app/src/main/java/eu/kanade/presentation/more/onboarding/StorageStep.kt +++ b/app/src/main/java/eu/kanade/presentation/more/onboarding/StorageStep.kt @@ -77,7 +77,7 @@ internal class StorageStep : OnboardingStep { Text(stringResource(MR.strings.onboarding_storage_help_info, stringResource(MR.strings.app_name))) Button( modifier = Modifier.fillMaxWidth(), - onClick = { handler.openUri("https://tachiyomi.org/docs/faq/storage") }, + onClick = { handler.openUri(SettingsDataScreen.HELP_URL) }, ) { Text(stringResource(MR.strings.onboarding_storage_help_action)) } diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDataScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDataScreen.kt index 9f0d5fc60..43d24510c 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDataScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDataScreen.kt @@ -7,8 +7,13 @@ import android.net.Uri import androidx.activity.compose.ManagedActivityResultLauncher import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.result.contract.ActivityResultContracts +import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.outlined.HelpOutline +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton import androidx.compose.material3.MultiChoiceSegmentedButtonRow import androidx.compose.material3.SegmentedButton import androidx.compose.material3.SegmentedButtonDefaults @@ -22,6 +27,7 @@ import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalUriHandler import androidx.core.net.toUri import cafe.adriel.voyager.navigator.LocalNavigator import cafe.adriel.voyager.navigator.currentOrThrow @@ -58,11 +64,23 @@ import uy.kohesive.injekt.api.get object SettingsDataScreen : SearchableSettings { val restorePreferenceKeyString = MR.strings.label_backup + const val HELP_URL = "https://tachiyomi.org/docs/faq/storage" @ReadOnlyComposable @Composable override fun getTitleRes() = MR.strings.label_data_storage + @Composable + override fun RowScope.AppBarAction() { + val uriHandler = LocalUriHandler.current + IconButton(onClick = { uriHandler.openUri(HELP_URL) }) { + Icon( + imageVector = Icons.AutoMirrored.Outlined.HelpOutline, + contentDescription = stringResource(MR.strings.tracking_guide), + ) + } + } + @Composable override fun getPreferences(): List { val backupPreferences = Injekt.get()