Skip to content

Linux + iPhone Continuity / iMessage / SMS

more con

Zack Barteld518f91ae405
diff --git a/apple/Tether/ViewModels/TetherViewModel.swift b/apple/Tether/ViewModels/TetherViewModel.swift
index 479c9fc..45743de 100644
--- a/apple/Tether/ViewModels/TetherViewModel.swift
+++ b/apple/Tether/ViewModels/TetherViewModel.swift
@@ -432,10 +432,21 @@ final class TetherViewModel {
let fingerprint = certificateManager.knownHosts.keys.first else { return }
let matchingHosts = discovery.hosts.filter { $0.fingerprint == fingerprint }
- guard matchingHosts.count == 1 else { return }
+ let targetHost: DiscoveredHost?
+
+ if matchingHosts.count == 1 {
+ targetHost = matchingHosts[0]
+ } else if discovery.hosts.count == 1 {
+ let soleHost = discovery.hosts[0]
+ targetHost = soleHost.fingerprint.isEmpty || soleHost.fingerprint == fingerprint ? soleHost : nil
+ } else {
+ targetHost = nil
+ }
+
+ guard let targetHost else { return }
autoConnectingFingerprint = fingerprint
- connectTo(host: matchingHosts[0])
+ connectTo(host: targetHost)
}
private func suspendForBackground() {