Minor cleanup
This commit is contained in:
parent
c132b16d01
commit
eb29b5d641
|
@ -38,7 +38,7 @@ public final class NotificationServiceExtension : UNNotificationServiceExtension
|
||||||
let (message, proto) = try MessageReceiver.parse(envelopeAsData, openGroupMessageServerID: nil, using: transaction)
|
let (message, proto) = try MessageReceiver.parse(envelopeAsData, openGroupMessageServerID: nil, using: transaction)
|
||||||
let senderPublicKey = message.sender!
|
let senderPublicKey = message.sender!
|
||||||
if (senderPublicKey == userPublicKey) {
|
if (senderPublicKey == userPublicKey) {
|
||||||
// Ignore PNs of messages sent from current user.
|
// Ignore PNs for messages sent by the current user
|
||||||
return self.completeSilenty()
|
return self.completeSilenty()
|
||||||
}
|
}
|
||||||
var senderDisplayName = Storage.shared.getContact(with: senderPublicKey)?.displayName(for: .regular) ?? senderPublicKey
|
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)
|
let thread = tsIncomingMessage.thread(with: transaction)
|
||||||
if thread.isMuted {
|
if thread.isMuted {
|
||||||
|
// Ignore PNs if the thread is muted
|
||||||
return self.completeSilenty()
|
return self.completeSilenty()
|
||||||
}
|
}
|
||||||
let threadID = thread.uniqueId!
|
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
|
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)
|
senderDisplayName = String(format: NotificationStrings.incomingGroupMessageTitleFormat, senderDisplayName, group.groupModel.groupName ?? MessageStrings.newGroupDefaultTitle)
|
||||||
if group.isOnlyNotifyingForMentions && !tsIncomingMessage.isUserMentioned {
|
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()
|
return self.completeSilenty()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue