Migrate blocked conversations to qk blocking manager

This commit is contained in:
moezbhatti
2019-09-08 20:51:12 -04:00
parent 3aba92825b
commit 4c9130e11a
8 changed files with 77 additions and 22 deletions
@@ -31,7 +31,7 @@ class QksmsBlockingClient @Inject constructor(
override fun getClientCapability() = BlockingClient.Capability.BLOCK_WITHOUT_PERMISSION
override fun getAction(address: String): Single<BlockingClient.Action> = Single.fromCallable {
override fun getAction(address: String): Single<BlockingClient.Action> = Single.fromCallable {
when (blockingRepo.isBlocked(address)) {
true -> BlockingClient.Action.BLOCK
false -> BlockingClient.Action.UNBLOCK
@@ -29,7 +29,6 @@ import android.os.Message
import android.os.Messenger
import androidx.core.os.bundleOf
import com.moez.QKSMS.common.util.extensions.isInstalled
import com.moez.QKSMS.util.Preferences
import com.moez.QKSMS.util.tryOrNull
import io.reactivex.Completable
import io.reactivex.Single
@@ -37,7 +36,6 @@ import io.reactivex.subjects.SingleSubject
import javax.inject.Inject
class ShouldIAnswerBlockingClient @Inject constructor(
prefs: Preferences,
private val context: Context
) : BlockingClient {
@@ -50,14 +48,6 @@ class ShouldIAnswerBlockingClient @Inject constructor(
const val GET_NUMBER_RATING = 1
}
init {
// Migrate from old SIA preference to blocking manager preference
if (prefs.sia.get()) {
prefs.blockingManager.set(Preferences.BLOCKING_MANAGER_SIA)
prefs.sia.delete()
}
}
override fun isAvailable(): Boolean = listOf("org.mistergroup.shouldianswer",
"org.mistergroup.shouldianswerpersonal",
"org.mistergroup.muzutozvednout")