mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 03:28:52 +01:00
Create conversation when message is received from new sender
This commit is contained in:
@@ -34,7 +34,7 @@ class ReceiveMessage @Inject constructor(
|
||||
override fun buildObservable(params: Params): Flowable<Unit> {
|
||||
return Flowable.just(params)
|
||||
.map { messageRepo.insertReceivedSms(params.address, params.body, params.sentTime) } // Add the message to the db
|
||||
.mapNotNull { message -> messageRepo.getConversation(message.threadId) } // Map message to conversation
|
||||
.mapNotNull { message -> messageRepo.getOrCreateConversation(message.threadId) } // Map message to conversation
|
||||
.doOnNext { conversation -> if (conversation.archived) messageRepo.markUnarchived(conversation.id) } // Unarchive conversation if necessary
|
||||
.doOnNext { conversation -> notificationManager.update(conversation.id) } // Update the notification
|
||||
.map { }
|
||||
|
||||
Reference in New Issue
Block a user