Skip to content

Commit dd5553e

Browse files
authored
Optional label in OpenHABOptions (#850)
* OpenHABOptions label as optional string Signed-off-by: Tim Bert <5411131+timbms@users.noreply.github.com>
1 parent dfc0292 commit dd5553e

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

OpenHABCore/Sources/OpenHABCore/Model/OpenHABOptions.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ import Foundation
1313

1414
public class OpenHABOptions: Decodable {
1515
public var value = ""
16-
public var label = ""
16+
public var label: String?
1717
}

OpenHABCore/Sources/OpenHABCore/Model/OpenHABWidget.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public class OpenHABWidget: NSObject, MKAnnotation, Identifiable {
119119
if mappings.isEmpty, let commandOptions = item?.commandDescription?.commandOptions {
120120
commandOptions.map { OpenHABWidgetMapping(command: $0.command, label: $0.label ?? "") }
121121
} else if mappings.isEmpty, let stateOptions = item?.stateDescription?.options {
122-
stateOptions.map { OpenHABWidgetMapping(command: $0.value, label: $0.label) }
122+
stateOptions.map { OpenHABWidgetMapping(command: $0.value, label: $0.label ?? "") }
123123
} else {
124124
mappings
125125
}

openHABWatch/Model/ObservableOpenHABWidget.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class ObservableOpenHABWidget: NSObject, MKAnnotation, Identifiable, ObservableO
9797
if mappings.isEmpty, let commandOptions = item?.commandDescription?.commandOptions {
9898
commandOptions.map { OpenHABWidgetMapping(command: $0.command, label: $0.label ?? "") }
9999
} else if mappings.isEmpty, let stateOptions = item?.stateDescription?.options {
100-
stateOptions.map { OpenHABWidgetMapping(command: $0.value, label: $0.label) }
100+
stateOptions.map { OpenHABWidgetMapping(command: $0.value, label: $0.label ?? "") }
101101
} else {
102102
mappings
103103
}

0 commit comments

Comments
 (0)