Skip to content

Commit 9741b8a

Browse files
committed
Handle reminder push notification in the NSE
1 parent bb460d8 commit 9741b8a

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

DemoAppPush/NotificationService.swift

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,26 @@ class NotificationService: UNNotificationServiceExtension {
9696
let chatNotification = chatHandler.handleNotification { chatContent in
9797
switch chatContent {
9898
case let .message(messageNotification):
99-
content
100-
.title = (messageNotification.message.author.name ?? "somebody") +
101-
(" on \(messageNotification.channel?.name ?? "a conversation with you")")
99+
if messageNotification.type == .reminderDue {
100+
return contentHandler(content)
101+
}
102+
103+
let authorName = messageNotification.message.author.name ?? "somebody"
104+
let channelName = messageNotification.channel?.name ?? "a conversation with you"
105+
content.title = "\(authorName) on \(channelName) a conversation with you"
102106
content.subtitle = ""
103107
content.body = messageNotification.message.text
104108
self.addMessageAttachments(message: messageNotification.message, content: content) {
105109
contentHandler($0)
106110
}
107111
default:
112+
let streamPayload = content.userInfo["stream"] as? [String: String]
113+
if let streamNotificationType = streamPayload?["type"] {
114+
if streamNotificationType == EventType.messageReminderDue.rawValue {
115+
contentHandler(content)
116+
return
117+
}
118+
}
108119
content.title = "You received an update to one conversation"
109120
contentHandler(content)
110121
}

0 commit comments

Comments
 (0)