diff --git a/composeApp/src/commonMain/kotlin/moe/crx/ovrport/patch/PatchStore.kt b/composeApp/src/commonMain/kotlin/moe/crx/ovrport/patch/PatchStore.kt index 86061f8..27f63d8 100644 --- a/composeApp/src/commonMain/kotlin/moe/crx/ovrport/patch/PatchStore.kt +++ b/composeApp/src/commonMain/kotlin/moe/crx/ovrport/patch/PatchStore.kt @@ -184,15 +184,22 @@ object PatchStore { takeNodesEach({ named("application") }) { takeNodesEach({ named("activity") }) { takeNodesEach({ named("intent-filter") }) { - takeNodesEach({ named("category") }) { - when (attributeName()) { - "android.intent.category.INFO" -> null - "android.intent.category.LAUNCHER" -> null - else -> this + val hasIntent = elem("nodes").elemEach { named("category") }.map { + when (it.attributeName()) { + "com.oculus.intent.category.VR" -> true + "android.intent.category.LAUNCHER" -> true + else -> false } - } + }.reduceOrNull { l, r -> l || r } ?: false + takeNodes { - this?.put(createCategory("android.intent.category.LAUNCHER")) + if (!hasIntent) this else { + JSONArray() + .put(createAction("android.intent.action.MAIN")) + .put(createCategory("android.intent.category.LAUNCHER")) + .put(createCategory("com.oculus.intent.category.VR")) + .put(createCategory("com.yvr.intent.category.VR")) + } } } } diff --git a/composeApp/src/commonMain/kotlin/moe/crx/ovrport/utils/ManifestUtil.kt b/composeApp/src/commonMain/kotlin/moe/crx/ovrport/utils/ManifestUtil.kt index 740179b..72f02d3 100644 --- a/composeApp/src/commonMain/kotlin/moe/crx/ovrport/utils/ManifestUtil.kt +++ b/composeApp/src/commonMain/kotlin/moe/crx/ovrport/utils/ManifestUtil.kt @@ -85,4 +85,23 @@ fun createCategory(value: String): JSONObject { .put("data", value) ) ) -} \ No newline at end of file +} + +fun createAction(value: String): JSONObject { + return JSONObject() + .put("node_type", "element") + .put("name", "action") + .put( + "attributes", + JSONArray() + .put( + JSONObject() + .put("name", "name") + .put("id", 16842755) + .put("uri", "http://schemas.android.com/apk/res/android") + .put("prefix", "android") + .put("value_type", "STRING") + .put("data", value) + ) + ) +}