@@ -136,7 +136,7 @@ final class StatusTableViewController: UITableViewController, UIGestureRecognize
136136 needsRefresh = false
137137 reloading = true
138138
139- tableView. reloadSections ( NSIndexSet ( indexesInRange: NSMakeRange ( Section . Pump . rawValue, Section . count - Section. Pump . rawValue)
139+ tableView. reloadSections ( NSIndexSet ( indexesInRange: NSMakeRange ( Section . Sensor . rawValue, Section . count - Section. Sensor . rawValue)
140140 ) , withRowAnimation: visible ? . Automatic : . None)
141141
142142 let calendar = NSCalendar . currentCalendar ( )
@@ -171,14 +171,13 @@ final class StatusTableViewController: UITableViewController, UIGestureRecognize
171171 }
172172
173173 dispatch_group_enter ( reloadGroup)
174- dataManager. loopManager. getLoopStatus { ( predictedGlucose, reflectedGlucose , recommendedTempBasal, lastTempBasal, lastLoopCompleted, insulinOnBoard , error) -> Void in
174+ dataManager. loopManager. getLoopStatus { ( predictedGlucose, _ , recommendedTempBasal, lastTempBasal, lastLoopCompleted, _ , error) -> Void in
175175 if error != nil {
176176 self . needsRefresh = true
177177 }
178178
179179 self . charts. predictedGlucoseValues = predictedGlucose ?? [ ]
180180 self . recommendedTempBasal = recommendedTempBasal
181- self . reflectedGlucose = reflectedGlucose
182181 self . lastTempBasal = lastTempBasal
183182 self . lastLoopCompleted = lastLoopCompleted
184183
@@ -266,10 +265,9 @@ final class StatusTableViewController: UITableViewController, UIGestureRecognize
266265 private enum Section : Int {
267266 case Charts = 0
268267 case Status
269- case Pump
270268 case Sensor
271269
272- static let count = 4
270+ static let count = 3
273271 }
274272
275273 // MARK: - Chart Section Data
@@ -289,15 +287,12 @@ final class StatusTableViewController: UITableViewController, UIGestureRecognize
289287
290288 private enum StatusRow : Int {
291289 case RecommendedBasal = 0
292- case ReflectedGlucose
293290
294- static let count = 2
291+ static let count = 1
295292 }
296293
297294 private var recommendedTempBasal : LoopDataManager . TempBasalRecommendation ?
298295
299- private var reflectedGlucose : [ GlucoseValue ] ?
300-
301296 private var lastTempBasal : DoseEntry ? {
302297 didSet {
303298 guard let scheduledBasal = dataManager. basalRateSchedule? . between ( NSDate ( ) , NSDate ( ) ) . first else {
@@ -372,12 +367,6 @@ final class StatusTableViewController: UITableViewController, UIGestureRecognize
372367
373368 // MARK: - Pump/Sensor Section Data
374369
375- private enum PumpRow : Int {
376- case InsulinOnBoard = 0
377-
378- static let count = 1
379- }
380-
381370 private enum SensorRow : Int {
382371 case State
383372
@@ -424,8 +413,6 @@ final class StatusTableViewController: UITableViewController, UIGestureRecognize
424413 return ChartRow . count
425414 case . Status:
426415 return StatusRow . count
427- case . Pump:
428- return PumpRow . count
429416 case . Sensor:
430417 return SensorRow . count
431418 }
@@ -494,35 +481,6 @@ final class StatusTableViewController: UITableViewController, UIGestureRecognize
494481 } else {
495482 cell. accessoryView = nil
496483 }
497- case . ReflectedGlucose:
498- cell. textLabel? . text = " Predicted 30m ago "
499-
500- if let startGlucose = reflectedGlucose? . first, let endGlucose = reflectedGlucose? . last, let currentGlucose = self . dataManager. glucoseStore? . latestGlucose {
501- let startValue = Int ( startGlucose. quantity. doubleValueForUnit ( charts. glucoseUnit) )
502- let predictedValue = Int ( endGlucose. quantity. doubleValueForUnit ( charts. glucoseUnit) )
503- let currentValue = Int ( currentGlucose. quantity. doubleValueForUnit ( charts. glucoseUnit) )
504-
505- cell. detailTextLabel? . text = " \( startValue) → \( predictedValue) @ \( timeFormatter. stringFromDate ( endGlucose. startDate) ) \( currentValue - predictedValue) "
506- } else {
507- cell. detailTextLabel? . text = emptyValueString
508- }
509- }
510-
511- return cell
512- case . Pump:
513- let cell = tableView. dequeueReusableCellWithIdentifier ( UITableViewCell . className, forIndexPath: indexPath)
514- cell. selectionStyle = . None
515-
516- switch PumpRow ( rawValue: indexPath. row) ! {
517- case . InsulinOnBoard:
518- cell. textLabel? . text = NSLocalizedString ( " Bolus Insulin on Board " , comment: " The title of the cell containing the estimated amount of active bolus insulin in the body " )
519-
520- if let iob = dataManager. latestPumpStatusFromMySentry? . iob {
521- let numberValue = NSNumber ( double: iob) . descriptionWithLocale ( locale)
522- cell. detailTextLabel? . text = " \( numberValue) Units "
523- } else {
524- cell. detailTextLabel? . text = emptyValueString
525- }
526484 }
527485
528486 return cell
@@ -552,7 +510,7 @@ final class StatusTableViewController: UITableViewController, UIGestureRecognize
552510 case . IOB, . Dose, . COB:
553511 return 85
554512 }
555- case . Status, . Pump , . Sensor:
513+ case . Status, . Sensor:
556514 return UITableViewAutomaticDimension
557515 }
558516 }
@@ -562,13 +520,6 @@ final class StatusTableViewController: UITableViewController, UIGestureRecognize
562520 case . Charts:
563521 switch ChartRow ( rawValue: indexPath. row) ! {
564522 case . Glucose:
565- // if let URL = NSURL(string: "dexcomcgm://") where UIApplication.sharedApplication().canOpenURL(URL) {
566- // UIApplication.sharedApplication().openURL(URL)
567- // }
568- // else if let URL = NSURL(string: "dexcomshare://") where UIApplication.sharedApplication().canOpenURL(URL) {
569- // UIApplication.sharedApplication().openURL(URL)
570- // }
571-
572523 performSegueWithIdentifier ( PredictionTableViewController . className, sender: indexPath)
573524 case . IOB, . Dose:
574525 performSegueWithIdentifier ( InsulinDeliveryTableViewController . className, sender: indexPath)
@@ -596,15 +547,11 @@ final class StatusTableViewController: UITableViewController, UIGestureRecognize
596547 }
597548 }
598549 }
599- case . ReflectedGlucose:
600- break
601550 }
602551 case . Sensor:
603552 if let URL = NSURL ( string: " dexcomcgm:// " ) {
604553 UIApplication . sharedApplication ( ) . openURL ( URL)
605554 }
606- case . Pump:
607- break
608555 }
609556 }
610557
@@ -744,7 +691,21 @@ final class StatusTableViewController: UITableViewController, UIGestureRecognize
744691
745692 @IBOutlet var loopCompletionHUD : LoopCompletionHUDView !
746693
747- @IBOutlet var glucoseHUD : GlucoseHUDView !
694+ @IBOutlet var glucoseHUD : GlucoseHUDView ! {
695+ didSet {
696+ let tapGestureRecognizer = UITapGestureRecognizer ( target: self , action: #selector( openCGMApp ( _: ) ) )
697+ glucoseHUD. addGestureRecognizer ( tapGestureRecognizer)
698+ }
699+ }
700+
701+ @objc private func openCGMApp( _: AnyObject ) {
702+ if let URL = NSURL ( string: " dexcomcgm:// " ) where UIApplication . sharedApplication ( ) . canOpenURL ( URL) {
703+ UIApplication . sharedApplication ( ) . openURL ( URL)
704+ }
705+ else if let URL = NSURL ( string: " dexcomshare:// " ) where UIApplication . sharedApplication ( ) . canOpenURL ( URL) {
706+ UIApplication . sharedApplication ( ) . openURL ( URL)
707+ }
708+ }
748709
749710 @IBOutlet var basalRateHUD : BasalRateHUDView !
750711
0 commit comments