feat: Implement forced logout on app restart and prioritize last logged public key in UnlockScreen
This commit is contained in:
@@ -93,9 +93,16 @@ fun UnlockScreen(
|
||||
)
|
||||
}
|
||||
|
||||
// Select account
|
||||
val targetPublicKey = selectedAccountId ?: accountManager.currentPublicKey.first()
|
||||
// Select account - prioritize: selectedAccountId > lastLoggedPublicKey > currentPublicKey > first account
|
||||
val lastLoggedKey = accountManager.getLastLoggedPublicKey()
|
||||
val currentKey = accountManager.currentPublicKey.first()
|
||||
val targetPublicKey = selectedAccountId ?: lastLoggedKey ?: currentKey
|
||||
|
||||
Log.d("UnlockScreen", "selectedAccountId=$selectedAccountId, lastLoggedKey=$lastLoggedKey, currentKey=$currentKey, targetPublicKey=$targetPublicKey")
|
||||
Log.d("UnlockScreen", "accounts=${accounts.map { it.publicKey }}")
|
||||
|
||||
selectedAccount = accounts.find { it.publicKey == targetPublicKey } ?: accounts.firstOrNull()
|
||||
Log.d("UnlockScreen", "selectedAccount=${selectedAccount?.publicKey}")
|
||||
}
|
||||
|
||||
// Filter accounts by search
|
||||
|
||||
@@ -159,7 +159,7 @@ fun ChatsListScreen(
|
||||
val drawerState = rememberDrawerState(initialValue = DrawerValue.Closed)
|
||||
val scope = rememberCoroutineScope()
|
||||
|
||||
// Update status bar and navigation bar colors to match background
|
||||
// Update status bar and completely hide navigation bar
|
||||
LaunchedEffect(isDarkTheme) {
|
||||
if (!view.isInEditMode) {
|
||||
val window = (view.context as android.app.Activity).window
|
||||
@@ -169,10 +169,9 @@ fun ChatsListScreen(
|
||||
insetsController.isAppearanceLightStatusBars = !isDarkTheme
|
||||
window.statusBarColor = android.graphics.Color.TRANSPARENT
|
||||
|
||||
// Navigation bar - match background color
|
||||
val navBarColor = if (isDarkTheme) 0xFF1A1A1A.toInt() else 0xFFFFFFFF.toInt()
|
||||
window.navigationBarColor = navBarColor
|
||||
insetsController.isAppearanceLightNavigationBars = !isDarkTheme
|
||||
// Completely hide navigation bar
|
||||
insetsController.hide(androidx.core.view.WindowInsetsCompat.Type.navigationBars())
|
||||
insetsController.systemBarsBehavior = androidx.core.view.WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user