forked from upstream-mirrors/quik
Integrate Should I Answer? blocking support (#977)
* Pulled over SIA code from 2.7.3 * Eliminate unnecessary service, fix service binding * Flatten logic in isBlocked * Return single which emits shouldBlock state * Mark conversation as blocked during sync
This commit is contained in:
@@ -38,6 +38,7 @@ import io.reactivex.schedulers.Schedulers
|
||||
import io.realm.Realm
|
||||
import io.realm.RealmResults
|
||||
import io.realm.Sort
|
||||
import manager.ExternalBlockingManager
|
||||
import manager.KeyManager
|
||||
import mapper.CursorToConversation
|
||||
import mapper.CursorToRecipient
|
||||
@@ -61,6 +62,7 @@ class MessageRepositoryImpl @Inject constructor(
|
||||
private val messageIds: KeyManager,
|
||||
private val cursorToConversation: CursorToConversation,
|
||||
private val cursorToRecipient: CursorToRecipient,
|
||||
private val externalBlockingManager: ExternalBlockingManager,
|
||||
private val prefs: Preferences) : MessageRepository {
|
||||
|
||||
override fun getConversations(archived: Boolean): Flowable<List<Conversation>> {
|
||||
@@ -624,6 +626,11 @@ class MessageRepositoryImpl @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
// If any of the addresses here should be blocked, then block the conversation
|
||||
conversation.blocked = recipients.map { it.address }.any { address ->
|
||||
externalBlockingManager.shouldBlock(address).blockingGet()
|
||||
}
|
||||
|
||||
conversation.recipients.clear()
|
||||
conversation.recipients.addAll(recipients)
|
||||
conversation.insertOrUpdate()
|
||||
|
||||
Reference in New Issue
Block a user