Skip to content

Commit

Permalink
Make sure to support demo mode when initing the tracker
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Cunningham <[email protected]>
  • Loading branch information
digitaldan committed Sep 18, 2024
1 parent f9e1eea commit 3ece9f0
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions openHAB/OpenHABRootViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,20 +120,30 @@ class OpenHABRootViewController: UIViewController {
}

fileprivate func setupTracker() {
Publishers.CombineLatest(
Publishers.CombineLatest3(
Preferences.$localUrl,
Preferences.$remoteUrl
Preferences.$remoteUrl,
Preferences.$demomode
)
.sink { (localUrl, remoteUrl) in
let connection1 = ConnectionObject(
url: localUrl,
priority: 0
)
let connection2 = ConnectionObject(
url: remoteUrl,
priority: 1
)
NetworkTracker.shared.startTracking(connectionObjects: [connection1, connection2])
.sink { (localUrl, remoteUrl, demomode) in
if demomode {
NetworkTracker.shared.startTracking(connectionObjects: [
ConnectionObject(
url: "https://demo.openhab.org",
priority: 0
)
])
} else {
let connection1 = ConnectionObject(
url: localUrl,
priority: 0
)
let connection2 = ConnectionObject(
url: remoteUrl,
priority: 1
)
NetworkTracker.shared.startTracking(connectionObjects: [connection1, connection2])
}
}
.store(in: &cancellables)

Expand Down

0 comments on commit 3ece9f0

Please sign in to comment.