Skip to content

Commit

Permalink
Blocked notifications when sending text and waypoints from own node
Browse files Browse the repository at this point in the history
  • Loading branch information
ajmcquilkin committed Mar 7, 2024
1 parent 2c4d872 commit bfd04f5
Showing 1 changed file with 33 additions and 29 deletions.
62 changes: 33 additions & 29 deletions src-tauri/src/packet_api/handlers/mesh_packet/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,19 +171,21 @@ pub fn handle_text_message_mesh_packet<R: tauri::Runtime>(
events::dispatch_updated_device(&packet_api.app_handle, &packet_api.device)
.map_err(|e| DeviceUpdateError::EventDispatchFailure(e.to_string()))?;

Notification::new(
packet_api
.app_handle
.config()
.tauri
.bundle
.identifier
.clone(),
)
.title(format!("{} in {}", from_user_name, channel_name))
.body(data)
.notify(&packet_api.app_handle)
.map_err(|e| DeviceUpdateError::NotificationDispatchFailure(e.to_string()))?;
if packet.from != packet_api.device.my_node_info.my_node_num {
Notification::new(
packet_api
.app_handle
.config()
.tauri
.bundle
.identifier
.clone(),
)
.title(format!("{} in {}", from_user_name, channel_name))
.body(data)
.notify(&packet_api.app_handle)
.map_err(|e| DeviceUpdateError::NotificationDispatchFailure(e.to_string()))?;
}

Ok(())
}
Expand Down Expand Up @@ -213,22 +215,24 @@ pub fn handle_waypoint_mesh_packet<R: tauri::Runtime>(
events::dispatch_updated_device(&packet_api.app_handle, &packet_api.device)
.map_err(|e| DeviceUpdateError::EventDispatchFailure(e.to_string()))?;

Notification::new(
packet_api
.app_handle
.config()
.tauri
.bundle
.identifier
.clone(),
)
.title(format!("{} in {}", from_user_name, channel_name))
.body(format!(
"Sent waypoint \"{}\" at {}, {}",
converted_data.name, converted_data.latitude, converted_data.longitude
))
.notify(&packet_api.app_handle)
.map_err(|e| DeviceUpdateError::NotificationDispatchFailure(e.to_string()))?;
if packet.from != packet_api.device.my_node_info.my_node_num {
Notification::new(
packet_api
.app_handle
.config()
.tauri
.bundle
.identifier
.clone(),
)
.title(format!("{} in {}", from_user_name, channel_name))
.body(format!(
"Sent waypoint \"{}\" at {}, {}",
converted_data.name, converted_data.latitude, converted_data.longitude
))
.notify(&packet_api.app_handle)
.map_err(|e| DeviceUpdateError::NotificationDispatchFailure(e.to_string()))?;
}

Ok(())
}
Expand Down

0 comments on commit bfd04f5

Please sign in to comment.