mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-06-28 04:24:45 +08:00
feat: use notify-rust, remove dart/windows_ui
This commit is contained in:
@ -21,4 +21,5 @@ hickory-resolver = { version = "0.24" }
|
||||
anyhow = "1.0"
|
||||
win32job = "2"
|
||||
lazy_static = "1.4"
|
||||
scopeguard = "1.2"
|
||||
scopeguard = "1.2"
|
||||
notify-rust = "4"
|
@ -4,3 +4,4 @@
|
||||
pub mod http_api;
|
||||
|
||||
pub mod rs_process;
|
||||
pub mod notify_api;
|
||||
|
19
rust/src/api/notify_api.rs
Normal file
19
rust/src/api/notify_api.rs
Normal file
@ -0,0 +1,19 @@
|
||||
use notify_rust::Notification;
|
||||
|
||||
pub fn send_notify(summary: Option<String>, body: Option<String>, app_name: Option<String>, app_id: Option<String>) -> anyhow::Result<()> {
|
||||
let mut n = Notification::new();
|
||||
if let Some(summary) = summary {
|
||||
n.summary(&summary);
|
||||
}
|
||||
if let Some(body) = body {
|
||||
n.body(&body);
|
||||
}
|
||||
if let Some(app_name) = app_name {
|
||||
n.appname(&app_name);
|
||||
}
|
||||
if let Some(app_id) = app_id {
|
||||
n.app_id(&app_id);
|
||||
}
|
||||
n.show()?;
|
||||
Ok(())
|
||||
}
|
@ -204,6 +204,17 @@ pub extern "C" fn frbgen_starcitizen_doctor_wire_set_default_header(
|
||||
wire_set_default_header_impl(port_, headers)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn frbgen_starcitizen_doctor_wire_send_notify(
|
||||
port_: i64,
|
||||
summary: *mut wire_cst_list_prim_u_8_strict,
|
||||
body: *mut wire_cst_list_prim_u_8_strict,
|
||||
app_name: *mut wire_cst_list_prim_u_8_strict,
|
||||
app_id: *mut wire_cst_list_prim_u_8_strict,
|
||||
) {
|
||||
wire_send_notify_impl(port_, summary, body, app_name, app_id)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn frbgen_starcitizen_doctor_wire_start(
|
||||
port_: i64,
|
||||
|
@ -31,7 +31,7 @@ flutter_rust_bridge::frb_generated_boilerplate!(
|
||||
default_rust_auto_opaque = RustAutoOpaqueNom,
|
||||
);
|
||||
pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_VERSION: &str = "2.0.0-dev.32";
|
||||
pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = 1270049297;
|
||||
pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = 1067953400;
|
||||
|
||||
// Section: executor
|
||||
|
||||
@ -139,6 +139,37 @@ fn wire_set_default_header_impl(
|
||||
},
|
||||
)
|
||||
}
|
||||
fn wire_send_notify_impl(
|
||||
port_: flutter_rust_bridge::for_generated::MessagePort,
|
||||
summary: impl CstDecode<Option<String>>,
|
||||
body: impl CstDecode<Option<String>>,
|
||||
app_name: impl CstDecode<Option<String>>,
|
||||
app_id: impl CstDecode<Option<String>>,
|
||||
) {
|
||||
FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::<flutter_rust_bridge::for_generated::DcoCodec, _, _>(
|
||||
flutter_rust_bridge::for_generated::TaskInfo {
|
||||
debug_name: "send_notify",
|
||||
port: Some(port_),
|
||||
mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal,
|
||||
},
|
||||
move || {
|
||||
let api_summary = summary.cst_decode();
|
||||
let api_body = body.cst_decode();
|
||||
let api_app_name = app_name.cst_decode();
|
||||
let api_app_id = app_id.cst_decode();
|
||||
move |context| {
|
||||
transform_result_dco((move || {
|
||||
crate::api::notify_api::send_notify(
|
||||
api_summary,
|
||||
api_body,
|
||||
api_app_name,
|
||||
api_app_id,
|
||||
)
|
||||
})())
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
fn wire_start_impl(
|
||||
port_: flutter_rust_bridge::for_generated::MessagePort,
|
||||
executable: impl CstDecode<String>,
|
||||
|
Reference in New Issue
Block a user