Skip to content

Commit

Permalink
Optional label in OpenHABOptions (#850)
Browse files Browse the repository at this point in the history
* OpenHABOptions label as optional string

Signed-off-by: Tim Bert <5411131+timbms@users.noreply.github.com>
  • Loading branch information
timbms authored Oct 31, 2024
1 parent dfc0292 commit dd5553e
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 dd5553e

Please sign in to comment.