add splash screen
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "default",
|
||||
"description": "Capability for the main window",
|
||||
"windows": ["main"],
|
||||
"windows": ["main", "splashscreen"],
|
||||
"permissions": [
|
||||
"core:default",
|
||||
"opener:default",
|
||||
|
||||
@@ -111,6 +111,16 @@ pub fn delete_history_item(app: AppHandle, id: String) -> Result<(), String> {
|
||||
storage::delete_history_item(&app, &id).map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn close_splash(app: AppHandle) {
|
||||
if let Some(splash) = app.get_webview_window("splashscreen") {
|
||||
splash.close().unwrap();
|
||||
}
|
||||
if let Some(main) = app.get_webview_window("main") {
|
||||
main.show().unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn open_in_explorer(app: AppHandle, path: String) -> Result<(), String> {
|
||||
let path_to_open = if Path::new(&path).exists() {
|
||||
|
||||
@@ -24,6 +24,7 @@ pub fn run() {
|
||||
commands::get_history,
|
||||
commands::clear_history,
|
||||
commands::delete_history_item,
|
||||
commands::close_splash,
|
||||
commands::open_in_explorer
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
|
||||
@@ -12,9 +12,22 @@
|
||||
"app": {
|
||||
"windows": [
|
||||
{
|
||||
"label": "main",
|
||||
"title": "流萤 - 视频下载 v1.0.0",
|
||||
"width": 1300,
|
||||
"height": 900
|
||||
"height": 900,
|
||||
"visible": false
|
||||
},
|
||||
{
|
||||
"label": "splashscreen",
|
||||
"title": "StreamCapture Loading",
|
||||
"url": "splashscreen.html",
|
||||
"width": 400,
|
||||
"height": 300,
|
||||
"decorations": false,
|
||||
"center": true,
|
||||
"resizable": false,
|
||||
"alwaysOnTop": true
|
||||
}
|
||||
],
|
||||
"security": {
|
||||
|
||||
Reference in New Issue
Block a user