fix cards ui and data extract
This commit is contained in:
@@ -6,7 +6,7 @@ use std::os::windows::process::CommandExt;
|
||||
use tokio::sync::mpsc;
|
||||
use tauri::{AppHandle, Manager, State, Emitter};
|
||||
use serde::Serialize;
|
||||
use winget::{Software, list_all_software, list_updates};
|
||||
use winget::{Software, list_all_software, list_updates, ensure_winget_dependencies};
|
||||
|
||||
struct AppState {
|
||||
install_tx: mpsc::Sender<String>,
|
||||
@@ -79,6 +79,13 @@ pub fn run() {
|
||||
.setup(move |app| {
|
||||
let handle = app.handle().clone();
|
||||
|
||||
// 确保依赖项已安装 (这是一个耗时的过程,建议在异步任务中运行)
|
||||
tauri::async_runtime::spawn(async move {
|
||||
let _ = tokio::task::spawn_blocking(|| {
|
||||
let _ = ensure_winget_dependencies();
|
||||
}).await;
|
||||
});
|
||||
|
||||
// 在 setup 闭包中初始化,此时运行时已就绪
|
||||
let (tx, mut rx) = mpsc::channel::<String>(100);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user