Merge pull request #3278 from fufesou/refact/register_breakdown_handler

macos do not alert
This commit is contained in:
RustDesk 2023-02-19 22:00:54 +08:00 committed by GitHub
commit 7ba3dce006
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 14 deletions

View File

@ -6,14 +6,15 @@ use hbb_common::platform::macos;
fn main() {
#[cfg(target_os = "linux")]
linux::system_message("test title", "test message", true).ok();
let res = linux::system_message("test title", "test message", true);
#[cfg(target_os = "macos")]
macos::alert(
"RustDesk".to_owned(),
let res = macos::alert(
"System Preferences".to_owned(),
"warning".to_owned(),
"test title".to_owned(),
"test message".to_owned(),
["Ok".to_owned()].to_vec(),
)
.ok();
);
#[cfg(any(target_os = "linux", target_os = "macos"))]
println!("result {:?}", &res);
}

View File

@ -40,15 +40,25 @@ extern "C" fn breakdown_signal_handler(sig: i32) {
true,
)
.ok();
#[cfg(target_os = "macos")]
macos::alert(
"RustDesk".to_owned(),
"critical".to_owned(),
"Crashed".to_owned(),
format!("Got signal {} and exit.{}", sig, info),
["Ok".to_owned()].to_vec(),
)
.ok();
// Ignore alert info for now.
// #[cfg(target_os = "macos")]
// {
// use std::sync::mpsc::channel;
// use std::time::Duration;
// let (tx, rx) = channel();
// std::thread::spawn(move || {
// macos::alert(
// "System Preferences".to_owned(),
// "critical".to_owned(),
// "RustDesk Crashed".to_owned(),
// format!("Got signal {} and exit.{}", sig, info),
// ["Ok".to_owned()].to_vec(),
// )
// .ok();
// let _ = tx.send(());
// });
// let _ = rx.recv_timeout(Duration::from_millis(1_000));
// }
}
exit(0);
}