Browse Source

Minor cleanup

pull/481/head
Niels Andriesse 10 months ago
parent
commit
eb29b5d641
  1. 5
      SessionNotificationServiceExtension/NotificationServiceExtension.swift

5
SessionNotificationServiceExtension/NotificationServiceExtension.swift

@ -38,7 +38,7 @@ public final class NotificationServiceExtension : UNNotificationServiceExtension
let (message, proto) = try MessageReceiver.parse(envelopeAsData, openGroupMessageServerID: nil, using: transaction)
let senderPublicKey = message.sender!
if (senderPublicKey == userPublicKey) {
// Ignore PNs of messages sent from current user.
// Ignore PNs for messages sent by the current user
return self.completeSilenty()
}
var senderDisplayName = Storage.shared.getContact(with: senderPublicKey)?.displayName(for: .regular) ?? senderPublicKey
@ -52,6 +52,7 @@ public final class NotificationServiceExtension : UNNotificationServiceExtension
}
let thread = tsIncomingMessage.thread(with: transaction)
if thread.isMuted {
// Ignore PNs if the thread is muted
return self.completeSilenty()
}
let threadID = thread.uniqueId!
@ -62,7 +63,7 @@ public final class NotificationServiceExtension : UNNotificationServiceExtension
group.groupModel.groupType == .closedGroup { // Should always be true because we don't get PNs for open groups
senderDisplayName = String(format: NotificationStrings.incomingGroupMessageTitleFormat, senderDisplayName, group.groupModel.groupName ?? MessageStrings.newGroupDefaultTitle)
if group.isOnlyNotifyingForMentions && !tsIncomingMessage.isUserMentioned {
// Ignore PNs if the group is set to only notify mentions
// Ignore PNs if the group is set to only notify for mentions
return self.completeSilenty()
}
}

Loading…
Cancel
Save