more fixes

This commit is contained in:
2025-10-21 00:54:43 +02:00
parent 12e8a0e098
commit 678158c302
8 changed files with 139 additions and 15 deletions

View File

@@ -409,6 +409,18 @@ final class TimeSyncManager: NSObject, ObservableObject, UNUserNotificationCente
private func startScanning() {
guard shouldKeepScanning, central.state == .poweredOn else { return }
if isScanning { return }
let connected = central.retrieveConnectedPeripherals(withServices: [timeServiceUUID, fileServiceUUID])
if let restored = connected.first {
statusMessage = "Restoring connection…"
connectionState = .connecting
targetPeripheral = restored
restored.delegate = self
central.connect(restored, options: nil)
shouldKeepScanning = false
return
}
central.scanForPeripherals(withServices: [timeServiceUUID, fileServiceUUID], options: [
CBCentralManagerScanOptionAllowDuplicatesKey: false
])