diff --git a/openHAB/NotificationsView.swift b/openHAB/NotificationsView.swift index ca8d4b15..d3eaf56c 100644 --- a/openHAB/NotificationsView.swift +++ b/openHAB/NotificationsView.swift @@ -32,7 +32,7 @@ struct NotificationRow: View { .frame(width: 40, height: 40) .cornerRadius(8) VStack(alignment: .leading) { - Text(notification.message) + Text(notification.message ?? "") .font(.body) if let timeStamp = notification.created { Text(dateString(from: timeStamp)) diff --git a/openHAB/OpenHABNotification.swift b/openHAB/OpenHABNotification.swift index 2862a9d2..cab69b02 100644 --- a/openHAB/OpenHABNotification.swift +++ b/openHAB/OpenHABNotification.swift @@ -12,13 +12,12 @@ import Foundation class OpenHABNotification: NSObject { - var message = "" + var message: String? var created: Date? - var icon = "" - var severity = "" + var icon: String? + var severity: String? var id = "" - - init(message: String = "", created: Date? = nil, icon: String = "", severity: String = "", id: String = "") { + init(message: String? = nil, created: Date? = nil, icon: String? = nil, severity: String? = nil, id: String = "") { self.message = message self.created = created self.icon = icon @@ -51,7 +50,7 @@ class OpenHABNotification: NSObject { extension OpenHABNotification { public struct CodingData: Decodable { let id: String - let message: String + let message: String? let v: Int let created: Date?