Skip to content

Commit 024ec0c

Browse files
authored
fix(deep-link): ChromeOS deep link calls filtered and ignored by plugin (fix #3207) (#3214)
1 parent 35aad24 commit 024ec0c

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

.changes/change-pr-3214.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"deep-link": patch
3+
"deep-link-js": patch
4+
---
5+
6+
Account for differing Android VIEW intent in ChromeOS, fixing deep-link behaviour on Chromium platforms.

plugins/deep-link/android/src/main/java/DeepLinkPlugin.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,14 @@ class DeepLinkPlugin(private val activity: Activity): Plugin(activity) {
4444
private var currentUrl: String? = null
4545
private var channel: Channel? = null
4646
private var config: PluginConfig? = null
47-
4847
companion object {
4948
var instance: DeepLinkPlugin? = null
5049
}
5150

51+
private fun isViewIntent(action: String?): Boolean {
52+
return action == Intent.ACTION_VIEW || action == "org.chromium.arc.intent.action.VIEW"
53+
}
54+
5255
@Command
5356
fun getCurrent(invoke: Invoke) {
5457
val ret = JSObject()
@@ -74,7 +77,7 @@ class DeepLinkPlugin(private val activity: Activity): Plugin(activity) {
7477

7578
val intent = activity.intent
7679

77-
if (intent.action == Intent.ACTION_VIEW && intent.data != null) {
80+
if (isViewIntent(intent.action) && intent.data != null) {
7881
val url = intent.data.toString()
7982
if (isDeepLink(url)) {
8083
// TODO: check if it makes sense to split up init url and last url
@@ -87,7 +90,7 @@ class DeepLinkPlugin(private val activity: Activity): Plugin(activity) {
8790
}
8891

8992
override fun onNewIntent(intent: Intent) {
90-
if (intent.action == Intent.ACTION_VIEW && intent.data != null) {
93+
if (isViewIntent(intent.action) && intent.data != null) {
9194
val url = intent.data.toString()
9295
if (isDeepLink(url)) {
9396
this.currentUrl = url

plugins/deep-link/build.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ fn intent_filter(domain: &AssociatedDomain) -> String {
2525
format!(
2626
r#"<intent-filter {auto_verify}>
2727
<action android:name="android.intent.action.VIEW" />
28+
<!-- ChromeOS ARC++ uses a different action for deep links -->
29+
<action android:name="org.chromium.arc.intent.action.VIEW" />
2830
<category android:name="android.intent.category.DEFAULT" />
2931
<category android:name="android.intent.category.BROWSABLE" />
3032
{schemes}

0 commit comments

Comments
 (0)