File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed
Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -139,12 +139,29 @@ final class AnalyticsServicesManager {
139139
140140 // MARK: - Loop Events
141141
142+ func pumpWasRemoved( ) {
143+ logEvent ( " Pump Removed " )
144+ }
145+
146+ func pumpWasAdded( identifier: String ) {
147+ logEvent ( " Pump Added " , withProperties: [ " identifier " : identifier] )
148+ }
149+
150+ func cgmWasRemoved( ) {
151+ logEvent ( " CGM Removed " )
152+ }
153+
154+ func cgmWasAdded( identifier: String ) {
155+ logEvent ( " CGM Added " , withProperties: [ " identifier " : identifier] )
156+ }
157+
158+
142159 func didAddCarbsFromWatch( ) {
143160 logEvent ( " Carb entry created " , withProperties: [ " source " : " Watch " ] , outOfSession: true )
144161 }
145162
146163 func didRetryBolus( ) {
147- logEvent ( " Bolus Retry " , outOfSession : true )
164+ logEvent ( " Bolus Retry " )
148165 }
149166
150167 func didSetBolusFromWatch( _ units: Double ) {
Original file line number Diff line number Diff line change @@ -94,6 +94,15 @@ final class DeviceDataManager {
9494 didSet {
9595 dispatchPrecondition ( condition: . onQueue( . main) )
9696 setupCGM ( )
97+
98+ if cgmManager? . managerIdentifier != oldValue? . managerIdentifier {
99+ if let cgmManager = cgmManager {
100+ analyticsServicesManager. cgmWasAdded ( identifier: cgmManager. managerIdentifier)
101+ } else {
102+ analyticsServicesManager. cgmWasRemoved ( )
103+ }
104+ }
105+
97106 NotificationCenter . default. post ( name: . CGMManagerChanged, object: self , userInfo: nil )
98107 rawCGMManager = cgmManager? . rawValue
99108 UserDefaults . appGroup? . clearLegacyCGMManagerRawValue ( )
@@ -114,6 +123,14 @@ final class DeviceDataManager {
114123 cgmManager = nil
115124 }
116125
126+ if pumpManager? . managerIdentifier != oldValue? . managerIdentifier {
127+ if let pumpManager = pumpManager {
128+ analyticsServicesManager. pumpWasAdded ( identifier: pumpManager. managerIdentifier)
129+ } else {
130+ analyticsServicesManager. pumpWasRemoved ( )
131+ }
132+ }
133+
117134 setupPump ( )
118135
119136 NotificationCenter . default. post ( name: . PumpManagerChanged, object: self , userInfo: nil )
You can’t perform that action at this time.
0 commit comments