Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/CapSoftware/cap
Browse files Browse the repository at this point in the history
  • Loading branch information
richiemcilroy committed Jan 19, 2025
2 parents d1d3235 + 4303f98 commit b74a96b
Show file tree
Hide file tree
Showing 9 changed files with 332 additions and 143 deletions.
134 changes: 120 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions apps/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@solidjs/start": "^1.0.6",
"@tanstack/solid-query": "^5.51.21",
"@tauri-apps/api": "^2.1.1",
"@tauri-apps/plugin-deep-link": "^2.2.0",
"@tauri-apps/plugin-dialog": "2.0.1",
"@tauri-apps/plugin-fs": "2.0.3",
"@tauri-apps/plugin-http": "^2.0.1",
Expand Down
5 changes: 3 additions & 2 deletions apps/desktop/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ tauri-plugin-notification = "2.1.0"
tauri-plugin-os = "2.1.0"
tauri-plugin-process = "2.0.1"
tauri-plugin-shell = "2.1.0"
tauri-plugin-single-instance = "2.0.1"
[target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\"))".dependencies]
tauri-plugin-single-instance = { version = "2.2.1", features = ["deep-link"] }
tauri-plugin-store = "2.2.0"
tauri-plugin-updater = "2.2.0"
tauri-plugin-oauth = { git = "https://github.com/FabianLars/tauri-plugin-oauth", branch = "v2" }
tauri-plugin-window-state = "2.2.0"
tauri-plugin-positioner = "2.2.0"
tauri-plugin-deep-link = "2.2.0"

serde = { version = "1", features = ["derive"] }
serde_json = "1"
Expand Down Expand Up @@ -79,7 +81,6 @@ cap-flags = { path = "../../../crates/flags" }
cap-recording = { path = "../../../crates/recording" }
cap-export = { path = "../../../crates/export" }
flume.workspace = true
tauri-plugin-deep-link = "2.2.0"
tracing-subscriber = "0.3.19"

[target.'cfg(target_os = "macos")'.dependencies]
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src-tauri/capabilities/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"oauth:allow-start",
"updater:default",
"notification:default",
"deep-link:default",
{
"identifier": "http:default",
"allow": [
Expand Down
32 changes: 14 additions & 18 deletions apps/desktop/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2047,6 +2047,7 @@ pub async fn run() {
}

builder
.plugin(tauri_plugin_deep_link::init())
.plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_store::Builder::new().build())
Expand All @@ -2057,7 +2058,6 @@ pub async fn run() {
.plugin(tauri_plugin_updater::Builder::new().build())
.plugin(tauri_plugin_notification::init())
.plugin(flags::plugin::init())
.plugin(tauri_plugin_deep_link::init())
.invoke_handler({
let handler = specta_builder.invoke_handler();

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

// this doesn't work in dev on mac, just a fact of deeplinks
app.deep_link().on_open_url(|event| {
// TODO: handle deep link for auth
dbg!(event.id());
dbg!(event.urls());
});

if let Ok(Some(auth)) = AuthStore::load(&app) {
sentry::configure_scope(|scope| {
scope.set_user(auth.user_id.map(|id| sentry::User {
Expand Down Expand Up @@ -2271,26 +2264,29 @@ pub async fn run() {
.run(|handle, event| match event {
#[cfg(target_os = "macos")]
tauri::RunEvent::Reopen { .. } => {
// Check if any editor or settings window is open
let has_editor_or_settings = handle
.webview_windows()
.iter()
.any(|(label, _)| label.starts_with("editor-") || label.as_str() == "settings");

if has_editor_or_settings {
// Find and focus the editor or settings window
// Check if any editor, settings or signin window is open
let has_window = handle.webview_windows().iter().any(|(label, _)| {
label.starts_with("editor-")
|| label.as_str() == "settings"
|| label.as_str() == "signin"
});

if has_window {
// Find and focus the editor, settings or signin window
if let Some(window) = handle
.webview_windows()
.iter()
.find(|(label, _)| {
label.starts_with("editor-") || label.as_str() == "settings"
label.starts_with("editor-")
|| label.as_str() == "settings"
|| label.as_str() == "signin"
})
.map(|(_, window)| window.clone())
{
window.set_focus().ok();
}
} else {
// No editor or settings window open, show main window
// No editor, settings or signin window open, show main window
open_main_window(handle.clone());
}
}
Expand Down
8 changes: 7 additions & 1 deletion apps/desktop/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@
"deep-link": {
"desktop": {
"schemes": ["cap-desktop"]
}
},
"mobile": [
{
"host": "cap.so",
"pathPrefix": ["/signin"]
}
]
}
},
"bundle": {
Expand Down
Loading

1 comment on commit b74a96b

@vercel
Copy link

@vercel vercel bot commented on b74a96b Jan 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.