diff --git a/apps/desktop/src-tauri/src/main.rs b/apps/desktop/src-tauri/src/main.rs index 285e3183a..12c835544 100644 --- a/apps/desktop/src-tauri/src/main.rs +++ b/apps/desktop/src-tauri/src/main.rs @@ -5,6 +5,7 @@ use std::error::Error; use std::path::PathBuf; +use std::time::Duration; use sd_core::Node; use tauri::async_runtime::block_on; @@ -14,6 +15,7 @@ use tauri::{ Manager, RunEvent, }; use tokio::task::block_in_place; +use tokio::time::sleep; use tracing::{debug, error}; #[cfg(target_os = "macos")] mod macos; @@ -56,17 +58,20 @@ async fn main() -> Result<(), Box> { }) .setup(|app| { let app = app.handle(); - - #[cfg(target_os = "macos")] - { - // use macos::{lock_app_theme, AppThemeType}; - - // lock_app_theme(AppThemeType::Dark as _); - } - app.windows().iter().for_each(|(_, window)| { window.hide().unwrap(); + tokio::spawn({ + let window = window.clone(); + async move { + sleep(Duration::from_secs(3)).await; + if window.is_visible().unwrap_or(true) == false { + println!("Window did not emit `app_ready` event fast enough. Showing window..."); + let _ = window.show(); + } + } + }); + #[cfg(target_os = "windows")] window.set_decorations(true).unwrap(); diff --git a/apps/desktop/src/App.tsx b/apps/desktop/src/App.tsx index e2e7172ff..d5ebabb95 100644 --- a/apps/desktop/src/App.tsx +++ b/apps/desktop/src/App.tsx @@ -33,7 +33,8 @@ async function getOs(): Promise { const platform: Platform = { platform: 'tauri', - getThumbnailUrlById: (casId) => `spacedrive://thumbnail/${encodeURIComponent(casId)}`, + getThumbnailUrlById: (casId) => + `${window.location.origin}/spacedrive/thumbnail/${encodeURIComponent(casId)}`, openLink: shell.open, getOs, openFilePickerDialog: () => dialog.open({ directory: true }), diff --git a/apps/desktop/src/index.html b/apps/desktop/src/index.html index 0a1c2d024..819681673 100644 --- a/apps/desktop/src/index.html +++ b/apps/desktop/src/index.html @@ -8,6 +8,7 @@
+ diff --git a/packages/client/src/index.ts b/packages/client/src/index.ts index 2e98ff9b0..4be93fb50 100644 --- a/packages/client/src/index.ts +++ b/packages/client/src/index.ts @@ -2,7 +2,7 @@ declare global { var isDev: boolean; } -if (!globalThis.localStorage || !globalThis.isDev) +if (globalThis.localStorage === undefined || globalThis.isDev === undefined) throw new Error('Please ensure you have patched `globalThis` before importing `@sd/client`!'); export * from './hooks';