修复无网崩溃

This commit is contained in:
2025-09-05 16:51:19 +08:00
parent b4ed311978
commit e61fb2ad79

View File

@@ -84,21 +84,25 @@ fun LoginPage() {
mutableStateOf(false)
}
suspend fun checkGoogleLoginEnable() {
val result = dictService.getDistList(
listOf(
ConstVars.DICT_KEY_ENABLE_GOOGLE_LOGIN,
ConstVars.DICT_KEY_GOOGLE_LOGIN_CLIENT_ID
try {
val result = dictService.getDistList(
listOf(
ConstVars.DICT_KEY_ENABLE_GOOGLE_LOGIN,
ConstVars.DICT_KEY_GOOGLE_LOGIN_CLIENT_ID
)
)
)
val enableDictItem = result.find { it.key == ConstVars.DICT_KEY_ENABLE_GOOGLE_LOGIN }
val clientIdDictItem = result.find { it.key == ConstVars.DICT_KEY_GOOGLE_LOGIN_CLIENT_ID }
if (enableDictItem != null && clientIdDictItem != null) {
AppState.googleClientId = clientIdDictItem.value as? String
showGoogleLogin = enableDictItem.value == true
} else {
showGoogleLogin = false
val enableDictItem = result.find { it.key == ConstVars.DICT_KEY_ENABLE_GOOGLE_LOGIN }
val clientIdDictItem = result.find { it.key == ConstVars.DICT_KEY_GOOGLE_LOGIN_CLIENT_ID }
if (enableDictItem != null && clientIdDictItem != null) {
AppState.googleClientId = clientIdDictItem.value as? String
showGoogleLogin = enableDictItem.value == true
} else {
showGoogleLogin = false
}
AppState.enableGoogleLogin = showGoogleLogin
} catch (_: Exception) {
}
AppState.enableGoogleLogin = showGoogleLogin
}
LaunchedEffect(Unit) {
statusBarController.setStatusBarColor(Color.Transparent, darkIcons = !AppState.darkMode)