feat: Implement FCM token handling and dialog cache management; enhance user experience and performance
This commit is contained in:
@@ -551,6 +551,23 @@ class MessageRepository private constructor(private val context: Context) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Очистить кэш сообщений для конкретного диалога
|
||||
* 🔥 ВАЖНО: Устанавливаем пустой список, а не просто удаляем -
|
||||
* чтобы подписчики Flow увидели что диалог пуст
|
||||
*/
|
||||
fun clearDialogCache(opponentKey: String) {
|
||||
val dialogKey = getDialogKey(opponentKey)
|
||||
android.util.Log.d("MessageRepo", "🗑️ clearDialogCache: dialogKey=$dialogKey")
|
||||
|
||||
// Сначала устанавливаем пустой список чтобы все подписчики увидели
|
||||
messageCache[dialogKey]?.value = emptyList()
|
||||
|
||||
// Затем удаляем из кэша
|
||||
messageCache.remove(dialogKey)
|
||||
android.util.Log.d("MessageRepo", "🗑️ Cache cleared for dialogKey=$dialogKey")
|
||||
}
|
||||
|
||||
/**
|
||||
* Запросить информацию о пользователе с сервера
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user