filter notification text

pull/1/head
Michael Kirk 7 years ago
parent d88ffc4775
commit fe4e416daf

@ -156,6 +156,7 @@ extension LegacyNotificationPresenterAdaptee: NotificationPresenterAdaptee {
let alertBody: String let alertBody: String
if let title = title { if let title = title {
// TODO - Make this a format string for better l10n
alertBody = title.rtlSafeAppend(":").rtlSafeAppend(" ").rtlSafeAppend(body) alertBody = title.rtlSafeAppend(":").rtlSafeAppend(" ").rtlSafeAppend(body)
} else { } else {
alertBody = body alertBody = body
@ -163,7 +164,7 @@ extension LegacyNotificationPresenterAdaptee: NotificationPresenterAdaptee {
let notification = UILocalNotification() let notification = UILocalNotification()
notification.category = category.identifier notification.category = category.identifier
notification.alertBody = alertBody notification.alertBody = alertBody.filterForDisplay
notification.userInfo = userInfo notification.userInfo = userInfo
notification.soundName = sound?.filename notification.soundName = sound?.filename

@ -132,10 +132,12 @@ extension UserNotificationPresenterAdaptee: NotificationPresenterAdaptee {
} }
if shouldPresentNotification(category: category, userInfo: userInfo) { if shouldPresentNotification(category: category, userInfo: userInfo) {
if let title = title { if let displayableTitle = title?.filterForDisplay {
content.title = title content.title = displayableTitle
}
if let displayableBody = body.filterForDisplay {
content.body = displayableBody
} }
content.body = body
} else { } else {
// Play sound and vibrate, but without a `body` no banner will show. // Play sound and vibrate, but without a `body` no banner will show.
Logger.debug("supressing notification body") Logger.debug("supressing notification body")

Loading…
Cancel
Save