mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 12:07:38 +00:00
Fixed modules screen not offering reboot when local modules change
This commit is contained in:
parent
ea855837df
commit
6e14a727b1
@ -18,12 +18,13 @@ class Module(path: String) : BaseModule() {
|
||||
private val updateFile = SuFile(path, "update")
|
||||
private val ruleFile = SuFile(path, "sepolicy.rule")
|
||||
|
||||
val updated: Boolean = updateFile.exists()
|
||||
val updated: Boolean get() = updateFile.exists()
|
||||
|
||||
var enable: Boolean = !disableFile.exists()
|
||||
var enable: Boolean
|
||||
get() = !disableFile.exists()
|
||||
set(enable) {
|
||||
val dir = "$PERSIST/$id"
|
||||
field = if (enable) {
|
||||
if (enable) {
|
||||
Shell.su("mkdir -p $dir", "cp -af $ruleFile $dir").submit()
|
||||
disableFile.delete()
|
||||
} else {
|
||||
@ -32,9 +33,10 @@ class Module(path: String) : BaseModule() {
|
||||
}
|
||||
}
|
||||
|
||||
var remove: Boolean = removeFile.exists()
|
||||
var remove: Boolean
|
||||
get() = removeFile.exists()
|
||||
set(remove) {
|
||||
field = if (remove) {
|
||||
if (remove) {
|
||||
Shell.su("rm -rf $PERSIST/$id").submit()
|
||||
removeFile.createNewFile()
|
||||
} else {
|
||||
|
@ -110,22 +110,23 @@ class ModuleItem(val item: Module) : ObservableItem<ModuleItem>(), Observable {
|
||||
}
|
||||
|
||||
@get:Bindable
|
||||
var isEnabled = item.enable
|
||||
var isEnabled
|
||||
get() = item.enable
|
||||
set(value) {
|
||||
field = value
|
||||
item.enable = value
|
||||
notifyChange(BR.enabled)
|
||||
}
|
||||
|
||||
@get:Bindable
|
||||
var isRemoved = item.remove
|
||||
var isRemoved
|
||||
get() = item.remove
|
||||
set(value) {
|
||||
field = value
|
||||
item.remove = value
|
||||
notifyChange(BR.removed)
|
||||
}
|
||||
|
||||
val isUpdated get() = item.updated
|
||||
val isModified get() = isRemoved || item.updated
|
||||
val isModified get() = isRemoved || isUpdated
|
||||
|
||||
fun toggle() {
|
||||
isEnabled = !isEnabled
|
||||
|
@ -193,6 +193,7 @@ class ModuleViewModel(
|
||||
.doOnSuccess {
|
||||
addInstalledEmptyMessage()
|
||||
addUpdatableEmptyMessage()
|
||||
updateActiveState()
|
||||
}
|
||||
.ignoreElement()!!
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user