Skip to content

Commit

Permalink
OpenHABOptions label as optional string
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Bert <[email protected]>
  • Loading branch information
timbms committed Oct 31, 2024
1 parent 1575a8c commit 358aaee
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion OpenHABCore/Sources/OpenHABCore/Model/OpenHABOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ import Foundation

public class OpenHABOptions: Decodable {
public var value = ""
public var label = ""
public var label: String?
}
2 changes: 1 addition & 1 deletion OpenHABCore/Sources/OpenHABCore/Model/OpenHABWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public class OpenHABWidget: NSObject, MKAnnotation, Identifiable {
if mappings.isEmpty, let commandOptions = item?.commandDescription?.commandOptions {
commandOptions.map { OpenHABWidgetMapping(command: $0.command, label: $0.label ?? "") }
} else if mappings.isEmpty, let stateOptions = item?.stateDescription?.options {
stateOptions.map { OpenHABWidgetMapping(command: $0.value, label: $0.label) }
stateOptions.map { OpenHABWidgetMapping(command: $0.value, label: $0.label ?? "") }
} else {
mappings
}
Expand Down
2 changes: 1 addition & 1 deletion openHABWatch/Model/ObservableOpenHABWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class ObservableOpenHABWidget: NSObject, MKAnnotation, Identifiable, ObservableO
if mappings.isEmpty, let commandOptions = item?.commandDescription?.commandOptions {
commandOptions.map { OpenHABWidgetMapping(command: $0.command, label: $0.label ?? "") }
} else if mappings.isEmpty, let stateOptions = item?.stateDescription?.options {
stateOptions.map { OpenHABWidgetMapping(command: $0.value, label: $0.label) }
stateOptions.map { OpenHABWidgetMapping(command: $0.value, label: $0.label ?? "") }
} else {
mappings
}
Expand Down

0 comments on commit 358aaee

Please sign in to comment.