handle reaction message for lookIntoFuture

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2024-08-07 12:43:07 +02:00
parent 15d54f745b
commit aa76636f72
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B
3 changed files with 8 additions and 29 deletions

View file

@ -827,14 +827,12 @@ class ChatActivity :
adapter?.notifyDataSetChanged()
}
.collect()
}
this.lifecycleScope.launch {
chatViewModel.getUpdateMessageFlow
.onEach { pair ->
val lookIntoFuture = pair.first
var chatMessageList = pair.second
adapter!!.update(chatMessageList[0])
.onEach {
updateAdapterForReaction(it)
}
.collect()
}

View file

@ -30,13 +30,7 @@ interface ChatMessageRepository : LifecycleAwareManager {
>
>
val updateMessageFlow:
Flow<
Pair<
Boolean,
List<ChatMessage>
>
>
val updateMessageFlow: Flow<ChatMessage>
fun setData(
conversationModel: ConversationModel,

View file

@ -66,21 +66,11 @@ class OfflineFirstChatRepository @Inject constructor(
> = MutableSharedFlow()
override val updateMessageFlow:
Flow<
Pair<
Boolean,
List<ChatMessage>
>
>
Flow<ChatMessage>
get() = _updateMessageFlow
private val _updateMessageFlow:
MutableSharedFlow<
Pair<
Boolean,
List<ChatMessage>
>
> = MutableSharedFlow()
MutableSharedFlow<ChatMessage> = MutableSharedFlow()
private var newXChatLastCommonRead: Int? = null
private var itIsPaused = false
@ -480,10 +470,7 @@ class OfflineFirstChatRepository @Inject constructor(
messageJson.parentMessage?.let { parentMessageJson ->
val parentMessageEntity = parentMessageJson.asEntity(currentUser.id!!)
chatDao.upsertChatMessage(parentMessageEntity)
// TODO: inform UI to update this message!!
val pair = Pair(true, listOf(parentMessageEntity.asModel()))
_updateMessageFlow.emit(pair)
_updateMessageFlow.emit(parentMessageEntity.asModel())
}
}