fix(ios): stabilize voice wake + bridge UI
This commit is contained in:
@@ -5,9 +5,10 @@ import Network
|
||||
@MainActor
|
||||
final class BridgeDiscoveryModel: ObservableObject {
|
||||
struct DiscoveredBridge: Identifiable, Equatable {
|
||||
var id: String { self.debugID }
|
||||
var id: String { self.stableID }
|
||||
var name: String
|
||||
var endpoint: NWEndpoint
|
||||
var stableID: String
|
||||
var debugID: String
|
||||
}
|
||||
|
||||
@@ -54,7 +55,8 @@ final class BridgeDiscoveryModel: ObservableObject {
|
||||
return DiscoveredBridge(
|
||||
name: decodedName,
|
||||
endpoint: result.endpoint,
|
||||
debugID: Self.prettyEndpointDebugID(result.endpoint))
|
||||
stableID: BridgeEndpointID.stableID(result.endpoint),
|
||||
debugID: BridgeEndpointID.prettyDescription(result.endpoint))
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
@@ -73,8 +75,4 @@ final class BridgeDiscoveryModel: ObservableObject {
|
||||
self.bridges = []
|
||||
self.statusText = "Stopped"
|
||||
}
|
||||
|
||||
private static func prettyEndpointDebugID(_ endpoint: NWEndpoint) -> String {
|
||||
BonjourEscapes.decode(String(describing: endpoint))
|
||||
}
|
||||
}
|
||||
|
||||
19
apps/ios/Sources/Bridge/BridgeEndpointID.swift
Normal file
19
apps/ios/Sources/Bridge/BridgeEndpointID.swift
Normal file
@@ -0,0 +1,19 @@
|
||||
import ClawdisKit
|
||||
import Foundation
|
||||
import Network
|
||||
|
||||
enum BridgeEndpointID {
|
||||
static func stableID(_ endpoint: NWEndpoint) -> String {
|
||||
switch endpoint {
|
||||
case let .service(name, type, domain, _):
|
||||
// Keep this stable across encode/decode differences; use raw service tuple.
|
||||
"\(type)|\(domain)|\(name)"
|
||||
default:
|
||||
String(describing: endpoint)
|
||||
}
|
||||
}
|
||||
|
||||
static func prettyDescription(_ endpoint: NWEndpoint) -> String {
|
||||
BonjourEscapes.decode(String(describing: endpoint))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user