From 0260464d179dcf6a49862c148704ea71968f41a2 Mon Sep 17 00:00:00 2001 From: m00nwtchr Date: Sun, 25 Feb 2024 07:46:29 +0100 Subject: [PATCH 1/6] add more domain attributes --- plugins/deep-link/build.rs | 33 +++++++++++++++++++++++++++++---- plugins/deep-link/src/config.rs | 10 ++++++++++ 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/plugins/deep-link/build.rs b/plugins/deep-link/build.rs index bffa4675a9..ce2da41849 100644 --- a/plugins/deep-link/build.rs +++ b/plugins/deep-link/build.rs @@ -9,25 +9,50 @@ use config::{AssociatedDomain, Config}; const COMMANDS: &[&str] = &["get_current"]; // TODO: Consider using activity-alias in case users may have multiple activities in their app. -// TODO: Do we want to support the other path* configs too? fn intent_filter(domain: &AssociatedDomain) -> String { format!( r#" - - + {} {} + {} + {} + {} "#, + domain + .scheme + .iter() + .map(|scheme| format!(r#""#)) + .collect::>() + .join("\n "), domain.host, + domain + .path + .iter() + .map(|path| format!(r#""#)) + .collect::>() + .join("\n "), + domain + .path_pattern + .iter() + .map(|pattern| format!(r#""#)) + .collect::>() + .join("\n "), domain .path_prefix .iter() .map(|prefix| format!(r#""#)) .collect::>() - .join("\n ") + .join("\n "), + domain + .path_suffix + .iter() + .map(|suffix| format!(r#""#)) + .collect::>() + .join("\n "), ) } diff --git a/plugins/deep-link/src/config.rs b/plugins/deep-link/src/config.rs index 80f0a4c084..01470d4f50 100644 --- a/plugins/deep-link/src/config.rs +++ b/plugins/deep-link/src/config.rs @@ -10,10 +10,20 @@ use serde::{Deserialize, Deserializer}; #[derive(Deserialize)] pub struct AssociatedDomain { + #[serde(default)] + pub scheme: Vec, + #[serde(deserialize_with = "deserialize_associated_host")] pub host: String, + + #[serde(default)] + pub path: Vec, + #[serde(default, alias = "path-pattern", rename = "pathPattern")] + pub path_pattern: Vec, #[serde(default, alias = "path-prefix", rename = "pathPrefix")] pub path_prefix: Vec, + #[serde(default, alias = "path-suffix", rename = "pathSuffix")] + pub path_suffix: Vec, } fn deserialize_associated_host<'de, D>(deserializer: D) -> Result From 56a5e0f93321ac264e893e90748091bf512d9f74 Mon Sep 17 00:00:00 2001 From: FabianLars Date: Mon, 28 Apr 2025 13:38:57 +0200 Subject: [PATCH 2/6] http/https default until v3(?) --- plugins/deep-link/src/config.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/deep-link/src/config.rs b/plugins/deep-link/src/config.rs index 01470d4f50..132b3d3a4a 100644 --- a/plugins/deep-link/src/config.rs +++ b/plugins/deep-link/src/config.rs @@ -10,7 +10,7 @@ use serde::{Deserialize, Deserializer}; #[derive(Deserialize)] pub struct AssociatedDomain { - #[serde(default)] + #[serde(default = "default_schemes")] pub scheme: Vec, #[serde(deserialize_with = "deserialize_associated_host")] @@ -26,6 +26,11 @@ pub struct AssociatedDomain { pub path_suffix: Vec, } +// TODO: Consider removing this in v3 +fn default_schemes() -> Vec { + vec!["https", "http"] +} + fn deserialize_associated_host<'de, D>(deserializer: D) -> Result where D: Deserializer<'de>, From 6d9058e753bbd07e5c75ceea985d5e6914b99ecc Mon Sep 17 00:00:00 2001 From: FabianLars Date: Mon, 28 Apr 2025 14:01:16 +0200 Subject: [PATCH 3/6] to_string --- plugins/deep-link/src/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/deep-link/src/config.rs b/plugins/deep-link/src/config.rs index 132b3d3a4a..d94ed7c053 100644 --- a/plugins/deep-link/src/config.rs +++ b/plugins/deep-link/src/config.rs @@ -28,7 +28,7 @@ pub struct AssociatedDomain { // TODO: Consider removing this in v3 fn default_schemes() -> Vec { - vec!["https", "http"] + vec!["https".to_string(), "http".to_string()] } fn deserialize_associated_host<'de, D>(deserializer: D) -> Result From a97a9a7da0568f7cac264f075e62b9c62fe6aa92 Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Wed, 30 Apr 2025 17:17:46 +0200 Subject: [PATCH 4/6] Create deep-link-android-scheme.md --- .changes/deep-link-android-scheme.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/deep-link-android-scheme.md diff --git a/.changes/deep-link-android-scheme.md b/.changes/deep-link-android-scheme.md new file mode 100644 index 0000000000..9d4ae694ff --- /dev/null +++ b/.changes/deep-link-android-scheme.md @@ -0,0 +1,6 @@ +--- +deep-link: minor +deep-link-js: minor +--- + +Added a `scheme` configuration to set a scheme other than http/https. This is only supported on Android and will still default to http,https if not set. From 2ddb691e9ddc02349956254df20b8354cf10a4a5 Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Wed, 30 Apr 2025 17:21:21 +0200 Subject: [PATCH 5/6] Create deep-link-android-pattern.md --- .changes/deep-link-android-pattern.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/deep-link-android-pattern.md diff --git a/.changes/deep-link-android-pattern.md b/.changes/deep-link-android-pattern.md new file mode 100644 index 0000000000..4651a92c60 --- /dev/null +++ b/.changes/deep-link-android-pattern.md @@ -0,0 +1,6 @@ +--- +deep-link +deep-link-js: patch +--- + +Exposed Android's `path`, `pathPattern` and `pathSuffix` configurations. From 64f2f95ffe2db21cd3991437afe1e0175dccdc03 Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Wed, 30 Apr 2025 18:24:24 +0200 Subject: [PATCH 6/6] Update deep-link-android-pattern.md --- .changes/deep-link-android-pattern.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.changes/deep-link-android-pattern.md b/.changes/deep-link-android-pattern.md index 4651a92c60..b3757125ef 100644 --- a/.changes/deep-link-android-pattern.md +++ b/.changes/deep-link-android-pattern.md @@ -1,6 +1,6 @@ --- -deep-link -deep-link-js: patch +deep-link: minor +deep-link-js: minor --- Exposed Android's `path`, `pathPattern` and `pathSuffix` configurations.