feat: implement device verification flow with new UI components and protocol handling
This commit is contained in:
@@ -37,6 +37,7 @@ import com.rosetta.messenger.network.SearchUser
|
||||
import com.rosetta.messenger.repository.AvatarRepository
|
||||
import com.rosetta.messenger.ui.auth.AccountInfo
|
||||
import com.rosetta.messenger.ui.auth.AuthFlow
|
||||
import com.rosetta.messenger.ui.auth.DeviceConfirmScreen
|
||||
import com.rosetta.messenger.ui.chats.ChatDetailScreen
|
||||
import com.rosetta.messenger.ui.chats.ChatsListScreen
|
||||
import com.rosetta.messenger.ui.chats.RequestsListScreen
|
||||
@@ -144,6 +145,7 @@ class MainActivity : FragmentActivity() {
|
||||
else -> true
|
||||
}
|
||||
val isLoggedIn by accountManager.isLoggedIn.collectAsState(initial = null)
|
||||
val protocolState by ProtocolManager.state.collectAsState()
|
||||
var showSplash by remember { mutableStateOf(true) }
|
||||
var showOnboarding by remember { mutableStateOf(true) }
|
||||
var hasExistingAccount by remember { mutableStateOf<Boolean?>(null) }
|
||||
@@ -210,6 +212,9 @@ class MainActivity : FragmentActivity() {
|
||||
"auth_new"
|
||||
isLoggedIn != true && hasExistingAccount == true ->
|
||||
"auth_unlock"
|
||||
protocolState ==
|
||||
ProtocolState.DEVICE_VERIFICATION_REQUIRED ->
|
||||
"device_confirm"
|
||||
else -> "main"
|
||||
},
|
||||
transitionSpec = {
|
||||
@@ -430,6 +435,18 @@ class MainActivity : FragmentActivity() {
|
||||
}
|
||||
)
|
||||
}
|
||||
"device_confirm" -> {
|
||||
DeviceConfirmScreen(
|
||||
isDarkTheme = isDarkTheme,
|
||||
onExit = {
|
||||
currentAccount = null
|
||||
scope.launch {
|
||||
ProtocolManager.disconnect()
|
||||
accountManager.logout()
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -690,7 +707,9 @@ fun MainScreen(
|
||||
// Appearance: background blur color preference
|
||||
val prefsManager = remember { com.rosetta.messenger.data.PreferencesManager(context) }
|
||||
val backgroundBlurColorId by
|
||||
prefsManager.backgroundBlurColorId.collectAsState(initial = "avatar")
|
||||
prefsManager
|
||||
.backgroundBlurColorIdForAccount(accountPublicKey)
|
||||
.collectAsState(initial = "avatar")
|
||||
val pinnedChats by prefsManager.pinnedChats.collectAsState(initial = emptySet())
|
||||
|
||||
// AvatarRepository для работы с аватарами
|
||||
@@ -920,7 +939,9 @@ fun MainScreen(
|
||||
currentBlurColorId = backgroundBlurColorId,
|
||||
onBack = { navStack = navStack.filterNot { it is Screen.Appearance } },
|
||||
onBlurColorChange = { newId ->
|
||||
mainScreenScope.launch { prefsManager.setBackgroundBlurColorId(newId) }
|
||||
mainScreenScope.launch {
|
||||
prefsManager.setBackgroundBlurColorId(accountPublicKey, newId)
|
||||
}
|
||||
},
|
||||
onToggleTheme = onToggleTheme,
|
||||
accountPublicKey = accountPublicKey,
|
||||
|
||||
Reference in New Issue
Block a user