From f4d6e3cb3e20e482ff14615f23d58cb581ecd404 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Fri, 13 Mar 2026 13:22:44 -0400 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../src/main/java/com/vitorpamplona/amethyst/AppModules.kt | 6 ++++++ .../ui/screen/loggedIn/settings/OtsSettingsSection.kt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/AppModules.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/AppModules.kt index 25db5b3f4c..46e068a16c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/AppModules.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/AppModules.kt @@ -117,6 +117,12 @@ class AppModules( OtsSharedPreferences(appContext, applicationIOScope) } + init { + applicationIOScope.launch { + // Eagerly initialize OtsSharedPreferences off the main thread + otsPrefs + } + } // App services that should be run as soon as there are subscribers to their flows val locationManager = LocationState(appContext, applicationIOScope) val connManager = ConnectivityManager(appContext, applicationIOScope) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/OtsSettingsSection.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/OtsSettingsSection.kt index 5f2e861aba..380c774427 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/OtsSettingsSection.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/OtsSettingsSection.kt @@ -234,7 +234,7 @@ private fun CustomExplorerInput( onSave: (String?) -> Unit, ) { var input by rememberSaveable(currentUrl) { mutableStateOf(currentUrl ?: "") } - var validationError by remember { mutableStateOf(null) } + var validationError by remember(currentUrl) { mutableStateOf(null) } val kb = LocalSoftwareKeyboardController.current fun trySave() {