mirror of
https://github.com/AU-COVIDSafe/mobile-ios.git
synced 2025-04-30 02:15:19 +00:00
COVIDSafe code from version 1.10 (#20)
This commit is contained in:
parent
3b1d8fa3f4
commit
4ddb77535e
37 changed files with 2681 additions and 328 deletions
|
@ -43,13 +43,16 @@ class CentralController: NSObject {
|
|||
|
||||
public init(queue: DispatchQueue) {
|
||||
self.queue = queue
|
||||
|
||||
super.init()
|
||||
|
||||
NotificationCenter.default.addObserver(
|
||||
forName: UIApplication.didReceiveMemoryWarningNotification,
|
||||
object: nil,
|
||||
queue: .main) { [weak self] notification in
|
||||
self?.cleanupScannedPeripherals()
|
||||
self?.queue.async {
|
||||
self?.cleanupScannedPeripherals()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,11 +188,11 @@ extension CentralController: CBCentralManagerDelegate {
|
|||
central.connect(recoveredPeripheral)
|
||||
}
|
||||
|
||||
// cant cancel peripheral when BL OFF
|
||||
for cleanupPeripheral in cleanupPeripherals {
|
||||
// can't cancel peripheral when BL OFF
|
||||
for cleanupPeripheral in self.cleanupPeripherals {
|
||||
central.cancelPeripheralConnection(cleanupPeripheral)
|
||||
}
|
||||
cleanupPeripherals = []
|
||||
self.cleanupPeripherals = []
|
||||
|
||||
central.scanForPeripherals(withServices: [BluetraceConfig.BluetoothServiceID], options:nil)
|
||||
logPeripheralsCount(description: "Update state powerOn")
|
||||
|
@ -482,7 +485,7 @@ extension CentralController: CBPeripheralDelegate {
|
|||
|
||||
// regularly cleanup and close pending connections
|
||||
if (abs(lastCleanedScannedPeripherals.timeIntervalSince(Date())) > BluetraceConfig.CentralScanInterval) {
|
||||
cleanupScannedPeripherals()
|
||||
cleanupScannedPeripherals()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue