Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

check for updates after permissions

Brendan Alland2eb5d2d94b3
diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rs
index d4b4c9b0f..e08e20b35 100644
--- a/apps/desktop/src-tauri/src/lib.rs
+++ b/apps/desktop/src-tauri/src/lib.rs
@@ -1126,6 +1126,8 @@ async fn list_audio_devices() -> Result<Vec<String>, ()> {
#[tauri::command(async)]
#[specta::specta]
fn open_main_window(app: AppHandle) {
+ tokio::spawn(updater::check_for_updates(app.clone()));
+
if let Some(window) = app.get_webview_window("main") {
window.set_focus().ok();
return;
@@ -1310,8 +1312,6 @@ pub fn run() {
let app_handle = app.handle().clone();
- tokio::spawn(updater::check_for_updates(app.handle().clone()));
-
if permissions::do_permissions_check(true).necessary_granted() {
open_main_window(app_handle.clone());
} else {
diff --git a/apps/desktop/src-tauri/src/updater.rs b/apps/desktop/src-tauri/src/updater.rs
index f6648abd7..a4eab156b 100644
--- a/apps/desktop/src-tauri/src/updater.rs
+++ b/apps/desktop/src-tauri/src/updater.rs
@@ -1,4 +1,4 @@
-use tauri::AppHandle;
+use tauri::{AppHandle, Manager};
use tauri_plugin_dialog::DialogExt;
use tauri_plugin_updater::UpdaterExt;
@@ -47,6 +47,10 @@ pub async fn check_for_updates(app: AppHandle) -> Result<(), ()> {
tx.send(restart).ok();
});
+ for (_, window) in app.webview_windows() {
+ window.close().ok();
+ }
+
if rx.await.unwrap() {
app.restart();
}