mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 19:38:52 +01:00
Add ability to check blacklist in spite of blacklist schedule
This commit is contained in:
@@ -77,7 +77,7 @@ class BlockingDialog @Inject constructor(
|
||||
}
|
||||
|
||||
private fun allBlocked(addresses: List<String>): Boolean = addresses.all { address ->
|
||||
blockingManager.getAction(address).blockingGet() is BlockingClient.Action.Block
|
||||
blockingManager.isBlacklisted(address).blockingGet() is BlockingClient.Action.Block
|
||||
}
|
||||
|
||||
private suspend fun showDialog(
|
||||
@@ -92,8 +92,9 @@ class BlockingDialog @Inject constructor(
|
||||
}
|
||||
|
||||
val manager = context.getString(when (prefs.blockingManager.get()) {
|
||||
Preferences.BLOCKING_MANAGER_SIA -> R.string.blocking_manager_sia_title
|
||||
Preferences.BLOCKING_MANAGER_CB -> R.string.blocking_manager_call_blocker_title
|
||||
Preferences.BLOCKING_MANAGER_CC -> R.string.blocking_manager_call_control_title
|
||||
Preferences.BLOCKING_MANAGER_SIA -> R.string.blocking_manager_sia_title
|
||||
else -> R.string.blocking_manager_qksms_title
|
||||
})
|
||||
|
||||
|
||||
@@ -38,8 +38,9 @@ class BlockingPresenter @Inject constructor(
|
||||
disposables += prefs.blockingManager.asObservable()
|
||||
.map { client ->
|
||||
when (client) {
|
||||
Preferences.BLOCKING_MANAGER_SIA -> R.string.blocking_manager_sia_title
|
||||
Preferences.BLOCKING_MANAGER_CB -> R.string.blocking_manager_call_blocker_title
|
||||
Preferences.BLOCKING_MANAGER_CC -> R.string.blocking_manager_call_control_title
|
||||
Preferences.BLOCKING_MANAGER_SIA -> R.string.blocking_manager_sia_title
|
||||
else -> R.string.blocking_manager_qksms_title
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -118,7 +118,7 @@ class BlockingManagerPresenter @Inject constructor(
|
||||
.switchMap { numbers -> callControl.block(numbers).andThen(Observable.just(Unit)) } // Hack
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe {
|
||||
callControl.getAction("callcontrol").blockingGet()
|
||||
callControl.shouldBlock("callcontrol").blockingGet()
|
||||
analytics.setUserProperty("Blocking Manager", "Call Control")
|
||||
prefs.blockingManager.set(Preferences.BLOCKING_MANAGER_CC)
|
||||
}
|
||||
@@ -143,6 +143,6 @@ class BlockingManagerPresenter @Inject constructor(
|
||||
|
||||
private fun getAddressesToBlock(client: BlockingClient) = conversationRepo.getBlockedConversations()
|
||||
.fold(listOf<String>(), { numbers, conversation -> numbers + conversation.recipients.map { it.address } })
|
||||
.filter { number -> client.getAction(number).blockingGet() !is BlockingClient.Action.Block }
|
||||
.filter { number -> client.isBlacklisted(number).blockingGet() !is BlockingClient.Action.Block }
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user