mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 11:38:51 +01:00
Refactor ExternalBlockingManager to BlockingClient
This commit is contained in:
+2
-2
@@ -16,11 +16,11 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.moez.QKSMS.manager
|
||||
package com.moez.QKSMS.blocking
|
||||
|
||||
import io.reactivex.Single
|
||||
|
||||
interface ExternalBlockingManager {
|
||||
interface BlockingClient {
|
||||
|
||||
/**
|
||||
* Return a Single<Boolean> which emits whether or not the given [address] should be blocked
|
||||
@@ -19,9 +19,9 @@
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import android.net.Uri
|
||||
import com.moez.QKSMS.blocking.BlockingClient
|
||||
import com.moez.QKSMS.extensions.mapNotNull
|
||||
import com.moez.QKSMS.manager.ActiveConversationManager
|
||||
import com.moez.QKSMS.manager.ExternalBlockingManager
|
||||
import com.moez.QKSMS.manager.NotificationManager
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
@@ -32,7 +32,7 @@ import javax.inject.Inject
|
||||
class ReceiveMms @Inject constructor(
|
||||
private val activeConversationManager: ActiveConversationManager,
|
||||
private val conversationRepo: ConversationRepository,
|
||||
private val externalBlockingManager: ExternalBlockingManager,
|
||||
private val blockingClient: BlockingClient,
|
||||
private val syncManager: SyncRepository,
|
||||
private val messageRepo: MessageRepository,
|
||||
private val notificationManager: NotificationManager,
|
||||
@@ -54,7 +54,7 @@ class ReceiveMms @Inject constructor(
|
||||
// to check if it should be blocked after we've pulled it into realm. If it
|
||||
// turns out that it should be blocked, then delete it
|
||||
// TODO Don't store blocked messages in the first place
|
||||
!externalBlockingManager.shouldBlock(message.address).blockingGet().also { blocked ->
|
||||
!blockingClient.shouldBlock(message.address).blockingGet().also { blocked ->
|
||||
if (blocked) messageRepo.deleteMessages(message.id)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import android.telephony.SmsMessage
|
||||
import com.moez.QKSMS.blocking.BlockingClient
|
||||
import com.moez.QKSMS.extensions.mapNotNull
|
||||
import com.moez.QKSMS.manager.ExternalBlockingManager
|
||||
import com.moez.QKSMS.manager.NotificationManager
|
||||
import com.moez.QKSMS.manager.ShortcutManager
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
@@ -30,7 +30,7 @@ import javax.inject.Inject
|
||||
|
||||
class ReceiveSms @Inject constructor(
|
||||
private val conversationRepo: ConversationRepository,
|
||||
private val externalBlockingManager: ExternalBlockingManager,
|
||||
private val blockingClient: BlockingClient,
|
||||
private val messageRepo: MessageRepository,
|
||||
private val notificationManager: NotificationManager,
|
||||
private val updateBadge: UpdateBadge,
|
||||
@@ -45,7 +45,7 @@ class ReceiveSms @Inject constructor(
|
||||
.filter {
|
||||
// Don't continue if the sender is blocked
|
||||
val address = it.messages[0].displayOriginatingAddress
|
||||
!externalBlockingManager.shouldBlock(address).blockingGet()
|
||||
!blockingClient.shouldBlock(address).blockingGet()
|
||||
}
|
||||
.map {
|
||||
val messages = it.messages
|
||||
|
||||
Reference in New Issue
Block a user