feat: Integrate AccountManager to retrieve last logged account in AuthFlow and update MainActivity
This commit is contained in:
@@ -5,6 +5,7 @@ import androidx.compose.animation.*
|
||||
import androidx.compose.animation.core.tween
|
||||
import androidx.compose.runtime.*
|
||||
import com.rosetta.messenger.data.DecryptedAccount
|
||||
import com.rosetta.messenger.data.AccountManager
|
||||
|
||||
enum class AuthScreen {
|
||||
SELECT_ACCOUNT,
|
||||
@@ -21,6 +22,7 @@ fun AuthFlow(
|
||||
isDarkTheme: Boolean,
|
||||
hasExistingAccount: Boolean,
|
||||
accounts: List<AccountInfo> = emptyList(),
|
||||
accountManager: AccountManager,
|
||||
onAuthComplete: (DecryptedAccount?) -> Unit,
|
||||
onLogout: () -> Unit = {}
|
||||
) {
|
||||
@@ -33,7 +35,12 @@ fun AuthFlow(
|
||||
)
|
||||
}
|
||||
var seedPhrase by remember { mutableStateOf<List<String>>(emptyList()) }
|
||||
var selectedAccountId by remember { mutableStateOf<String?>(accounts.firstOrNull()?.id) }
|
||||
// Use last logged account or fallback to first account
|
||||
var selectedAccountId by remember {
|
||||
mutableStateOf<String?>(
|
||||
accountManager.getLastLoggedPublicKey() ?: accounts.firstOrNull()?.id
|
||||
)
|
||||
}
|
||||
var showCreateModal by remember { mutableStateOf(false) }
|
||||
|
||||
// Handle system back button
|
||||
|
||||
Reference in New Issue
Block a user