use module dir name as real id

This commit is contained in:
5ec1cff
2025-01-26 23:54:32 +08:00
parent 35bf2f1dca
commit 7b39c295aa
2 changed files with 9 additions and 6 deletions

View File

@@ -411,7 +411,7 @@ private fun ModuleList(
val success = loadingDialog.withLoading {
withContext(Dispatchers.IO) {
uninstallModule(module.id)
uninstallModule(module.dirId)
}
}
@@ -491,7 +491,7 @@ private fun ModuleList(
scope.launch {
val success = loadingDialog.withLoading {
withContext(Dispatchers.IO) {
toggleModule(module.id, !module.enabled)
toggleModule(module.dirId, !module.enabled)
}
}
if (success) {
@@ -522,7 +522,7 @@ private fun ModuleList(
}
},
onClick = {
onClickModule(it.id, it.name, it.hasWebUi)
onClickModule(it.dirId, it.name, it.hasWebUi)
}
)
@@ -654,7 +654,7 @@ fun ModuleItem(
modifier = Modifier.defaultMinSize(52.dp, 32.dp),
enabled = !module.remove && module.enabled,
onClick = {
navigator.navigate(ExecuteModuleActionScreenDestination(module.id))
navigator.navigate(ExecuteModuleActionScreenDestination(module.dirId))
viewModel.markNeedRefresh()
},
contentPadding = ButtonDefaults.TextButtonContentPadding
@@ -769,7 +769,8 @@ fun ModuleItemPreview() {
remove = false,
updateJson = "",
hasWebUi = false,
hasActionScript = false
hasActionScript = false,
dirId = "dirId"
)
ModuleItem(EmptyDestinationsNavigator, module, "", {}, {}, {}, {})
}

View File

@@ -38,6 +38,7 @@ class ModuleViewModel : ViewModel() {
val updateJson: String,
val hasWebUi: Boolean,
val hasActionScript: Boolean,
val dirId: String, // real module id (dir name)
)
data class ModuleUpdateInfo(
@@ -104,7 +105,8 @@ class ModuleViewModel : ViewModel() {
obj.getBoolean("remove"),
obj.optString("updateJson"),
obj.optBoolean("web"),
obj.optBoolean("action")
obj.optBoolean("action"),
obj.getString("dir_id"),
)
}.toList()
isNeedRefresh = false