chore(single-instance): put deep link integration behined a feature (#1766)

* Make deep link optional for single instance

* Add change file

* Add deep-link feature to example

* Update plugins/deep-link/README.md

Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>

* format

* [skip ci] update readme

---------

Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>
This commit is contained in:
Tony
2024-09-12 18:20:15 +08:00
committed by GitHub
parent 41afcae399
commit b2269333e3
7 changed files with 18 additions and 8 deletions
+2 -2
View File
@@ -13,7 +13,6 @@
#![cfg(not(any(target_os = "android", target_os = "ios")))]
use tauri::{plugin::TauriPlugin, AppHandle, Manager, Runtime};
use tauri_plugin_deep_link::DeepLink;
#[cfg(target_os = "windows")]
#[path = "platform_impl/windows.rs"]
@@ -35,7 +34,8 @@ pub fn init<R: Runtime, F: FnMut(&AppHandle<R>, Vec<String>, String) + Send + Sy
mut f: F,
) -> TauriPlugin<R> {
platform_impl::init(Box::new(move |app, args, cwd| {
if let Some(deep_link) = app.try_state::<DeepLink<R>>() {
#[cfg(feature = "deep-link")]
if let Some(deep_link) = app.try_state::<tauri_plugin_deep_link::DeepLink<R>>() {
deep_link.handle_cli_arguments(args.iter());
}
f(app, args, cwd)