mirror of
https://github.com/CherretGit/zaprett-app.git
synced 2025-12-10 05:29:37 +05:00
change commands in ZaprettManager
This commit is contained in:
@@ -16,6 +16,7 @@ private val json = Json {
|
|||||||
prettyPrint = true
|
prettyPrint = true
|
||||||
ignoreUnknownKeys = true
|
ignoreUnknownKeys = true
|
||||||
coerceInputValues = true
|
coerceInputValues = true
|
||||||
|
encodeDefaults = true
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun readConfig(): ZaprettConfig {
|
private fun readConfig(): ZaprettConfig {
|
||||||
@@ -78,13 +79,13 @@ fun restartService(callback: (Boolean) -> Unit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getModuleVersion(callback: (String) -> Unit) {
|
fun getModuleVersion(callback: (String) -> Unit) {
|
||||||
Shell.cmd("zaprett module-ver").submit { result ->
|
Shell.cmd("zaprett module-version").submit { result ->
|
||||||
if (result.out.isNotEmpty()) callback(result.out.first()) else "undefined"
|
if (result.out.isNotEmpty()) callback(result.out.first()) else "undefined"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getBinVersion(callback: (String) -> Unit) {
|
fun getBinVersion(callback: (String) -> Unit) {
|
||||||
Shell.cmd("zaprett bin-ver").submit { result ->
|
Shell.cmd("zaprett binary-version").submit { result ->
|
||||||
if (result.out.isNotEmpty()) callback(result.out.first()) else "undefined"
|
if (result.out.isNotEmpty()) callback(result.out.first()) else "undefined"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -95,7 +96,7 @@ fun getConfigFile(): File {
|
|||||||
|
|
||||||
fun setStartOnBoot(prefs: SharedPreferences, callback: (Boolean) -> Unit) {
|
fun setStartOnBoot(prefs: SharedPreferences, callback: (Boolean) -> Unit) {
|
||||||
if (prefs.getBoolean("use_module", false)) {
|
if (prefs.getBoolean("use_module", false)) {
|
||||||
Shell.cmd("zaprett autostart").submit { result ->
|
Shell.cmd("zaprett set-autostart").submit { result ->
|
||||||
if (result.out.isNotEmpty() && result.out.toString().contains("true")) callback(true) else callback(false)
|
if (result.out.isNotEmpty() && result.out.toString().contains("true")) callback(true) else callback(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user