File tree Expand file tree Collapse file tree 3 files changed +22
-14
lines changed Expand file tree Collapse file tree 3 files changed +22
-14
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 {
471
- return true
468
+ guard !deviceWhitelist. pumpDevices. isEmpty else {
469
+ return false
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 {
591
- return true
588
+ guard !deviceWhitelist. cgmDevices. isEmpty else {
589
+ return false
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
Original file line number Diff line number Diff line change @@ -39,7 +39,6 @@ class SupportManagerTests: XCTestCase {
39
39
required init ? ( rawState: RawStateValue ) { super. init ( ) }
40
40
var rawState : RawStateValue = [ : ]
41
41
42
- let onlyAllowSimulatorDevices : Bool = false
43
42
let showsDeleteTestDataUI : Bool = true
44
43
45
44
func getScenarios( from scenarioURLs: [ URL ] ) -> [ LoopScenario ] { [ ] }
@@ -55,7 +54,6 @@ class SupportManagerTests: XCTestCase {
55
54
required init ? ( rawState: RawStateValue ) { super. init ( ) }
56
55
var rawState : RawStateValue = [ : ]
57
56
58
- let onlyAllowSimulatorDevices : Bool = false
59
57
let showsDeleteTestDataUI : Bool = true
60
58
61
59
func getScenarios( from scenarioURLs: [ URL ] ) -> [ LoopScenario ] { [ ] }
You can’t perform that action at this time.
0 commit comments