mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
♻️ 姑且能跑 dev,尚需调试功能
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
//! @file src/client/menu.rs
|
||||
//! @desc 客户端菜单模块,负责操作米游社客户端菜单
|
||||
//! @since Beta v0.4.10
|
||||
//! @since Beta v0.5.0
|
||||
|
||||
use tauri::menu::{Menu, MenuBuilder, MenuEvent, MenuItemBuilder, Submenu, SubmenuBuilder};
|
||||
use tauri::{AppHandle, LogicalSize, Manager, Size, Window, Wry};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! @file src/client/mod.rs
|
||||
//! @desc 客户端模块,负责操作米游社客户端
|
||||
//! @since Beta v0.4.10
|
||||
//! @since Beta v0.5.0
|
||||
|
||||
mod menu;
|
||||
use tauri::async_runtime::block_on;
|
||||
|
||||
@@ -1,27 +1,26 @@
|
||||
//! @file src/commands.rs
|
||||
//! @desc 命令模块,负责处理命令
|
||||
//! @since Beta v0.4.10
|
||||
//! @since Beta v0.5.0
|
||||
|
||||
use tauri::{Manager, WebviewWindowBuilder};
|
||||
use tauri::{AppHandle, Manager, WebviewWindowBuilder};
|
||||
use tauri_utils::config::WindowConfig;
|
||||
|
||||
// 放一个常数,用来判断应用是否初始化
|
||||
static mut APP_INITIALIZED: bool = false;
|
||||
static mut DEEP_LINK_REGISTERED: bool = false;
|
||||
|
||||
// 初始化应用
|
||||
#[tauri::command]
|
||||
pub async fn init_app(app_handle: tauri::AppHandle) {
|
||||
pub async fn init_app(app_handle: AppHandle) {
|
||||
unsafe {
|
||||
if APP_INITIALIZED == true && DEEP_LINK_REGISTERED == true {
|
||||
if APP_INITIALIZED == true {
|
||||
return;
|
||||
}
|
||||
}
|
||||
dbg!("init_app");
|
||||
let _mhy = app_handle.get_webview_window("mhy_client");
|
||||
if _mhy.is_some() {
|
||||
std::thread::sleep(std::time::Duration::from_millis(1000));
|
||||
_mhy.unwrap().close().unwrap();
|
||||
// todo 这里应该延时,否则可能造成 macOS 平台的崩溃
|
||||
// _mhy.unwrap().close().unwrap();
|
||||
}
|
||||
app_handle.emit("initApp", ()).unwrap();
|
||||
unsafe {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! @file src/main.rs
|
||||
//! @desc 主模块,用于启动应用
|
||||
//! @since Beta v0.4.10
|
||||
//! @since Beta v0.5.0
|
||||
|
||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
@@ -35,9 +35,13 @@ fn window_event_handler(app: &tauri::Window, event: &tauri::WindowEvent) {
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.on_window_event(move |app, event| window_event_handler(app, event))
|
||||
.plugin(tauri_plugin_deep_link::init())
|
||||
.plugin(tauri_plugin_http::init())
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
.plugin(tauri_plugin_os::init())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.plugin(plugins::build_sql_plugin())
|
||||
.plugin(plugins::build_log_plugin())
|
||||
.plugin(tauri_plugin_deep_link::init())
|
||||
.setup(|_app| {
|
||||
let _window = _app.get_webview_window("TeyvatGuide");
|
||||
#[cfg(debug_assertions)]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! @file src/plugins.rs
|
||||
//! @desc 插件模块,用于注册插件
|
||||
//! @since Beta v0.4.10
|
||||
//! @since Beta v0.5.0
|
||||
|
||||
use super::utils;
|
||||
use log::LevelFilter;
|
||||
|
||||
Reference in New Issue
Block a user