File tree Expand file tree Collapse file tree 2 files changed +20
-10
lines changed Expand file tree Collapse file tree 2 files changed +20
-10
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ final class DeviceDataManager {
86
86
87
87
public private( set) var displayGlucosePreference : DisplayGlucosePreference
88
88
89
- var onlyAllowSimulators : Bool = false
89
+ var deviceWhitelist = DeviceWhitelist ( )
90
90
91
91
// MARK: - CGM
92
92
@@ -465,11 +465,11 @@ final class DeviceDataManager {
465
465
var pumpManagers = pluginManager. availablePumpManagers + availableStaticPumpManagers
466
466
467
467
pumpManagers = pumpManagers. filter ( { pumpManager in
468
- if onlyAllowSimulators {
469
- return pumpManager. identifier == " MockPumpManager "
470
- } else {
468
+ guard !deviceWhitelist. pumpDevices. isEmpty else {
471
469
return true
472
470
}
471
+
472
+ return deviceWhitelist. pumpDevices. contains ( pumpManager. identifier)
473
473
} )
474
474
475
475
return pumpManagers
@@ -585,11 +585,11 @@ final class DeviceDataManager {
585
585
}
586
586
587
587
availableCGMManagers = availableCGMManagers. filter ( { cgmManager in
588
- if onlyAllowSimulators {
589
- return cgmManager. identifier == " MockCGMManager "
590
- } else {
588
+ guard !deviceWhitelist. cgmDevices. isEmpty else {
591
589
return true
592
590
}
591
+
592
+ return deviceWhitelist. cgmDevices. contains ( cgmManager. identifier)
593
593
} )
594
594
595
595
return availableCGMManagers
Original file line number Diff line number Diff line change @@ -220,9 +220,7 @@ class LoopAppManager: NSObject {
220
220
servicesManager: deviceDataManager. servicesManager,
221
221
alertIssuer: alertManager)
222
222
223
- if supportManager. availableSupports. contains ( where: { $0. onlyAllowSimulatorDevices } ) {
224
- deviceDataManager. onlyAllowSimulators = true
225
- }
223
+ setWhitelistedDevices ( )
226
224
227
225
onboardingManager = OnboardingManager ( pluginManager: pluginManager,
228
226
bluetoothProvider: bluetoothStateManager,
@@ -401,6 +399,18 @@ class LoopAppManager: NSObject {
401
399
}
402
400
403
401
// MARK: - Private
402
+
403
+ private func setWhitelistedDevices( ) {
404
+ var whitelistedCGMs : Set < String > = [ ]
405
+ var whitelistedPumps : Set < String > = [ ]
406
+
407
+ supportManager. availableSupports. forEach {
408
+ $0. deviceIdentifierWhitelist. cgmDevices. forEach ( { whitelistedCGMs. insert ( $0) } )
409
+ $0. deviceIdentifierWhitelist. pumpDevices. forEach ( { whitelistedPumps. insert ( $0) } )
410
+ }
411
+
412
+ deviceDataManager. deviceWhitelist = DeviceWhitelist ( cgmDevices: Array ( whitelistedCGMs) , pumpDevices: Array ( whitelistedPumps) )
413
+ }
404
414
405
415
private func isProtectedDataAvailable( ) -> Bool {
406
416
let fileManager = FileManager . default
You can’t perform that action at this time.
0 commit comments