Optimize code format
This commit is contained in:
@@ -30,9 +30,9 @@ pub fn open_browser(app: AppHandle, url: String) {
|
||||
|
||||
#[command]
|
||||
pub async fn download_file(app: AppHandle, params: DownloadFileParams) -> Result<(), String> {
|
||||
let window: Window = app.get_window("pake").unwrap().clone();
|
||||
let window: Window = app.get_window("pake").unwrap();
|
||||
let output_path = api::path::download_dir().unwrap().join(params.filename);
|
||||
let file_path = check_file_or_append(&output_path.to_str().unwrap());
|
||||
let file_path = check_file_or_append(output_path.to_str().unwrap());
|
||||
let download = Download::new(¶ms.url, Some(&file_path), None);
|
||||
match download.download() {
|
||||
Ok(_) => {
|
||||
|
||||
@@ -32,10 +32,8 @@ pub fn get_menu() -> Menu {
|
||||
}
|
||||
|
||||
pub fn menu_event_handle(event: WindowMenuEvent) {
|
||||
match event.menu_item_id() {
|
||||
// default close to minimize
|
||||
"close" => event.window().minimize().expect("can't minimize window"),
|
||||
_ => {}
|
||||
if event.menu_item_id() == "close" {
|
||||
event.window().minimize().expect("can't minimize window");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user