feat(splashscreen): enhance startup sequence and splashscreen handling
This update improves the splashscreen management during application startup. The splashscreen will now remain visible for a minimum duration and will only close after the main application is ready, ensuring a smoother user experience. - Introduced a new startup sequence to manage background tasks. - Added error handling for splashscreen closure to maintain functionality. - Optimized the timing for displaying and hiding the splashscreen.
This commit is contained in:
+13
-5
@@ -22,14 +22,22 @@ use git::{
|
||||
use tauri::Manager;
|
||||
|
||||
#[tauri::command]
|
||||
fn close_splashscreen(app: tauri::AppHandle) {
|
||||
fn close_splashscreen(app: tauri::AppHandle) -> Result<(), String> {
|
||||
if let Some(window) = app.get_webview_window("splashscreen") {
|
||||
let _ = window.hide();
|
||||
window
|
||||
.destroy()
|
||||
.map_err(|error| format!("failed to destroy splashscreen: {error}"))?;
|
||||
}
|
||||
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
let _ = window.show();
|
||||
window
|
||||
.show()
|
||||
.map_err(|error| format!("failed to show main window: {error}"))?;
|
||||
let _ = window.set_focus();
|
||||
}
|
||||
if let Some(window) = app.get_webview_window("splashscreen") {
|
||||
let _ = window.close();
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
|
||||
Reference in New Issue
Block a user