forked from zelo72/mastodon-ios
fix: notification not handle escaped HTML tag issue. ticket: #22627CDA
This commit is contained in:
parent
31f178eb3a
commit
1af870a157
|
@ -56,7 +56,7 @@ class NotificationService: UNNotificationServiceExtension {
|
|||
|
||||
bestAttemptContent.title = notification.title
|
||||
bestAttemptContent.subtitle = ""
|
||||
bestAttemptContent.body = notification.body
|
||||
bestAttemptContent.body = notification.body.escape()
|
||||
bestAttemptContent.sound = UNNotificationSound.init(named: UNNotificationSoundName(rawValue: "BoopSound.caf"))
|
||||
bestAttemptContent.userInfo["plaintext"] = plaintextData
|
||||
|
||||
|
@ -105,3 +105,14 @@ extension NotificationService {
|
|||
return try? P256.KeyAgreement.PublicKey(x963Representation: publicKeyData)
|
||||
}
|
||||
}
|
||||
|
||||
extension String {
|
||||
func escape() -> String {
|
||||
return self
|
||||
.replacingOccurrences(of: "&", with: "&")
|
||||
.replacingOccurrences(of: "<", with: "<")
|
||||
.replacingOccurrences(of: ">", with: ">")
|
||||
.replacingOccurrences(of: """, with: "\"")
|
||||
.replacingOccurrences(of: "'", with: "'")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue