-
Notifications
You must be signed in to change notification settings - Fork 1
/
send.rs
32 lines (26 loc) · 1 KB
/
send.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use mac_notifications::*;
fn main() {
let mut provider = NotificationProvider::new("terminal");
provider.set_callback(|id, response| {
println!("notification activated {}: {:?}", id, response);
});
let image = String::from("https://avatars.githubusercontent.com/u/6866008?v=4");
let id = Notification::new()
.reply(true)
.title("title")
.subtitle("This notification will be deleted in ~5sec... Interact with it before that!")
.image(image.as_ref())
.delivery_date(std::time::SystemTime::now() - std::time::Duration::from_secs(100))
.send()
.expect("TODO: panic message");
for _ in 0..50 {
provider.run_main_loop_once();
}
println!("all notifications: {:?}", provider.get_all_notifications());
println!("deleting old notification(s)...");
provider.delete(id.as_str());
println!("all notifications: {:?}", provider.get_all_notifications());
for _ in 0..50 {
provider.run_main_loop_once();
}
}