Add push notification body for poll.end

This commit is contained in:
Alfonso Grillo 2022-12-30 09:54:22 +01:00
parent 7a3fe14963
commit 5893d516fb

View file

@ -544,7 +544,7 @@ class NotificationService: UNNotificationServiceExtension {
// Otherwise show a generic reaction.
notificationBody = NotificationService.localizedString(forKey: "GENERIC_REACTION_FROM_USER", eventSenderName)
}
case .custom:
if (event.type == kWidgetMatrixEventTypeString || event.type == kWidgetModularEventTypeString),
let type = event.content?["type"] as? String,
@ -561,14 +561,19 @@ class NotificationService: UNNotificationServiceExtension {
additionalUserInfo = [Constants.userInfoKeyPresentNotificationOnForeground: true]
}
}
case .pollStart:
notificationTitle = self.messageTitle(for: eventSenderName, in: roomDisplayName)
notificationBody = MXEventContentPollStart(fromJSON: event.content)?.question
case .pollEnd:
notificationTitle = self.messageTitle(for: eventSenderName, in: roomDisplayName)
notificationBody = VectorL10n.pollTimelineEndedText
default:
break
}
self.validateNotificationContentAndComplete(
notificationTitle: notificationTitle,
notificationBody: notificationBody,