Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
runner authored and runner committed May 31, 2023
2 parents 9fd152c + d4f9512 commit 6afd592
Show file tree
Hide file tree
Showing 195 changed files with 623 additions and 542 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/githubrelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
set_github_release:
runs-on: macos-12
runs-on: macos-13
steps:
- name: checkout
uses: actions/checkout@v3
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: macos-12
if: ${{ github.event.pull_request.draft == false }}
steps:
- uses: maxim-lobanov/[email protected]
- uses: maxim-lobanov/setup-xcode@v1.5.1
with:
xcode-version: latest-stable

Expand All @@ -25,7 +25,6 @@ jobs:
LANG: en_US.UTF-8
LC_ALL: en_US.UTF-8
FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: 60
uses: maierj/fastlane-action@v2.0.1
uses: maierj/fastlane-action@v2.3.0
with:
lane: unittests
skip-tracking: true
1 change: 0 additions & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ opt_in_rules:
- empty_count
- redundant_type_annotation
- trailing_closure
- unused_import
- implicit_return
- multiline_function_chains
- anyobject_protocol
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [Version 2.4.58, Build 1580410536] - 2023-05-31Z

- Implement forceAsItem support for Charts in Sitemaps
- Fixes #689

## [Version 2.4.53, Build 1580410519] - 2022-08-27Z

