feat(ios): add discovery debug logs

This commit is contained in:
Peter Steinberger
2025-12-14 04:34:00 +00:00
parent f5a5320f8f
commit 9e80764c2b
4 changed files with 139 additions and 1 deletions

View File

@@ -8,6 +8,7 @@ import SwiftUI
final class BridgeConnectionController: ObservableObject {
@Published private(set) var bridges: [BridgeDiscoveryModel.DiscoveredBridge] = []
@Published private(set) var discoveryStatusText: String = "Idle"
@Published private(set) var discoveryDebugLog: [BridgeDiscoveryModel.DebugLogEntry] = []
private let discovery = BridgeDiscoveryModel()
private weak var appModel: NodeAppModel?
@@ -19,6 +20,8 @@ final class BridgeConnectionController: ObservableObject {
self.appModel = appModel
BridgeSettingsStore.bootstrapPersistence()
self.discovery.setDebugLoggingEnabled(
UserDefaults.standard.bool(forKey: "bridge.discovery.debugLogs"))
self.discovery.$bridges
.sink { [weak self] newValue in
@@ -32,11 +35,18 @@ final class BridgeConnectionController: ObservableObject {
self.discovery.$statusText
.assign(to: &self.$discoveryStatusText)
self.discovery.$debugLog
.assign(to: &self.$discoveryDebugLog)
if startDiscovery {
self.discovery.start()
}
}
func setDiscoveryDebugLoggingEnabled(_ enabled: Bool) {
self.discovery.setDebugLoggingEnabled(enabled)
}
func setScenePhase(_ phase: ScenePhase) {
switch phase {
case .background: