| 1 | #![allow(unused_imports)] |
| 2 | mod common; |
| 3 | |
| 4 | fn main() -> Result<(), Box<dyn std::error::Error>> { |
| 5 | cfg_if::cfg_if! { |
| 6 | if #[cfg(target_os = "macos")] { |
| 7 | if !common::setup(file!()) { |
| 8 | return Ok(()); |
| 9 | } |
| 10 | use notify_rust::Notification; |
| 11 | |
| 12 | let duration = chrono::Duration::milliseconds(4321); |
| 13 | let timestamp = (chrono::Utc::now() + duration).timestamp() as f64; |
| 14 | |
| 15 | Notification::new() |
| 16 | .summary("Oh by the way") |
| 17 | .body(&format!("this was scheduled {:?} ago", duration)) |
| 18 | .schedule(chrono::Utc::now() + duration)?; |
| 19 | |
| 20 | Notification::new() |
| 21 | .summary("Oh by the way") |
| 22 | .body(&format!("this was scheduled for timestamp {}", timestamp)) |
| 23 | .schedule_raw(timestamp)?; |
| 24 | |
| 25 | Ok(()) |
| 26 | } else { |
| 27 | println!("this is a mac only feature"); |
| 28 | Ok(()) |
| 29 | } |
| 30 | } |
| 31 | } |