diff --git a/manager/app/src/main/java/com/sukisu/ultra/ui/screen/Module.kt b/manager/app/src/main/java/com/sukisu/ultra/ui/screen/Module.kt index 92159edd..34abcfb4 100644 --- a/manager/app/src/main/java/com/sukisu/ultra/ui/screen/Module.kt +++ b/manager/app/src/main/java/com/sukisu/ultra/ui/screen/Module.kt @@ -72,6 +72,8 @@ import com.sukisu.ultra.ui.theme.CardConfig.cardElevation import com.sukisu.ultra.ui.webui.WebUIXActivity import com.dergoogler.mmrl.platform.Platform import androidx.core.net.toUri +import com.dergoogler.mmrl.platform.model.ModuleConfig +import com.dergoogler.mmrl.platform.model.ModuleConfig.Companion.asModuleConfig @OptIn(ExperimentalMaterial3Api::class) @@ -372,17 +374,34 @@ fun ModuleScreen(navigator: DestinationsNavigator) { }, onClickModule = { id, name, hasWebUi -> if (hasWebUi) { + val wxEngine = Intent(context, WebUIXActivity::class.java) + .setData("kernelsu://webuix/$id".toUri()) + .putExtra("id", id) + .putExtra("name", name) + + val ksuEngine = Intent(context, WebUIActivity::class.java) + .setData("kernelsu://webui/$id".toUri()) + .putExtra("id", id) + .putExtra("name", name) + + val config = id.asModuleConfig + val engine = config.getWebuiEngine(context) + if (engine != null) { + webUILauncher.launch( + when (config.getWebuiEngine(context)) { + "wx" -> wxEngine + "ksu" -> ksuEngine + else -> wxEngine + } + ) + return@ModuleList + } + webUILauncher.launch( - if (prefs.getBoolean("use_webuix", false) && Platform.isAlive) { - Intent(context, WebUIXActivity::class.java) - .setData("kernelsu://webuix/$id".toUri()) - .putExtra("id", id) - .putExtra("name", name) + if (prefs.getBoolean("use_webuix", true) && Platform.isAlive) { + wxEngine } else { - Intent(context, WebUIActivity::class.java) - .setData("kernelsu://webui/$id".toUri()) - .putExtra("id", id) - .putExtra("name", name) + ksuEngine } ) } @@ -898,7 +917,8 @@ fun ModuleItemPreview() { updateJson = "", hasWebUi = false, hasActionScript = false, - dirId = "dirId" + dirId = "dirId", + config = ModuleConfig() ) ModuleItem(EmptyDestinationsNavigator, module, "", {}, {}, {}, {}) } \ No newline at end of file diff --git a/manager/app/src/main/java/com/sukisu/ultra/ui/screen/SuperUser.kt b/manager/app/src/main/java/com/sukisu/ultra/ui/screen/SuperUser.kt index 90dc975c..455f1ee3 100644 --- a/manager/app/src/main/java/com/sukisu/ultra/ui/screen/SuperUser.kt +++ b/manager/app/src/main/java/com/sukisu/ultra/ui/screen/SuperUser.kt @@ -47,6 +47,8 @@ import com.sukisu.ultra.ui.component.SearchAppBar import com.sukisu.ultra.ui.theme.CardConfig import com.sukisu.ultra.ui.util.ModuleModify import com.sukisu.ultra.ui.viewmodel.SuperUserViewModel +import com.dergoogler.mmrl.ui.component.LabelItem +import com.dergoogler.mmrl.ui.component.LabelItemDefaults @OptIn(ExperimentalMaterialApi::class, ExperimentalMaterial3Api::class) @Destination @@ -766,13 +768,21 @@ private fun AppItem( horizontalArrangement = Arrangement.spacedBy(4.dp) ) { if (app.allowSu) { - LabelText(label = "ROOT", backgroundColor = MaterialTheme.colorScheme.primary) + LabelItem(text = "ROOT",) } if (Natives.uidShouldUmount(app.uid)) { - LabelText(label = "UMOUNT", backgroundColor = MaterialTheme.colorScheme.tertiary) + LabelItem(text = "UNMOUNT", style = LabelItemDefaults.style.copy( + containerColor = MaterialTheme.colorScheme.secondaryContainer, + contentColor = MaterialTheme.colorScheme.onSecondaryContainer + ) + ) } if (app.hasCustomProfile) { - LabelText(label = "CUSTOM", backgroundColor = MaterialTheme.colorScheme.secondary) + LabelItem(text = "CUSTOM", style = LabelItemDefaults.style.copy( + containerColor = MaterialTheme.colorScheme.onTertiary, + contentColor = MaterialTheme.colorScheme.onTertiaryContainer, + ) + ) } } } diff --git a/manager/app/src/main/java/com/sukisu/ultra/ui/viewmodel/ModuleViewModel.kt b/manager/app/src/main/java/com/sukisu/ultra/ui/viewmodel/ModuleViewModel.kt index 3a75455c..d8df6d50 100644 --- a/manager/app/src/main/java/com/sukisu/ultra/ui/viewmodel/ModuleViewModel.kt +++ b/manager/app/src/main/java/com/sukisu/ultra/ui/viewmodel/ModuleViewModel.kt @@ -17,6 +17,8 @@ import org.json.JSONObject import java.text.Collator import java.util.Locale import java.util.concurrent.TimeUnit +import com.dergoogler.mmrl.platform.model.ModuleConfig +import com.dergoogler.mmrl.platform.model.ModuleConfig.Companion.asModuleConfig class ModuleViewModel : ViewModel() { @@ -40,6 +42,7 @@ class ModuleViewModel : ViewModel() { val hasWebUi: Boolean, val hasActionScript: Boolean, val dirId: String, // real module id (dir name) + val config: ModuleConfig, ) var isRefreshing by mutableStateOf(false) @@ -87,13 +90,15 @@ class ModuleViewModel : ViewModel() { .asSequence() .map { array.getJSONObject(it) } .map { obj -> + val id = obj.getString("id") + val config = id.asModuleConfig ModuleInfo( - obj.getString("id"), - obj.optString("name"), + id, + config.name ?: obj.optString("name"), obj.optString("author", "Unknown"), obj.optString("version", "Unknown"), obj.optInt("versionCode", 0), - obj.optString("description"), + config.description ?: obj.optString("description"), obj.getBoolean("enabled"), obj.getBoolean("update"), obj.getBoolean("remove"), @@ -101,6 +106,7 @@ class ModuleViewModel : ViewModel() { obj.optBoolean("web"), obj.optBoolean("action"), obj.getString("dir_id"), + config ) }.toList() isNeedRefresh = false diff --git a/manager/app/src/main/res/values/strings.xml b/manager/app/src/main/res/values/strings.xml index a32f04d4..e6de5c2d 100644 --- a/manager/app/src/main/res/values/strings.xml +++ b/manager/app/src/main/res/values/strings.xml @@ -329,7 +329,7 @@ Display KPM information and Function in home and bottom bar (Need to reopen the app) Use WebUI X - Use WebUI X instead of WebUI which supports more API\'s + Use WebUI X instead of WebUI, which supports more APIs. Be aware that developers can override this feature in their module config. Inject Eruda into WebUI X Inject a debug console into WebUI X to make debugging easier. Requires web debugging to be on. diff --git a/manager/gradle/libs.versions.toml b/manager/gradle/libs.versions.toml index 9c23a5ca..e817a11a 100644 --- a/manager/gradle/libs.versions.toml +++ b/manager/gradle/libs.versions.toml @@ -21,7 +21,7 @@ compose-material = "1.8.2" compose-material3 = "1.3.2" compose-ui = "1.8.2" documentfile = "1.1.0" -mmrl = "v33633" +mmrl = "2bb00b3c2b" [plugins] agp-app = { id = "com.android.application", version.ref = "agp" }