fix(setup/ui): mappings screen crash

This commit is contained in:
rhunk
2024-08-14 17:00:29 +02:00
parent 23b681db2b
commit ef1566add2
3 changed files with 7 additions and 4 deletions

View File

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

View File

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

View File

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