mirror of
https://github.com/nostrlabs-io/notepush.git
synced 2025-06-15 19:38:24 +00:00
Improve message formatting fallbacks
to something more user-friendly Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit is contained in:
@ -312,10 +312,17 @@ impl NotificationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn format_notification_message(&self, event: &Event) -> (String, String, String) {
|
fn format_notification_message(&self, event: &Event) -> (String, String, String) {
|
||||||
let title = "New activity".to_string();
|
// NOTE: This is simple because the client will handle formatting. These are just fallbacks.
|
||||||
let subtitle = format!("From: {}", event.pubkey);
|
let (title, body) = match event.kind {
|
||||||
let body = event.content.clone();
|
nostr_sdk::Kind::TextNote => ("New activity".to_string(), event.content.clone()),
|
||||||
(title, subtitle, body)
|
nostr_sdk::Kind::EncryptedDirectMessage => ("New direct message".to_string(), "Contents are encrypted".to_string()),
|
||||||
|
nostr_sdk::Kind::Repost => ("Someone reposted".to_string(), event.content.clone()),
|
||||||
|
nostr_sdk::Kind::Reaction => ("New reaction".to_string(), event.content.clone()),
|
||||||
|
nostr_sdk::Kind::ZapPrivateMessage => ("New zap private message".to_string(), "Contents are encrypted".to_string()),
|
||||||
|
nostr_sdk::Kind::ZapReceipt => ("Someone zapped you".to_string(), "".to_string()),
|
||||||
|
_ => ("New activity".to_string(), "".to_string()),
|
||||||
|
};
|
||||||
|
(title, "".to_string(), body)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn save_user_device_info(
|
pub async fn save_user_device_info(
|
||||||
|
Reference in New Issue
Block a user