feat: Simplify animations across multiple screens by replacing slide transitions with fade animations for improved user experience
This commit is contained in:
@@ -66,6 +66,9 @@ class MessageRepository private constructor(private val context: Context) {
|
||||
private val _newMessageEvents = MutableSharedFlow<String>(replay = 0, extraBufferCapacity = 10)
|
||||
val newMessageEvents: SharedFlow<String> = _newMessageEvents.asSharedFlow()
|
||||
|
||||
// 🔥 Tracking для уже запрошенных user info - предотвращает бесконечные запросы
|
||||
private val requestedUserInfoKeys = mutableSetOf<String>()
|
||||
|
||||
// Текущий аккаунт
|
||||
private var currentAccount: String? = null
|
||||
private var currentPrivateKey: String? = null
|
||||
@@ -97,6 +100,11 @@ class MessageRepository private constructor(private val context: Context) {
|
||||
* Инициализация с текущим аккаунтом
|
||||
*/
|
||||
fun initialize(publicKey: String, privateKey: String) {
|
||||
// 🔥 Очищаем кэш запрошенных user info при смене аккаунта
|
||||
if (currentAccount != publicKey) {
|
||||
requestedUserInfoKeys.clear()
|
||||
}
|
||||
|
||||
currentAccount = publicKey
|
||||
currentPrivateKey = privateKey
|
||||
|
||||
@@ -582,10 +590,17 @@ class MessageRepository private constructor(private val context: Context) {
|
||||
|
||||
/**
|
||||
* Запросить информацию о пользователе с сервера
|
||||
* 🔥 Защита от бесконечных запросов - каждый ключ запрашивается только один раз
|
||||
*/
|
||||
fun requestUserInfo(publicKey: String) {
|
||||
val privateKey = currentPrivateKey ?: return
|
||||
|
||||
// 🔥 Не запрашиваем если уже запрашивали
|
||||
if (requestedUserInfoKeys.contains(publicKey)) {
|
||||
return
|
||||
}
|
||||
requestedUserInfoKeys.add(publicKey)
|
||||
|
||||
scope.launch {
|
||||
val privateKeyHash = CryptoManager.generatePrivateKeyHash(privateKey)
|
||||
val packet = PacketSearch().apply {
|
||||
|
||||
Reference in New Issue
Block a user