You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Update denylist config implementation
This commit is contained in:
@@ -35,14 +35,12 @@ class DBSettingsValue(
|
||||
private val default: Int
|
||||
) : ReadWriteProperty<DBConfig, Int> {
|
||||
|
||||
private var value: Int? = null
|
||||
var value: Int? = null
|
||||
|
||||
@Synchronized
|
||||
override fun getValue(thisRef: DBConfig, property: KProperty<*>): Int {
|
||||
if (value == null)
|
||||
value = runBlocking {
|
||||
thisRef.settingsDB.fetch(name, default)
|
||||
}
|
||||
value = runBlocking { thisRef.settingsDB.fetch(name, default) }
|
||||
return value as Int
|
||||
}
|
||||
|
||||
@@ -56,7 +54,7 @@ class DBSettingsValue(
|
||||
}
|
||||
}
|
||||
|
||||
class DBBoolSettings(
|
||||
open class DBBoolSettings(
|
||||
name: String,
|
||||
default: Boolean
|
||||
) : ReadWriteProperty<DBConfig, Boolean> {
|
||||
@@ -70,6 +68,17 @@ class DBBoolSettings(
|
||||
base.setValue(thisRef, property, if (value) 1 else 0)
|
||||
}
|
||||
|
||||
class DBBoolSettingsNoWrite(
|
||||
name: String,
|
||||
default: Boolean
|
||||
) : DBBoolSettings(name, default) {
|
||||
override fun setValue(thisRef: DBConfig, property: KProperty<*>, value: Boolean) {
|
||||
synchronized(base) {
|
||||
base.value = if (value) 1 else 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class DBStringsValue(
|
||||
private val name: String,
|
||||
private val default: String,
|
||||
|
||||
Reference in New Issue
Block a user