Skip to content

Commit b74a96b

Browse files
committed
Merge branch 'main' of https://github.com/CapSoftware/cap
2 parents d1d3235 + 4303f98 commit b74a96b

File tree

9 files changed

+332
-143
lines changed

9 files changed

+332
-143
lines changed

Cargo.lock

Lines changed: 120 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/desktop/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"@solidjs/start": "^1.0.6",
3535
"@tanstack/solid-query": "^5.51.21",
3636
"@tauri-apps/api": "^2.1.1",
37+
"@tauri-apps/plugin-deep-link": "^2.2.0",
3738
"@tauri-apps/plugin-dialog": "2.0.1",
3839
"@tauri-apps/plugin-fs": "2.0.3",
3940
"@tauri-apps/plugin-http": "^2.0.1",

apps/desktop/src-tauri/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@ tauri-plugin-notification = "2.1.0"
3333
tauri-plugin-os = "2.1.0"
3434
tauri-plugin-process = "2.0.1"
3535
tauri-plugin-shell = "2.1.0"
36-
tauri-plugin-single-instance = "2.0.1"
36+
[target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\"))".dependencies]
37+
tauri-plugin-single-instance = { version = "2.2.1", features = ["deep-link"] }
3738
tauri-plugin-store = "2.2.0"
3839
tauri-plugin-updater = "2.2.0"
3940
tauri-plugin-oauth = { git = "https://github.com/FabianLars/tauri-plugin-oauth", branch = "v2" }
4041
tauri-plugin-window-state = "2.2.0"
4142
tauri-plugin-positioner = "2.2.0"
43+
tauri-plugin-deep-link = "2.2.0"
4244

4345
serde = { version = "1", features = ["derive"] }
4446
serde_json = "1"
@@ -79,7 +81,6 @@ cap-flags = { path = "../../../crates/flags" }
7981
cap-recording = { path = "../../../crates/recording" }
8082
cap-export = { path = "../../../crates/export" }
8183
flume.workspace = true
82-
tauri-plugin-deep-link = "2.2.0"
8384
tracing-subscriber = "0.3.19"
8485

8586
[target.'cfg(target_os = "macos")'.dependencies]

apps/desktop/src-tauri/capabilities/default.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"oauth:allow-start",
3232
"updater:default",
3333
"notification:default",
34+
"deep-link:default",
3435
{
3536
"identifier": "http:default",
3637
"allow": [

apps/desktop/src-tauri/src/lib.rs

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,6 +2047,7 @@ pub async fn run() {
20472047
}
20482048

20492049
builder
2050+
.plugin(tauri_plugin_deep_link::init())
20502051
.plugin(tauri_plugin_shell::init())
20512052
.plugin(tauri_plugin_dialog::init())
20522053
.plugin(tauri_plugin_store::Builder::new().build())
@@ -2057,7 +2058,6 @@ pub async fn run() {
20572058
.plugin(tauri_plugin_updater::Builder::new().build())
20582059
.plugin(tauri_plugin_notification::init())
20592060
.plugin(flags::plugin::init())
2060-
.plugin(tauri_plugin_deep_link::init())
20612061
.invoke_handler({
20622062
let handler = specta_builder.invoke_handler();
20632063

@@ -2076,13 +2076,6 @@ pub async fn run() {
20762076
general_settings::init(&app);
20772077
fake_window::init(&app);
20782078

2079-
// this doesn't work in dev on mac, just a fact of deeplinks
2080-
app.deep_link().on_open_url(|event| {
2081-
// TODO: handle deep link for auth
2082-
dbg!(event.id());
2083-
dbg!(event.urls());
2084-
});
2085-
20862079
if let Ok(Some(auth)) = AuthStore::load(&app) {
20872080
sentry::configure_scope(|scope| {
20882081
scope.set_user(auth.user_id.map(|id| sentry::User {
@@ -2271,26 +2264,29 @@ pub async fn run() {
22712264
.run(|handle, event| match event {
22722265
#[cfg(target_os = "macos")]
22732266
tauri::RunEvent::Reopen { .. } => {
2274-
// Check if any editor or settings window is open
2275-
let has_editor_or_settings = handle
2276-
.webview_windows()
2277-
.iter()
2278-
.any(|(label, _)| label.starts_with("editor-") || label.as_str() == "settings");
2279-
2280-
if has_editor_or_settings {
2281-
// Find and focus the editor or settings window
2267+
// Check if any editor, settings or signin window is open
2268+
let has_window = handle.webview_windows().iter().any(|(label, _)| {
2269+
label.starts_with("editor-")
2270+
|| label.as_str() == "settings"
2271+
|| label.as_str() == "signin"
2272+
});
2273+
2274+
if has_window {
2275+
// Find and focus the editor, settings or signin window
22822276
if let Some(window) = handle
22832277
.webview_windows()
22842278
.iter()
22852279
.find(|(label, _)| {
2286-
label.starts_with("editor-") || label.as_str() == "settings"
2280+
label.starts_with("editor-")
2281+
|| label.as_str() == "settings"
2282+
|| label.as_str() == "signin"
22872283
})
22882284
.map(|(_, window)| window.clone())
22892285
{
22902286
window.set_focus().ok();
22912287
}
22922288
} else {
2293-
// No editor or settings window open, show main window
2289+
// No editor, settings or signin window open, show main window
22942290
open_main_window(handle.clone());
22952291
}
22962292
}

apps/desktop/src-tauri/tauri.conf.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@
3232
"deep-link": {
3333
"desktop": {
3434
"schemes": ["cap-desktop"]
35-
}
35+
},
36+
"mobile": [
37+
{
38+
"host": "cap.so",
39+
"pathPrefix": ["/signin"]
40+
}
41+
]
3642
}
3743
},
3844
"bundle": {

0 commit comments

Comments
 (0)