Migrate old SIA preference

This commit is contained in:
moezbhatti
2019-06-29 01:58:14 -04:00
parent 9d920cddb9
commit 592bd3d447
2 changed files with 10 additions and 0 deletions
@@ -24,6 +24,14 @@ class BlockingManager @Inject constructor(
else -> qkBlockingClient
}
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 isBlocked(address: String): Single<Boolean> = client.isBlocked(address)
override fun canBlock(): Boolean = client.canBlock()
@@ -80,6 +80,8 @@ class Preferences @Inject constructor(private val rxPrefs: RxSharedPreferences)
val black = rxPrefs.getBoolean("black", false)
val systemFont = rxPrefs.getBoolean("systemFont", false)
val textSize = rxPrefs.getInteger("textSize", TEXT_SIZE_NORMAL)
@Deprecated("This should only be accessed when migrating to @blockingManager")
val sia = rxPrefs.getBoolean("sia", false)
val blockingManager = rxPrefs.getInteger("blockingManager", BLOCKING_MANAGER_QKSMS)
val drop = rxPrefs.getBoolean("drop", false)
val notifAction1 = rxPrefs.getInteger("notifAction1", NOTIFICATION_ACTION_READ)