feat: enhance profile fetching and update mechanisms in ProtocolManager and MainScreen
This commit is contained in:
@@ -514,6 +514,18 @@ fun MainScreen(
|
||||
|
||||
// Состояние протокола для передачи в SearchScreen
|
||||
val protocolState by ProtocolManager.state.collectAsState()
|
||||
|
||||
// Перечитать username/name после получения own profile с сервера
|
||||
// Аналог Desktop: useUserInformation автоматически обновляет UI при PacketSearch ответе
|
||||
LaunchedEffect(protocolState) {
|
||||
if (protocolState == ProtocolState.AUTHENTICATED && accountPublicKey.isNotBlank() && accountPublicKey != "04c266b98ae5") {
|
||||
delay(2000) // Ждём fetchOwnProfile() → PacketSearch → AccountManager update
|
||||
val accountManager = AccountManager(context)
|
||||
val encryptedAccount = accountManager.getAccount(accountPublicKey)
|
||||
accountUsername = encryptedAccount?.username ?: ""
|
||||
accountName = encryptedAccount?.name ?: accountName
|
||||
}
|
||||
}
|
||||
|
||||
// Навигация между экранами
|
||||
var selectedUser by remember { mutableStateOf<SearchUser?>(null) }
|
||||
|
||||
Reference in New Issue
Block a user