refactor: replace println with logging in core validation and tray quit function

This commit is contained in:
Tunglies
2025-03-26 04:31:38 +08:00
parent 0ec4f46052
commit 98d3a48710
6 changed files with 298 additions and 79 deletions

View File

@@ -1,6 +1,12 @@
use crate::{
config::{Config, IVerge},
core::handle,
core::{
handle,
service::{install_service, is_service_available, reinstall_service},
CoreManager,
},
logging, logging_error,
utils::logging::Type,
};
use std::env;
use tauri_plugin_clipboard_manager::ClipboardExt;
@@ -28,6 +34,19 @@ pub fn toggle_system_proxy() {
/// Toggle TUN mode on/off
pub fn toggle_tun_mode(not_save_file: Option<bool>) {
// tauri::async_runtime::spawn(async move {
// logging!(
// info,
// Type::Service,
// true,
// "Toggle TUN mode need install service"
// );
// if is_service_available().await.is_err() {
// logging_error!(Type::Service, true, install_service().await);
// }
// logging_error!(Type::Core, true, CoreManager::global().restart_core().await);
// });
let enable = Config::verge().data().enable_tun_mode;
let enable = enable.unwrap_or(false);