commit ef1566add266cab963b3da458efd4673f01cbe33
parent 23b681db2b2b18dddae0b26e8cb55957eda0157a
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date:   Wed, 14 Aug 2024 17:00:29 +0200

fix(setup/ui): mappings screen crash

Diffstat:
Mapp/src/main/kotlin/me/rhunk/snapenhance/RemoteSideContext.kt | 4++--
Mapp/src/main/kotlin/me/rhunk/snapenhance/ui/setup/SetupActivity.kt | 2+-
Mapp/src/main/kotlin/me/rhunk/snapenhance/ui/setup/screens/impl/MappingsScreen.kt | 5++++-
3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/RemoteSideContext.kt b/app/src/main/kotlin/me/rhunk/snapenhance/RemoteSideContext.kt @@ -220,9 +220,9 @@ class RemoteSideContext( requirements = requirements or Requirements.MAPPINGS } - /*if (sharedPreferences.getString("sif", null) == null) { + if (sharedPreferences.getString("sif", null) == null) { requirements = requirements or Requirements.SIF - }*/ + } if (requirements == 0) return false diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/ui/setup/SetupActivity.kt b/app/src/main/kotlin/me/rhunk/snapenhance/ui/setup/SetupActivity.kt @@ -66,7 +66,7 @@ class SetupActivity : ComponentActivity() { if (isFirstRun || hasRequirement(Requirements.MAPPINGS)) { add(MappingsScreen().apply { route = "mappings" }) } - if (hasRequirement(Requirements.SIF)) { + if (isFirstRun || hasRequirement(Requirements.SIF)) { add(SecurityScreen().apply { route = "security" }) } } diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/ui/setup/screens/impl/MappingsScreen.kt b/app/src/main/kotlin/me/rhunk/snapenhance/ui/setup/screens/impl/MappingsScreen.kt @@ -10,6 +10,7 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.window.Dialog import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext import me.rhunk.snapenhance.ui.setup.screens.SetupScreen import me.rhunk.snapenhance.ui.util.AlertDialogs @@ -40,7 +41,9 @@ class MappingsScreen : SetupScreen() { throw Exception(context.translation["setup.mappings.generate_failure_no_snapchat"]) } context.mappings.refresh() - goNext() + withContext(Dispatchers.Main) { + goNext() + } }.onFailure { isGenerating = false infoText = context.translation["setup.mappings.generate_failure"] + "\n\n" + it.message