From 5b8211815825ddae2dcc0c00520e0cfdff002763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Didrik=20Nordstr=C3=B6m?= Date: Sun, 19 Jan 2025 18:47:14 +0100 Subject: [PATCH] fix(opener): invoke the mobile plugin in the commands too (#2234) (#2332) Co-authored-by: Fabian-Lars --- .changes/opener-mobile-fix.md | 6 ++++++ plugins/opener/src/commands.rs | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 .changes/opener-mobile-fix.md diff --git a/.changes/opener-mobile-fix.md b/.changes/opener-mobile-fix.md new file mode 100644 index 00000000..98e03921 --- /dev/null +++ b/.changes/opener-mobile-fix.md @@ -0,0 +1,6 @@ +--- +"opener": patch +"opener-js": patch +--- + +Fix broken JS commands `opener.openPath` and `opener.openUrl` on mobile. diff --git a/plugins/opener/src/commands.rs b/plugins/opener/src/commands.rs index 1b46141b..b00d5306 100644 --- a/plugins/opener/src/commands.rs +++ b/plugins/opener/src/commands.rs @@ -9,7 +9,7 @@ use tauri::{ AppHandle, Runtime, }; -use crate::{scope::Scope, Error}; +use crate::{scope::Scope, Error, OpenerExt}; #[tauri::command] pub async fn open_url( @@ -34,7 +34,7 @@ pub async fn open_url( ); if scope.is_url_allowed(&url, with.as_deref()) { - crate::open_url(url, with) + app.opener().open_url(url, with) } else { Err(Error::ForbiddenUrl { url, with }) } @@ -63,7 +63,7 @@ pub async fn open_path( ); if scope.is_path_allowed(Path::new(&path), with.as_deref())? { - crate::open_path(path, with) + app.opener().open_path(path, with) } else { Err(Error::ForbiddenPath { path, with }) }