Skip to content

Commit 504d967

Browse files
committed
Backport openapigen-swiftui to develop to narrow gap
Signed-off-by: Tim Müller-Seydlitz <timbms@gmail.com>
1 parent ae95d21 commit 504d967

4 files changed

Lines changed: 18 additions & 12 deletions

File tree

OpenHABCore/Sources/OpenHABCore/Model/OpenHABPage.swift

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,21 @@ public class OpenHABPage: NSObject, @unchecked Sendable {
2727
self.title = title
2828
self.link = link
2929
self.leaf = leaf
30-
var tempWidgets = [OpenHABWidget]()
31-
tempWidgets.flatten(widgets)
32-
self.widgets = tempWidgets
33-
for widget in self.widgets {
30+
self.icon = icon
31+
var flattened = [OpenHABWidget]()
32+
flattened.flatten(widgets)
33+
self.widgets = flattened
34+
35+
decorateWithSendCommand(self.widgets)
36+
}
37+
38+
private func decorateWithSendCommand(_ widgets: [OpenHABWidget]) {
39+
for widget in widgets {
3440
widget.sendCommand = { [weak self] item, command in
3541
self?.sendCommand(item, commandToSend: command)
3642
}
43+
decorateWithSendCommand(widget.widgets)
3744
}
38-
self.icon = icon
3945
}
4046

4147
private func sendCommand(_ item: OpenHABItem?, commandToSend command: String?) {

OpenHABCore/Sources/OpenHABCore/Util/BonjourService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ public final class BonjourService: NSObject, BonjourServiceProtocol, NetServiceB
356356
logger.info("Found service: \(service.name, privacy: .public) type: \(service.type, privacy: .public)")
357357

358358
let alreadyExists = state.withLockUnchecked { state in
359-
state.discoveredServices.contains(where: { $0 === service })
359+
state.discoveredServices.contains { $0 === service }
360360
}
361361

362362
if alreadyExists {

OpenHABCore/Tests/OpenHABCoreTests/CertificateStoreTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ import Foundation
1414
import os.log
1515
import Testing
1616

17+
// MARK: - Test Errors
18+
19+
enum CertificateStoreTestError: Error {
20+
case resourceNotFound(String)
21+
}
22+
1723
@Suite("CertificateStore Tests", .serialized)
1824
struct CertificateStoreTests {
1925
// Helper to load the bundled test certificate data
@@ -148,9 +154,3 @@ struct CertificateStoreTests {
148154
try? FileManager.default.removeItem(at: tempPath)
149155
}
150156
}
151-
152-
// MARK: - Test Errors
153-
154-
enum CertificateStoreTestError: Error {
155-
case resourceNotFound(String)
156-
}

test.out

-13.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)