From 01ce402595688fb56a8dd9a8cab2b7b8b1668407 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Mon, 29 Jun 2020 18:18:48 -0500 Subject: [PATCH] Remove winrt-notification as a dependency notify-rust works on Windows, Linux and macOS (and depends on winrt-notification anyways) so I can just use notify-rust --- Cargo.lock | 1 - Cargo.toml | 8 +------- src/pomodoro.rs | 38 -------------------------------------- 3 files changed, 1 insertion(+), 46 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a5e2a66..bc6d8b2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -396,7 +396,6 @@ dependencies = [ "rodio", "serde", "toml", - "winrt-notification", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index f34213e..d508859 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,13 +12,7 @@ async-std = "1.6.2" clap = "2.33.1" crossterm = "0.17.5" directories = "3.0.0" +notify-rust = "4.0.0" rodio = "0.11.0" serde = { version = "1.0.114", features = ["derive"] } toml = "0.5.6" - -[target.'cfg(windows)'.dependencies] -# winrt = "0.7.0" -winrt-notification = "0.2.2" - -[target.'cfg(any(target_os = "macos", target_os = "linux"))'.dependencies] -notify-rust = "4.0.0" diff --git a/src/pomodoro.rs b/src/pomodoro.rs index b05e93b..8174888 100644 --- a/src/pomodoro.rs +++ b/src/pomodoro.rs @@ -144,7 +144,6 @@ impl Pomodoro { tx.send(status).unwrap(); } - #[cfg(any(target_os = "macos", target_os = "linux"))] fn notify(state: &State) { let mut toast = notify_rust::Notification::new(); @@ -172,43 +171,6 @@ impl Pomodoro { } } } - - #[cfg(target_os = "windows")] - fn notify(state: &State) { - use winrt_notification::{Duration, Sound, Toast}; - - let toast = Toast::new(Toast::POWERSHELL_APP_ID); - - match state { - State::Work => { - toast - .title("Time to Work!") - .text1("Remember to stay focused!") - .sound(Some(Sound::Default)) - .duration(Duration::Short) - .show() - .unwrap(); - } - State::ShortBreak | State::LongBreak => { - toast - .title("Break Time!") - .text1("Enjoy your well deserved rest!") - .sound(Some(Sound::Default)) - .duration(Duration::Short) - .show() - .unwrap(); - } - State::Inactive => { - toast - .title("Pomodoro Cycle Complete.") - .text1("Now waiting for user input....") - .sound(Some(Sound::Default)) - .duration(Duration::Short) - .show() - .unwrap(); - } - } - } } #[derive(Copy, Clone, Debug)]