feat: Improve screen transition animations and simplify account handling in MainActivity
This commit is contained in:
@@ -170,15 +170,13 @@ class MainActivity : ComponentActivity() {
|
||||
targetState = when {
|
||||
showSplash -> "splash"
|
||||
showOnboarding && hasExistingAccount == false -> "onboarding"
|
||||
// 🔥 КРИТИЧНО: если currentAccount != null - сразу на main без ожидания isLoggedIn
|
||||
currentAccount != null -> "main"
|
||||
isLoggedIn != true && hasExistingAccount == false -> "auth_new"
|
||||
isLoggedIn != true && hasExistingAccount == true -> "auth_unlock"
|
||||
else -> "main"
|
||||
},
|
||||
transitionSpec = {
|
||||
fadeIn(animationSpec = tween(300)) togetherWith
|
||||
fadeOut(animationSpec = tween(200))
|
||||
fadeIn(animationSpec = tween(600)) togetherWith
|
||||
fadeOut(animationSpec = tween(600))
|
||||
},
|
||||
label = "screenTransition"
|
||||
) { screen ->
|
||||
@@ -212,13 +210,7 @@ class MainActivity : ComponentActivity() {
|
||||
currentAccount = account
|
||||
hasExistingAccount = true
|
||||
// Save as last logged account
|
||||
account?.let {
|
||||
accountManager.setLastLoggedPublicKey(it.publicKey)
|
||||
// 🔥 КРИТИЧНО: Сразу устанавливаем флаг логина чтобы не было Loading экрана
|
||||
scope.launch {
|
||||
accountManager.setCurrentAccount(it.publicKey)
|
||||
}
|
||||
}
|
||||
account?.let { accountManager.setLastLoggedPublicKey(it.publicKey) }
|
||||
|
||||
// 📤 Отправляем FCM токен на сервер после успешной аутентификации
|
||||
account?.let { sendFcmTokenToServer(it) }
|
||||
@@ -362,22 +354,13 @@ fun MainScreen(
|
||||
onToggleTheme: () -> Unit = {},
|
||||
onLogout: () -> Unit = {}
|
||||
) {
|
||||
// 🔥 Используем моковый аккаунт если account == null (для предотвращения крашей)
|
||||
val effectiveAccount = account ?: DecryptedAccount(
|
||||
publicKey = "loading",
|
||||
privateKey = "loading",
|
||||
seedPhrase = emptyList(),
|
||||
privateKeyHash = "loading",
|
||||
name = "Loading..."
|
||||
)
|
||||
|
||||
val accountName = effectiveAccount.name
|
||||
val accountPhone = effectiveAccount.publicKey.take(16).let {
|
||||
val accountName = account?.name ?: "Account"
|
||||
val accountPhone = account?.publicKey?.take(16)?.let {
|
||||
"+${it.take(1)} ${it.substring(1, 4)} ${it.substring(4, 7)}${it.substring(7)}"
|
||||
}
|
||||
val accountPublicKey = effectiveAccount.publicKey
|
||||
val accountPrivateKey = effectiveAccount.privateKey
|
||||
val privateKeyHash = effectiveAccount.privateKeyHash
|
||||
} ?: "+7 775 9932587"
|
||||
val accountPublicKey = account?.publicKey ?: "04c266b98ae5"
|
||||
val accountPrivateKey = account?.privateKey ?: ""
|
||||
val privateKeyHash = account?.privateKeyHash ?: ""
|
||||
|
||||
// Состояние протокола для передачи в SearchScreen
|
||||
val protocolState by ProtocolManager.state.collectAsState()
|
||||
|
||||
Reference in New Issue
Block a user