@@ -10,11 +10,16 @@ import os.log
10
10
import Foundation
11
11
import LoopKit
12
12
import LoopKitUI
13
+ import TidepoolSupport
13
14
14
15
class PluginManager {
15
16
let pluginBundles : [ Bundle ]
16
17
17
18
private let log = OSLog ( category: " PluginManager " )
19
+
20
+ private var selectedProduct : TidepoolSupport . Product {
21
+ TidepoolSupport . Product ( rawValue: UserDefaults . appGroup? . productSelection ?? " none " ) ?? . none
22
+ }
18
23
19
24
public init ( pluginsURL: URL ? = Bundle . main. privateFrameworksURL) {
20
25
var bundles = [ Bundle] ( )
@@ -64,14 +69,18 @@ class PluginManager {
64
69
}
65
70
66
71
var availablePumpManagers : [ PumpManagerDescriptor ] {
67
- return pluginBundles. compactMap ( { ( bundle) -> PumpManagerDescriptor ? in
68
- guard let title = bundle. object ( forInfoDictionaryKey: LoopPluginBundleKey . pumpManagerDisplayName. rawValue) as? String ,
69
- let identifier = bundle. object ( forInfoDictionaryKey: LoopPluginBundleKey . pumpManagerIdentifier. rawValue) as? String else {
70
- return nil
71
- }
72
-
73
- return PumpManagerDescriptor ( identifier: identifier, localizedTitle: title)
74
- } )
72
+ if selectedProduct. maskDevices {
73
+ return [ ]
74
+ } else {
75
+ return pluginBundles. compactMap ( { ( bundle) -> PumpManagerDescriptor ? in
76
+ guard let title = bundle. object ( forInfoDictionaryKey: LoopPluginBundleKey . pumpManagerDisplayName. rawValue) as? String ,
77
+ let identifier = bundle. object ( forInfoDictionaryKey: LoopPluginBundleKey . pumpManagerIdentifier. rawValue) as? String else {
78
+ return nil
79
+ }
80
+
81
+ return PumpManagerDescriptor ( identifier: identifier, localizedTitle: title)
82
+ } )
83
+ }
75
84
}
76
85
77
86
func getCGMManagerTypeByIdentifier( _ identifier: String ) -> CGMManagerUI . Type ? {
@@ -100,14 +109,18 @@ class PluginManager {
100
109
}
101
110
102
111
var availableCGMManagers : [ CGMManagerDescriptor ] {
103
- return pluginBundles. compactMap ( { ( bundle) -> CGMManagerDescriptor ? in
104
- guard let title = bundle. object ( forInfoDictionaryKey: LoopPluginBundleKey . cgmManagerDisplayName. rawValue) as? String ,
105
- let identifier = bundle. object ( forInfoDictionaryKey: LoopPluginBundleKey . cgmManagerIdentifier. rawValue) as? String else {
106
- return nil
107
- }
108
-
109
- return CGMManagerDescriptor ( identifier: identifier, localizedTitle: title)
110
- } )
112
+ if selectedProduct. maskDevices {
113
+ return [ ]
114
+ } else {
115
+ return pluginBundles. compactMap ( { ( bundle) -> CGMManagerDescriptor ? in
116
+ guard let title = bundle. object ( forInfoDictionaryKey: LoopPluginBundleKey . cgmManagerDisplayName. rawValue) as? String ,
117
+ let identifier = bundle. object ( forInfoDictionaryKey: LoopPluginBundleKey . cgmManagerIdentifier. rawValue) as? String else {
118
+ return nil
119
+ }
120
+
121
+ return CGMManagerDescriptor ( identifier: identifier, localizedTitle: title)
122
+ } )
123
+ }
111
124
}
112
125
113
126
func getServiceTypeByIdentifier( _ identifier: String ) -> ServiceUI . Type ? {
0 commit comments