11395dbab1
* fix: Add lint and remove all unwraps from lib.rs Signed-off-by: quexeky <git@quexeky.dev> * chore: Remove all unwraps from util.rs and add state_lock macro Signed-off-by: quexeky <git@quexeky.dev> * chore: Add CacheError and remove unwraps from fetch_object Signed-off-by: quexeky <git@quexeky.dev> * chore: Remove unwraps from fetch_object and server_proto Signed-off-by: quexeky <git@quexeky.dev> * chore: Remove unwraps from auth.rs Signed-off-by: quexeky <git@quexeky.dev> * chore: Remove unwraps from process_handlers Signed-off-by: quexeky <git@quexeky.dev> * chore: Clippy unwrap linting Signed-off-by: quexeky <git@quexeky.dev> * chore: Remove lint Because not everything is actually resolved yet: will be resolved with a restructure of the library Signed-off-by: quexeky <git@quexeky.dev> * chore: Make the rest of clippy happy Signed-off-by: quexeky <git@quexeky.dev> * fix: Send download signal instead of triggering self.on_error Signed-off-by: quexeky <git@quexeky.dev> * fix: Corrupted state should panic Signed-off-by: quexeky <git@quexeky.dev> * fix: Use debug instead of display for specific errors Signed-off-by: quexeky <git@quexeky.dev> * fix: Settings now log error instead of panicking Signed-off-by: quexeky <git@quexeky.dev> --------- Signed-off-by: quexeky <git@quexeky.dev>
24 lines
751 B
Rust
24 lines
751 B
Rust
use log::{debug, error};
|
|
use tauri::AppHandle;
|
|
|
|
use crate::{lock, AppState};
|
|
|
|
#[tauri::command]
|
|
pub fn quit(app: tauri::AppHandle, state: tauri::State<'_, std::sync::Mutex<AppState<'_>>>) {
|
|
cleanup_and_exit(&app, &state);
|
|
}
|
|
|
|
pub fn cleanup_and_exit(app: &AppHandle, state: &tauri::State<'_, std::sync::Mutex<AppState<'_>>>) {
|
|
debug!("cleaning up and exiting application");
|
|
let download_manager = lock!(state).download_manager.clone();
|
|
match download_manager.ensure_terminated() {
|
|
Ok(res) => match res {
|
|
Ok(()) => debug!("download manager terminated correctly"),
|
|
Err(()) => error!("download manager failed to terminate correctly"),
|
|
},
|
|
Err(e) => panic!("{e:?}"),
|
|
}
|
|
|
|
app.exit(0);
|
|
}
|