Commit e426090a authored by Viktor De Pasquale's avatar Viktor De Pasquale

Fixed checkboxes on homescreen not writing values to static fields

parent cbe64fd5
package com.topjohnwu.magisk.ui.home package com.topjohnwu.magisk.ui.home
import android.content.res.Resources import android.content.res.Resources
import com.skoumal.teanity.extensions.addOnPropertyChangedCallback
import com.skoumal.teanity.util.KObservableField import com.skoumal.teanity.util.KObservableField
import com.topjohnwu.magisk.* import com.topjohnwu.magisk.*
import com.topjohnwu.magisk.model.events.* import com.topjohnwu.magisk.model.events.*
...@@ -24,11 +25,6 @@ class HomeViewModel( ...@@ -24,11 +25,6 @@ class HomeViewModel(
val isForceEncryption = KObservableField(Config.keepEnc) val isForceEncryption = KObservableField(Config.keepEnc)
val isKeepVerity = KObservableField(Config.keepVerity) val isKeepVerity = KObservableField(Config.keepVerity)
private val prefsObserver = Observer(isForceEncryption, isKeepVerity) {
Config.keepEnc = isForceEncryption.value
Config.keepVerity = isKeepVerity.value
}
val magiskState = KObservableField(MagiskState.LOADING) val magiskState = KObservableField(MagiskState.LOADING)
val magiskStateText = Observer(magiskState) { val magiskStateText = Observer(magiskState) {
when (magiskState.value) { when (magiskState.value) {
...@@ -90,6 +86,14 @@ class HomeViewModel( ...@@ -90,6 +86,14 @@ class HomeViewModel(
init { init {
Event.register(this) Event.register(this)
isForceEncryption.addOnPropertyChangedCallback {
Config.keepEnc = it ?: return@addOnPropertyChangedCallback
}
isKeepVerity.addOnPropertyChangedCallback {
Config.keepVerity = it ?: return@addOnPropertyChangedCallback
}
refresh() refresh()
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment