Skip to content

Commit

Permalink
some more fixes on state saving
Browse files Browse the repository at this point in the history
  • Loading branch information
0PandaDEV committed May 10, 2024
1 parent f9b4cd6 commit 1de1aa6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions src-tauri/capabilities/migrated.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
"window:allow-start-dragging",
"os:allow-platform",
"dialog:allow-open",
"fs:default",
"global-shortcut:allow-is-registered",
"global-shortcut:allow-register",
"global-shortcut:allow-unregister",
"window-state:allow-restore-state",
"window-state:allow-save-window-state",
{
"identifier": "fs:allow-audio-read-recursive",
"allow": [
Expand Down Expand Up @@ -91,13 +97,7 @@
"path": "$APPCONFIG/**"
}
]
},
"fs:default",
"global-shortcut:allow-is-registered",
"global-shortcut:allow-register",
"global-shortcut:allow-unregister",
"window-state:allow-restore-state",
"window-state:allow-save-window-state"
}
],
"platforms": [
"linux",
Expand Down
5 changes: 2 additions & 3 deletions src-tauri/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use rusty_ytdl::Video;
use std::path::PathBuf;
use tauri::async_runtime;
use tauri::Error as TauriError;
use tauri::{AppHandle, Manager};
use tauri_plugin_dialog::DialogExt;
use tauri_plugin_dialog::MessageDialogKind;
use tauri_plugin_updater::UpdaterExt;
use tokio::time::Instant;
use tauri::{AppHandle, Manager};

#[tauri::command]
pub async fn download(url: String, name: String) -> Result<(), TauriError> {
Expand Down Expand Up @@ -123,7 +123,6 @@ pub async fn check_for_updates(app: AppHandle) {
}
}


pub fn show_window(app: &AppHandle) {
let windows = app.webview_windows();

Expand All @@ -133,4 +132,4 @@ pub fn show_window(app: &AppHandle) {
.expect("Sorry, no window found")
.set_focus()
.expect("Can't Bring Window to Focus");
}
}
3 changes: 2 additions & 1 deletion src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ fn main() {
Ok(())
})
.on_window_event(|app, event| match event {
tauri::WindowEvent::CloseRequested { .. } => {
tauri::WindowEvent::CloseRequested { .. } |
tauri::WindowEvent::Destroyed => {
let _ = AppHandleExt::save_window_state(app.app_handle(), StateFlags::all());
}
_ => {}
Expand Down

0 comments on commit 1de1aa6

Please sign in to comment.