filter notification text

This commit is contained in:
Michael Kirk 2019-02-04 10:40:55 -07:00
parent d88ffc4775
commit fe4e416daf
2 changed files with 7 additions and 4 deletions

View File

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

View File

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