mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-04-21 11:26:15 +02:00
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"deep-link": patch
|
||||
"deep-link-js": patch
|
||||
---
|
||||
|
||||
Account for differing Android VIEW intent in ChromeOS, fixing deep-link behaviour on Chromium platforms.
|
||||
@@ -44,11 +44,14 @@ class DeepLinkPlugin(private val activity: Activity): Plugin(activity) {
|
||||
private var currentUrl: String? = null
|
||||
private var channel: Channel? = null
|
||||
private var config: PluginConfig? = null
|
||||
|
||||
companion object {
|
||||
var instance: DeepLinkPlugin? = null
|
||||
}
|
||||
|
||||
private fun isViewIntent(action: String?): Boolean {
|
||||
return action == Intent.ACTION_VIEW || action == "org.chromium.arc.intent.action.VIEW"
|
||||
}
|
||||
|
||||
@Command
|
||||
fun getCurrent(invoke: Invoke) {
|
||||
val ret = JSObject()
|
||||
@@ -74,7 +77,7 @@ class DeepLinkPlugin(private val activity: Activity): Plugin(activity) {
|
||||
|
||||
val intent = activity.intent
|
||||
|
||||
if (intent.action == Intent.ACTION_VIEW && intent.data != null) {
|
||||
if (isViewIntent(intent.action) && intent.data != null) {
|
||||
val url = intent.data.toString()
|
||||
if (isDeepLink(url)) {
|
||||
// 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) {
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
if (intent.action == Intent.ACTION_VIEW && intent.data != null) {
|
||||
if (isViewIntent(intent.action) && intent.data != null) {
|
||||
val url = intent.data.toString()
|
||||
if (isDeepLink(url)) {
|
||||
this.currentUrl = url
|
||||
|
||||
@@ -25,6 +25,8 @@ fn intent_filter(domain: &AssociatedDomain) -> String {
|
||||
format!(
|
||||
r#"<intent-filter {auto_verify}>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<!-- ChromeOS ARC++ uses a different action for deep links -->
|
||||
<action android:name="org.chromium.arc.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
{schemes}
|
||||
|
||||
Reference in New Issue
Block a user