Skip to content

Commit

Permalink
Fix lint and cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Misieq01 committed Sep 24, 2024
1 parent 070a887 commit 8f14dbf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
7 changes: 2 additions & 5 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ mod mm_proxy_manager;
mod network_utils;
mod node_adapter;
mod node_manager;
mod notification_manager;
mod p2pool;
mod p2pool_adapter;
mod p2pool_manager;
Expand All @@ -78,7 +79,6 @@ mod wallet_adapter;
mod wallet_manager;
mod xmrig;
mod xmrig_adapter;
mod notification_manager;

const MAX_ACCEPTABLE_COMMAND_TIME: Duration = Duration::from_secs(1);

Expand Down Expand Up @@ -712,10 +712,7 @@ async fn get_seed_words(
}

#[tauri::command]
async fn trigger_notification(
summary: &str,
body: &str,
) -> Result<(), String> {
async fn trigger_notification(summary: &str, body: &str) -> Result<(), String> {
NotificationManager::current().trigger_notification(summary, body);
Ok(())
}
Expand Down
24 changes: 10 additions & 14 deletions src-tauri/src/notification_manager.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::sync::LazyLock;
use notify_rust::Notification;
use std::sync::LazyLock;

use log::info;

Expand All @@ -26,11 +26,9 @@ impl NotificationManager {
match Self::detect_current_os() {
CurrentOperatingSystem::Linux => {
#[cfg(target_os = "linux")]
notification.show().unwrap().on_close(
|notification| {
info!(target: LOG_TARGET, "Notification closed: {:?}", notification);
},
);
notification.show().unwrap().on_close(|notification| {
info!(target: LOG_TARGET, "Notification closed: {:?}", notification);
});
}
CurrentOperatingSystem::MacOS => {
#[cfg(target_os = "macos")]
Expand All @@ -44,22 +42,20 @@ impl NotificationManager {
}

fn build_notification(&self, summary: &str, body: &str) -> Notification {
let mut notification = Notification::new()
.summary(summary)
.body(body).finalize();
let mut notification = Notification::new().summary(summary).body(body).finalize();

match Self::detect_current_os() {
CurrentOperatingSystem::Linux => {
return notification.auto_icon().appname("Tari Universe").finalize();
notification.auto_icon().appname("Tari Universe").finalize()
}
CurrentOperatingSystem::MacOS => {
return notification.finalize();
notification.finalize()
}
CurrentOperatingSystem::Windows => {
return notification.finalize();
notification.finalize()
}
}
}
}
fn detect_current_os() -> CurrentOperatingSystem {
if cfg!(target_os = "windows") {
CurrentOperatingSystem::Windows
Expand All @@ -75,4 +71,4 @@ impl NotificationManager {
pub fn current() -> &'static NotificationManager {
&INSTANCE
}
}
}

0 comments on commit 8f14dbf

Please sign in to comment.