Skip to content

Commit

Permalink
Fixes broken notification view with newer notifications (openhab#815)
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
  • Loading branch information
digitaldan authored Sep 14, 2024
1 parent 16eee55 commit a0b2c22
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion openHAB/NotificationsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
11 changes: 5 additions & 6 deletions openHAB/OpenHABNotification.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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?

Expand Down

0 comments on commit a0b2c22

Please sign in to comment.