mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Honor user mute for dm notifications
This commit is contained in:
parent
d90c016305
commit
8983e13b21
2 changed files with 14 additions and 5 deletions
|
|
@ -1296,9 +1296,20 @@ func textMessageAppPacket(packet: MeshPacket, connectedNode: Int64, context: NSM
|
|||
|
||||
if messageSaved {
|
||||
|
||||
// Send a DM Notification
|
||||
if newMessage.fromUser != nil && newMessage.toUser != nil && !(newMessage.fromUser?.mute ?? false) {
|
||||
// Create an iOS Notification for the received message and schedule it immediately
|
||||
// Create an iOS Notification for the received DM message and schedule it immediately
|
||||
let manager = LocalNotificationManager()
|
||||
manager.notifications = [
|
||||
Notification(
|
||||
id: ("notification.id.\(newMessage.messageId)"),
|
||||
title: "\(newMessage.fromUser?.longName ?? "Unknown")",
|
||||
subtitle: "AKA \(newMessage.fromUser?.shortName ?? "???")",
|
||||
content: messageText)
|
||||
]
|
||||
manager.schedule()
|
||||
MeshLogger.log("💬 iOS Notification Scheduled for text message from \(newMessage.fromUser?.longName ?? "Unknown")")
|
||||
} else if newMessage.fromUser != nil && newMessage.toUser == nil {
|
||||
// Create an iOS Notification for the received private channel message and schedule it immediately
|
||||
let manager = LocalNotificationManager()
|
||||
manager.notifications = [
|
||||
Notification(
|
||||
|
|
|
|||
|
|
@ -161,12 +161,10 @@ struct Contacts: View {
|
|||
Button {
|
||||
setUserMute(num: user.num, mute: !user.mute, context: context)
|
||||
} label: {
|
||||
Label(user.mute ? "Show Alerts" : "Hide Alerts", systemImage: "bell")
|
||||
Label(user.mute ? "Show Alerts" : "Hide Alerts", systemImage: user.mute ? "bell" : "bell.slash")
|
||||
}
|
||||
|
||||
if user.messageList.count > 0 {
|
||||
Button(role: .destructive) {
|
||||
print("I want to delete all the messages for \(user.longName)")
|
||||
isPresentingDeleteUserMessagesConfirm = true
|
||||
} label: {
|
||||
Label("Delete Messages", systemImage: "trash")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue