feat: Simplify animations across multiple screens by replacing slide transitions with fade animations for improved user experience

This commit is contained in:
k1ngsterr1
2026-01-18 17:26:04 +05:00
parent 89e5f3cfa2
commit 61995e9286
16 changed files with 506 additions and 399 deletions

View File

@@ -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 {