feat: implement delivery status updates and enhance file size limit for uploads
This commit is contained in:
@@ -74,7 +74,21 @@ class MessageRepository private constructor(private val context: Context) {
|
||||
onBufferOverflow = kotlinx.coroutines.channels.BufferOverflow.DROP_OLDEST
|
||||
)
|
||||
val newMessageEvents: SharedFlow<String> = _newMessageEvents.asSharedFlow()
|
||||
|
||||
|
||||
// 🔔 События обновления статуса доставки для UI
|
||||
data class DeliveryStatusUpdate(
|
||||
val dialogKey: String,
|
||||
val messageId: String,
|
||||
val status: DeliveryStatus
|
||||
)
|
||||
|
||||
private val _deliveryStatusEvents = MutableSharedFlow<DeliveryStatusUpdate>(
|
||||
replay = 0,
|
||||
extraBufferCapacity = 64,
|
||||
onBufferOverflow = kotlinx.coroutines.channels.BufferOverflow.DROP_OLDEST
|
||||
)
|
||||
val deliveryStatusEvents: SharedFlow<DeliveryStatusUpdate> = _deliveryStatusEvents.asSharedFlow()
|
||||
|
||||
// 🔥 Tracking для уже запрошенных user info - предотвращает бесконечные запросы
|
||||
private val requestedUserInfoKeys = mutableSetOf<String>()
|
||||
|
||||
@@ -511,11 +525,16 @@ class MessageRepository private constructor(private val context: Context) {
|
||||
// Обновляем кэш
|
||||
val dialogKey = getDialogKey(packet.toPublicKey)
|
||||
updateMessageStatus(dialogKey, packet.messageId, DeliveryStatus.DELIVERED)
|
||||
|
||||
|
||||
// 🔔 Уведомляем UI о смене статуса доставки
|
||||
_deliveryStatusEvents.tryEmit(
|
||||
DeliveryStatusUpdate(dialogKey, packet.messageId, DeliveryStatus.DELIVERED)
|
||||
)
|
||||
|
||||
// 🔥 КРИТИЧНО: Обновляем диалог чтобы lastMessageDelivered обновился
|
||||
dialogDao.updateDialogFromMessages(account, packet.toPublicKey)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Обработка прочтения
|
||||
* В Desktop PacketRead сообщает что собеседник прочитал наши сообщения
|
||||
@@ -544,7 +563,12 @@ class MessageRepository private constructor(private val context: Context) {
|
||||
else msg
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 🔔 Уведомляем UI о прочтении (пустой messageId = все исходящие сообщения)
|
||||
_deliveryStatusEvents.tryEmit(
|
||||
DeliveryStatusUpdate(dialogKey, "", DeliveryStatus.READ)
|
||||
)
|
||||
|
||||
// 📝 LOG: Статус прочтения
|
||||
MessageLogger.logReadStatus(
|
||||
fromPublicKey = packet.fromPublicKey,
|
||||
|
||||
Reference in New Issue
Block a user