feat: replace prompt with inform (fire-and-forget), logs default 20 lines
This commit is contained in:
parent
d2f77f8054
commit
af0b6b5ddb
5 changed files with 51 additions and 13 deletions
|
|
@ -430,6 +430,26 @@ async fn handle_message(
|
|||
}
|
||||
}
|
||||
|
||||
ServerMessage::InformRequest { request_id, message, title } => {
|
||||
let msg = message.clone();
|
||||
let ttl = title.clone().unwrap_or_else(|| "Helios".to_string());
|
||||
// Fire-and-forget: show MessageBox in background thread, don't block
|
||||
std::thread::spawn(move || {
|
||||
#[cfg(windows)]
|
||||
unsafe {
|
||||
use windows::core::PCWSTR;
|
||||
use windows::Win32::UI::WindowsAndMessaging::{MessageBoxW, MB_OK, MB_ICONINFORMATION, HWND_DESKTOP};
|
||||
let msg_w: Vec<u16> = msg.encode_utf16().chain(std::iter::once(0)).collect();
|
||||
let ttl_w: Vec<u16> = ttl.encode_utf16().chain(std::iter::once(0)).collect();
|
||||
MessageBoxW(HWND_DESKTOP, PCWSTR(msg_w.as_ptr()), PCWSTR(ttl_w.as_ptr()), MB_OK | MB_ICONINFORMATION);
|
||||
}
|
||||
#[cfg(not(windows))]
|
||||
let _ = (msg, ttl);
|
||||
});
|
||||
display::log_ok("inform", &message);
|
||||
ClientMessage::Ack { request_id }
|
||||
}
|
||||
|
||||
ServerMessage::PromptRequest { request_id, message, title: _ } => {
|
||||
display::prompt_waiting(&message);
|
||||
let answer = tokio::task::spawn_blocking(|| {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue