fix(notification): body should be optional on iOS (#1737)

pull/1739/head
Lucas Fernandes Nogueira 9 months ago committed by GitHub
parent 12e80ffe00
commit 3d301c654e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
"notification": patch
---
The notification body is now optional on iOS to match the other platforms.

@ -32,9 +32,11 @@ func makeNotificationContent(_ notification: Notification) throws -> UNNotificat
let content = UNMutableNotificationContent()
content.title = NSString.localizedUserNotificationString(
forKey: notification.title, arguments: nil)
content.body = NSString.localizedUserNotificationString(
forKey: notification.body,
arguments: nil)
if let body = notification.body {
content.body = NSString.localizedUserNotificationString(
forKey: body,
arguments: nil)
}
content.userInfo = [
"__EXTRA__": notification.extra as Any,

@ -65,7 +65,7 @@ struct NotificationAttachment: Codable {
struct Notification: Decodable {
let id: Int
var title: String
var body: String
var body: String?
var extra: [String: String]?
let schedule: NotificationSchedule?
let attachments: [NotificationAttachment]?

Loading…
Cancel
Save