mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-07-28 17:38:53 +02:00
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:
@@ -19,7 +19,7 @@ serde_json = { workspace = true }
|
||||
tauri = { workspace = true }
|
||||
log = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
tauri-plugin-deep-link = { path = "../deep-link", version = "2.0.0-rc.4" }
|
||||
tauri-plugin-deep-link = { path = "../deep-link", version = "2.0.0-rc.4", optional = true }
|
||||
semver = { version = "1", optional = true }
|
||||
|
||||
[target."cfg(target_os = \"windows\")".dependencies.windows-sys]
|
||||
@@ -39,3 +39,4 @@ zbus = "4"
|
||||
|
||||
[features]
|
||||
semver = ["dep:semver"]
|
||||
deep-link = ["dep:tauri-plugin-deep-link"]
|
||||
|
||||
@@ -34,8 +34,8 @@ use tauri::{Manager};
|
||||
|
||||
#[derive(Clone, serde::Serialize)]
|
||||
struct Payload {
|
||||
args: Vec<String>,
|
||||
cwd: String,
|
||||
args: Vec<String>,
|
||||
cwd: String,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
@@ -49,6 +49,8 @@ fn main() {
|
||||
}
|
||||
```
|
||||
|
||||
Note that currently, plugins run in the order they were added in to the builder, so make sure that this plugin is registered first.
|
||||
|
||||
## Contributing
|
||||
|
||||
PRs accepted. Please make sure to read the Contributing Guide before making a pull request.
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user