- Fixes an incompatibility with openHAB 1.x systems
Expand Down
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GEM
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.2.0)
aws-partitions (1.659.0)
aws-partitions (1.660.0)
aws-sdk-core (3.167.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
Expand Down Expand Up @@ -66,7 +66,7 @@ GEM
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.2.6)
fastlane (2.210.1)
fastlane (2.211.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
Expand Down Expand Up @@ -219,4 +219,4 @@ DEPENDENCIES
fastlane-plugin-versioning

BUNDLED WITH
2.3.24
2.3.11
2 changes: 1 addition & 1 deletion OpenHABCore/Sources/OpenHABCore/Model/DataExtension.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
2 changes: 1 addition & 1 deletion OpenHABCore/Sources/OpenHABCore/Model/DataObject.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
2 changes: 1 addition & 1 deletion OpenHABCore/Sources/OpenHABCore/Model/NumberState.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
2 changes: 1 addition & 1 deletion OpenHABCore/Sources/OpenHABCore/Model/OpenHABItem.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
2 changes: 1 addition & 1 deletion OpenHABCore/Sources/OpenHABCore/Model/OpenHABOptions.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
2 changes: 1 addition & 1 deletion OpenHABCore/Sources/OpenHABCore/Model/OpenHABSitemap.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
2 changes: 1 addition & 1 deletion OpenHABCore/Sources/OpenHABCore/Model/OpenHABUiTile.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
12 changes: 8 additions & 4 deletions OpenHABCore/Sources/OpenHABCore/Model/OpenHABWidget.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down Expand Up @@ -91,6 +91,7 @@ public class OpenHABWidget: NSObject, MKAnnotation, Identifiable {
public var text = ""
public var legend: Bool?
public var encoding = ""
public var forceAsItem: Bool?
public var item: OpenHABItem?
public var linkedPage: OpenHABLinkedPage?
public var mappings: [OpenHABWidgetMapping] = []
Expand All @@ -108,7 +109,7 @@ public class OpenHABWidget: NSObject, MKAnnotation, Identifiable {
// Text between square brackets
public var labelValue: String? {
// Swift 5 raw strings
let regex = try? NSRegularExpression(pattern: #"\[(.*?)\]"#, options: [])
let regex = try? NSRegularExpression(pattern: #"\[(.*?)\]"#, options: [.dotMatchesLineSeparators])
guard let match = regex?.firstMatch(in: label, options: [], range: NSRange(location: 0, length: (label as NSString).length)) else { return nil }
guard let range = Range(match.range(at: 1), in: label) else { return nil }
return String(label[range])
Expand Down Expand Up @@ -212,7 +213,7 @@ extension OpenHABWidget.WidgetType: UnknownCaseRepresentable {

extension OpenHABWidget {
// This is an ugly initializer
convenience init(widgetId: String, label: String, icon: String, type: WidgetType, url: String?, period: String?, minValue: Double?, maxValue: Double?, step: Double?, refresh: Int?, height: Double?, isLeaf: Bool?, iconColor: String?, labelColor: String?, valueColor: String?, service: String?, state: String?, text: String?, legend: Bool?, encoding: String?, item: OpenHABItem?, linkedPage: OpenHABLinkedPage?, mappings: [OpenHABWidgetMapping], widgets: [OpenHABWidget], visibility: Bool?, switchSupport: Bool?) {
convenience init(widgetId: String, label: String, icon: String, type: WidgetType, url: String?, period: String?, minValue: Double?, maxValue: Double?, step: Double?, refresh: Int?, height: Double?, isLeaf: Bool?, iconColor: String?, labelColor: String?, valueColor: String?, service: String?, state: String?, text: String?, legend: Bool?, encoding: String?, item: OpenHABItem?, linkedPage: OpenHABLinkedPage?, mappings: [OpenHABWidgetMapping], widgets: [OpenHABWidget], visibility: Bool?, switchSupport: Bool?, forceAsItem: Bool?) {
self.init()
id = widgetId
self.widgetId = widgetId
Expand Down Expand Up @@ -250,6 +251,8 @@ extension OpenHABWidget {
self.step = abs(self.step)
self.visibility = visibility ?? true
self.switchSupport = switchSupport ?? false

self.forceAsItem = forceAsItem
}

convenience init(xml xmlElement: XMLElement) {
Expand Down Expand Up @@ -322,14 +325,15 @@ public extension OpenHABWidget {
let widgets: [OpenHABWidget.CodingData]
let visibility: Bool?
let switchSupport: Bool?
let forceAsItem: Bool?
}
}

// swiftlint:disable line_length
extension OpenHABWidget.CodingData {
var openHABWidget: OpenHABWidget {
let mappedWidgets = widgets.map(\.openHABWidget)
return OpenHABWidget(widgetId: widgetId, label: label, icon: icon, type: type, url: url, period: period, minValue: minValue, maxValue: maxValue, step: step, refresh: refresh, height: height, isLeaf: isLeaf, iconColor: iconColor, labelColor: labelcolor, valueColor: valuecolor, service: service, state: state, text: text, legend: legend, encoding: encoding, item: item?.openHABItem, linkedPage: linkedPage, mappings: mappings, widgets: mappedWidgets, visibility: visibility, switchSupport: switchSupport)
return OpenHABWidget(widgetId: widgetId, label: label, icon: icon, type: type, url: url, period: period, minValue: minValue, maxValue: maxValue, step: step, refresh: refresh, height: height, isLeaf: isLeaf, iconColor: iconColor, labelColor: labelcolor, valueColor: valuecolor, service: service, state: state, text: text, legend: legend, encoding: encoding, item: item?.openHABItem, linkedPage: linkedPage, mappings: mappings, widgets: mappedWidgets, visibility: visibility, switchSupport: switchSupport, forceAsItem: forceAsItem)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
2 changes: 1 addition & 1 deletion OpenHABCore/Sources/OpenHABCore/Util/DoubleExtension.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
8 changes: 5 additions & 3 deletions OpenHABCore/Sources/OpenHABCore/Util/Endpoint.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down Expand Up @@ -114,7 +114,7 @@ public extension Endpoint {
}

// swiftlint:disable:next function_parameter_count
static func chart(rootUrl: String, period: String?, type: OpenHABItem.ItemType?, service: String?, name: String?, legend: Bool?, theme: ChartStyle = .light) -> Endpoint {
static func chart(rootUrl: String, period: String?, type: OpenHABItem.ItemType?, service: String?, name: String?, legend: Bool?, theme: ChartStyle = .light, forceAsItem: Bool?) -> Endpoint {
let random = Int.random(in: 0 ..< 1000)
var endpoint = Endpoint(
baseURL: rootUrl,
Expand All @@ -125,7 +125,9 @@ public extension Endpoint {
]
)

if type == .group {
let forceAsItem = forceAsItem ?? false

if type == .group, !forceAsItem {
endpoint.queryItems.append(URLQueryItem(name: "groups", value: name))
} else {
endpoint.queryItems.append(URLQueryItem(name: "items", value: name))
Expand Down
2 changes: 1 addition & 1 deletion OpenHABCore/Sources/OpenHABCore/Util/Equatable.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
2 changes: 1 addition & 1 deletion OpenHABCore/Sources/OpenHABCore/Util/Future.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
2 changes: 1 addition & 1 deletion OpenHABCore/Sources/OpenHABCore/Util/OSLogExtension.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
2 changes: 1 addition & 1 deletion OpenHABCore/Sources/OpenHABCore/Util/OpenHABLogger.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand All @@ -16,6 +16,7 @@ import Foundation
// The alternative method is explained by jshier in https://github.com/Alamofire/Alamofire/issues/2886#issuecomment-517951747

class OpenHABSessionDelegate: SessionDelegate {
// swiftlint:disable:next large_tuple
typealias ChallengeEvaluation = (disposition: URLSession.AuthChallengeDisposition, credential: URLCredential?, error: AFError?)

var eventMonitor: EventMonitor?
Expand Down
3 changes: 2 additions & 1 deletion OpenHABCore/Sources/OpenHABCore/Util/Preferences.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down Expand Up @@ -91,6 +91,7 @@ public enum Preferences {
@UserDefault("sendCrashReports", defaultValue: false) public static var sendCrashReports: Bool
@UserDefault("sortSitemapsBy", defaultValue: 0) public static var sortSitemapsby: Int
@UserDefault("defaultMainUIPath", defaultValue: "") public static var defaultMainUIPath: String
@UserDefault("alwaysAllowWebRTC", defaultValue: false) public static var alwaysAllowWebRTC: Bool

// MARK: - Private

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
2 changes: 1 addition & 1 deletion OpenHABCore/Sources/OpenHABCore/Util/StringExtension.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
2 changes: 1 addition & 1 deletion OpenHABCore/Tests/OpenHABCoreTests/ItemCacheTests.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
2 changes: 1 addition & 1 deletion OpenHABCore/Tests/OpenHABCoreTests/JSONData.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
2 changes: 1 addition & 1 deletion OpenHABCore/Tests/OpenHABCoreTests/JSONParserTests.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
2 changes: 1 addition & 1 deletion OpenHABCore/Tests/OpenHABCoreTests/MockURLProtocol.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
2 changes: 1 addition & 1 deletion OpenHABCore/Tests/OpenHABCoreTests/NumberStateTests.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
2 changes: 1 addition & 1 deletion OpenHABCore/Tests/OpenHABCoreTests/ParseAsTests.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010-2022 Contributors to the openHAB project
// Copyright (c) 2010-2023 Contributors to the openHAB project
//
// See the NOTICE file(s) distributed with this work for additional
// information.
Expand Down
Loading

0 comments on commit 6afd592

Please sign in to comment.