refactor(ios): require bridge stable ID
This commit is contained in:
@@ -115,7 +115,11 @@ final class BridgeConnectionController {
|
|||||||
|
|
||||||
self.didAutoConnect = true
|
self.didAutoConnect = true
|
||||||
let endpoint = NWEndpoint.hostPort(host: NWEndpoint.Host(manualHost), port: port)
|
let endpoint = NWEndpoint.hostPort(host: NWEndpoint.Host(manualHost), port: port)
|
||||||
self.startAutoConnect(endpoint: endpoint, bridgeStableID: nil, token: token, instanceId: instanceId)
|
self.startAutoConnect(
|
||||||
|
endpoint: endpoint,
|
||||||
|
bridgeStableID: BridgeEndpointID.stableID(endpoint),
|
||||||
|
token: token,
|
||||||
|
instanceId: instanceId)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,7 +181,7 @@ final class BridgeConnectionController {
|
|||||||
|
|
||||||
private func startAutoConnect(
|
private func startAutoConnect(
|
||||||
endpoint: NWEndpoint,
|
endpoint: NWEndpoint,
|
||||||
bridgeStableID: String?,
|
bridgeStableID: String,
|
||||||
token: String,
|
token: String,
|
||||||
instanceId: String)
|
instanceId: String)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -204,13 +204,13 @@ final class NodeAppModel {
|
|||||||
|
|
||||||
func connectToBridge(
|
func connectToBridge(
|
||||||
endpoint: NWEndpoint,
|
endpoint: NWEndpoint,
|
||||||
bridgeStableID: String? = nil,
|
bridgeStableID: String,
|
||||||
hello: BridgeHello)
|
hello: BridgeHello)
|
||||||
{
|
{
|
||||||
self.bridgeTask?.cancel()
|
self.bridgeTask?.cancel()
|
||||||
self.bridgeServerName = nil
|
self.bridgeServerName = nil
|
||||||
self.bridgeRemoteAddress = nil
|
self.bridgeRemoteAddress = nil
|
||||||
let id = (bridgeStableID ?? "").trimmingCharacters(in: .whitespacesAndNewlines)
|
let id = bridgeStableID.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
self.connectedBridgeID = id.isEmpty ? BridgeEndpointID.stableID(endpoint) : id
|
self.connectedBridgeID = id.isEmpty ? BridgeEndpointID.stableID(endpoint) : id
|
||||||
self.voiceWakeSyncTask?.cancel()
|
self.voiceWakeSyncTask?.cancel()
|
||||||
self.voiceWakeSyncTask = nil
|
self.voiceWakeSyncTask = nil
|
||||||
|
|||||||
@@ -500,7 +500,7 @@ struct SettingsTab: View {
|
|||||||
|
|
||||||
self.appModel.connectToBridge(
|
self.appModel.connectToBridge(
|
||||||
endpoint: endpoint,
|
endpoint: endpoint,
|
||||||
bridgeStableID: nil,
|
bridgeStableID: BridgeEndpointID.stableID(endpoint),
|
||||||
hello: BridgeHello(
|
hello: BridgeHello(
|
||||||
nodeId: self.instanceId,
|
nodeId: self.instanceId,
|
||||||
displayName: self.displayName,
|
displayName: self.displayName,
|
||||||
|
|||||||
Reference in New Issue
Block a user