Files
Suwayomi-Server/AndroidCompat/src/main/java/xyz/nulldev/androidcompat/config/SystemConfigModule.kt
T
Aria Moradi 37cf80a188 code cleanup
2021-08-30 02:38:15 +04:30

23 lines
888 B
Kotlin

package xyz.nulldev.androidcompat.config
import com.typesafe.config.Config
import xyz.nulldev.ts.config.ConfigModule
import io.github.config4k.getValue
class SystemConfigModule(val config: Config) : ConfigModule(config) {
val isDebuggable: Boolean by config
val propertyPrefix = "properties."
fun getStringProperty(property: String) = config.getString("$propertyPrefix$property")!!
fun getIntProperty(property: String) = config.getInt("$propertyPrefix$property")
fun getLongProperty(property: String) = config.getLong("$propertyPrefix$property")
fun getBooleanProperty(property: String) = config.getBoolean("$propertyPrefix$property")
fun hasProperty(property: String) = config.hasPath("$propertyPrefix$property")
companion object {
fun register(config: Config)
= SystemConfigModule(config.getConfig("android.system"))
}
}