mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2024-11-16 11:42:21 +08:00
fix: instantiate core after init app, close #122
This commit is contained in:
parent
711b220a05
commit
150f0cf486
|
@ -38,7 +38,6 @@ fn main() -> std::io::Result<()> {
|
|||
|
||||
#[allow(unused_mut)]
|
||||
let mut builder = tauri::Builder::default()
|
||||
.manage(core::Core::new())
|
||||
.setup(|app| Ok(resolve::resolve_setup(app)))
|
||||
.system_tray(SystemTray::new().with_menu(tray_menu))
|
||||
.on_system_tray_event(move |app_handle, event| match event {
|
||||
|
|
|
@ -9,12 +9,16 @@ pub fn resolve_setup(app: &App) {
|
|||
// init app config
|
||||
init::init_app(app.package_info());
|
||||
|
||||
// init states
|
||||
let core = app.state::<Core>();
|
||||
// init core
|
||||
// should be initialized after init_app fix #122
|
||||
let core = Core::new();
|
||||
|
||||
core.set_win(app.get_window("main"));
|
||||
core.init(app.app_handle());
|
||||
|
||||
// fix #122
|
||||
app.manage(core);
|
||||
|
||||
resolve_window(app);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user