mirror of
https://github.com/FranP-code/ChatGPT.git
synced 2025-10-13 00:13:25 +00:00
Add 'Auto Check Update' config to control whether to check for updates on start
This commit is contained in:
@@ -194,15 +194,7 @@ pub fn menu_handler(event: WindowMenuEvent<tauri::Wry>) {
|
||||
);
|
||||
}
|
||||
"check_update" => {
|
||||
tauri::async_runtime::spawn(async move {
|
||||
let result = app.updater().check().await;
|
||||
let update_resp = result.unwrap();
|
||||
if update_resp.is_update_available() {
|
||||
tauri::async_runtime::spawn(async move {
|
||||
utils::prompt_for_install(app, update_resp).await.unwrap();
|
||||
});
|
||||
}
|
||||
});
|
||||
utils::run_check_update(app).unwrap();
|
||||
}
|
||||
// Preferences
|
||||
"control_center" => window::control_window(&app),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use std::borrow::Borrow;
|
||||
use crate::{app::window, conf::ChatConfJson, utils};
|
||||
use log::info;
|
||||
use tauri::{utils::config::WindowUrl, window::WindowBuilder, App, GlobalShortcutManager, Manager};
|
||||
use tauri::{utils::config::WindowUrl, window::WindowBuilder, App, GlobalShortcutManager, Manager, AppHandle, Wry};
|
||||
use wry::application::accelerator::Accelerator;
|
||||
|
||||
pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>> {
|
||||
@@ -89,6 +90,11 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>
|
||||
.unwrap();
|
||||
});
|
||||
}
|
||||
// auto_check_update
|
||||
if chat_conf.auto_check_update {
|
||||
let app = app.handle();
|
||||
utils::run_check_update(app).unwrap();
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user