mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-16 02:58:52 +01:00
Conversation as field in Message
This commit is contained in:
@@ -36,7 +36,7 @@ class ReceiveMms @Inject constructor(
|
||||
override fun buildObservable(params: Uri): Flowable<*> {
|
||||
return Flowable.just(params)
|
||||
.flatMap { uri -> syncManager.syncMessage(uri) } // Sync the message
|
||||
.mapNotNull { message -> messageRepo.getOrCreateConversation(message.threadId) } // Map message to conversation
|
||||
.mapNotNull { message -> message.conversation } // Map message to conversation
|
||||
.filter { conversation -> !conversation.blocked } // Don't notify for blocked conversations
|
||||
.doOnNext { conversation -> if (conversation.archived) messageRepo.markUnarchived(conversation.id) } // Unarchive conversation if necessary
|
||||
.doOnNext { conversation -> notificationManager.update(conversation.id) } // Update the notification
|
||||
|
||||
@@ -43,7 +43,7 @@ class ReceiveSms @Inject constructor(
|
||||
|
||||
messageRepo.insertReceivedSms(address, body, time) // Add the message to the db
|
||||
}
|
||||
.mapNotNull { message -> messageRepo.getOrCreateConversation(message.threadId) } // Map message to conversation
|
||||
.mapNotNull { message -> message.conversation } // Map message to conversation
|
||||
.filter { conversation -> !conversation.blocked } // Don't notify for blocked conversations
|
||||
.doOnNext { conversation -> if (conversation.archived) messageRepo.markUnarchived(conversation.id) } // Unarchive conversation if necessary
|
||||
.doOnNext { conversation -> notificationManager.update(conversation.id) } // Update the notification
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package interactor
|
||||
|
||||
import io.reactivex.Flowable
|
||||
import model.Conversation
|
||||
import model.Message
|
||||
import repository.MessageRepository
|
||||
import javax.inject.Inject
|
||||
@@ -32,7 +33,7 @@ class RetrySending @Inject constructor(private val messageRepo: MessageRepositor
|
||||
val message = Message().apply {
|
||||
id = params.id
|
||||
type = params.type
|
||||
threadId = params.threadId
|
||||
conversation = params.conversation?.id?.let { threadId -> Conversation().apply { id = threadId } }
|
||||
address = params.address
|
||||
body = params.body
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user