diff --git a/Cartfile b/Cartfile index 8749fb806b..8644121730 100644 --- a/Cartfile +++ b/Cartfile @@ -1,7 +1,7 @@ -github "loudnate/LoopKit" ~> 0.3.5 +github "loudnate/LoopKit" ~> 0.4.0 github "loudnate/xDripG5" ~> 0.5.0 github "loudnate/SwiftCharts" "loudnate/naterade" github "mddub/dexcom-share-client-swift" ~> 0.1 -github "mddub/G4ShareSpy" ~> 0.2 -github "ps2/rileylink_ios" ~> 0.7.1 +github "mddub/G4ShareSpy" ~> 0.2.1 +github "ps2/rileylink_ios" ~> 0.8.0 github "amplitude/Amplitude-iOS" "mpurland-framework" diff --git a/Cartfile.resolved b/Cartfile.resolved index 767382d408..52eee1d641 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,8 +1,8 @@ github "amplitude/Amplitude-iOS" "a3d6720626e72a678489bce83ed9dacadb505dd7" github "loudnate/Crypto" "13fee45175b88629aeabe60b4b4fc3daf86fa0a3" -github "mddub/G4ShareSpy" "v0.2.0" -github "loudnate/LoopKit" "v0.3.5" +github "mddub/G4ShareSpy" "v0.2.1" +github "loudnate/LoopKit" "v0.4.0" github "loudnate/SwiftCharts" "8671287afb29640f9cffced6521b1098b7aac085" github "mddub/dexcom-share-client-swift" "v0.1.3" github "loudnate/xDripG5" "0.5.0" -github "ps2/rileylink_ios" "v0.7.1" +github "ps2/rileylink_ios" "v0.8.0" diff --git a/Carthage/Build/iOS/CarbKit.framework/CarbKit b/Carthage/Build/iOS/CarbKit.framework/CarbKit index a575a55bf4..b3f1ba21cf 100755 Binary files a/Carthage/Build/iOS/CarbKit.framework/CarbKit and b/Carthage/Build/iOS/CarbKit.framework/CarbKit differ diff --git a/Carthage/Build/iOS/CarbKit.framework/CarbKit.storyboardc/CarbEntryEditViewController.nib b/Carthage/Build/iOS/CarbKit.framework/CarbKit.storyboardc/CarbEntryEditViewController.nib index 314f17d2a3..0e808fc879 100644 Binary files a/Carthage/Build/iOS/CarbKit.framework/CarbKit.storyboardc/CarbEntryEditViewController.nib and b/Carthage/Build/iOS/CarbKit.framework/CarbKit.storyboardc/CarbEntryEditViewController.nib differ diff --git a/Carthage/Build/iOS/CarbKit.framework/CarbKit.storyboardc/LyL-9U-twn-view-9Ci-XW-6nA.nib b/Carthage/Build/iOS/CarbKit.framework/CarbKit.storyboardc/LyL-9U-twn-view-9Ci-XW-6nA.nib index 9a4ff886e1..55866d6b13 100644 Binary files a/Carthage/Build/iOS/CarbKit.framework/CarbKit.storyboardc/LyL-9U-twn-view-9Ci-XW-6nA.nib and b/Carthage/Build/iOS/CarbKit.framework/CarbKit.storyboardc/LyL-9U-twn-view-9Ci-XW-6nA.nib differ diff --git a/Carthage/Build/iOS/CarbKit.framework/CarbKit.storyboardc/UINavigationController-wgu-gT-TgV.nib b/Carthage/Build/iOS/CarbKit.framework/CarbKit.storyboardc/UINavigationController-wgu-gT-TgV.nib index 6e1f06a5a8..c2ac02687e 100644 Binary files a/Carthage/Build/iOS/CarbKit.framework/CarbKit.storyboardc/UINavigationController-wgu-gT-TgV.nib and b/Carthage/Build/iOS/CarbKit.framework/CarbKit.storyboardc/UINavigationController-wgu-gT-TgV.nib differ diff --git a/Carthage/Build/iOS/CarbKit.framework/CarbKit.storyboardc/UITableViewController-rUL-yg-cFX.nib b/Carthage/Build/iOS/CarbKit.framework/CarbKit.storyboardc/UITableViewController-rUL-yg-cFX.nib index 9e38239aa9..59f9b14ca7 100644 Binary files a/Carthage/Build/iOS/CarbKit.framework/CarbKit.storyboardc/UITableViewController-rUL-yg-cFX.nib and b/Carthage/Build/iOS/CarbKit.framework/CarbKit.storyboardc/UITableViewController-rUL-yg-cFX.nib differ diff --git a/Carthage/Build/iOS/CarbKit.framework/CarbKit.storyboardc/rUL-yg-cFX-view-b1s-8o-0Wp.nib b/Carthage/Build/iOS/CarbKit.framework/CarbKit.storyboardc/rUL-yg-cFX-view-b1s-8o-0Wp.nib index 6fc34fcf89..98f03d7a45 100644 Binary files a/Carthage/Build/iOS/CarbKit.framework/CarbKit.storyboardc/rUL-yg-cFX-view-b1s-8o-0Wp.nib and b/Carthage/Build/iOS/CarbKit.framework/CarbKit.storyboardc/rUL-yg-cFX-view-b1s-8o-0Wp.nib differ diff --git a/Carthage/Build/iOS/CarbKit.framework/Info.plist b/Carthage/Build/iOS/CarbKit.framework/Info.plist index c28f6889d3..e324120550 100644 Binary files a/Carthage/Build/iOS/CarbKit.framework/Info.plist and b/Carthage/Build/iOS/CarbKit.framework/Info.plist differ diff --git a/Carthage/Build/iOS/CarbKit.framework/Modules/CarbKit.swiftmodule/arm.swiftmodule b/Carthage/Build/iOS/CarbKit.framework/Modules/CarbKit.swiftmodule/arm.swiftmodule index 9e386e9c8f..993b0ae347 100644 Binary files a/Carthage/Build/iOS/CarbKit.framework/Modules/CarbKit.swiftmodule/arm.swiftmodule and b/Carthage/Build/iOS/CarbKit.framework/Modules/CarbKit.swiftmodule/arm.swiftmodule differ diff --git a/Carthage/Build/iOS/CarbKit.framework/Modules/CarbKit.swiftmodule/arm64.swiftmodule b/Carthage/Build/iOS/CarbKit.framework/Modules/CarbKit.swiftmodule/arm64.swiftmodule index c66d9d20c1..2b2d628700 100644 Binary files a/Carthage/Build/iOS/CarbKit.framework/Modules/CarbKit.swiftmodule/arm64.swiftmodule and b/Carthage/Build/iOS/CarbKit.framework/Modules/CarbKit.swiftmodule/arm64.swiftmodule differ diff --git a/Carthage/Build/iOS/CarbKit.framework/Modules/CarbKit.swiftmodule/i386.swiftmodule b/Carthage/Build/iOS/CarbKit.framework/Modules/CarbKit.swiftmodule/i386.swiftmodule index 331b86d98f..bf71539ca7 100644 Binary files a/Carthage/Build/iOS/CarbKit.framework/Modules/CarbKit.swiftmodule/i386.swiftmodule and b/Carthage/Build/iOS/CarbKit.framework/Modules/CarbKit.swiftmodule/i386.swiftmodule differ diff --git a/Carthage/Build/iOS/CarbKit.framework/Modules/CarbKit.swiftmodule/x86_64.swiftmodule b/Carthage/Build/iOS/CarbKit.framework/Modules/CarbKit.swiftmodule/x86_64.swiftmodule index cead9899db..d6ef74312c 100644 Binary files a/Carthage/Build/iOS/CarbKit.framework/Modules/CarbKit.swiftmodule/x86_64.swiftmodule and b/Carthage/Build/iOS/CarbKit.framework/Modules/CarbKit.swiftmodule/x86_64.swiftmodule differ diff --git a/Carthage/Build/iOS/G4ShareSpy.framework/G4ShareSpy b/Carthage/Build/iOS/G4ShareSpy.framework/G4ShareSpy index 55f34cdb5d..989274c691 100755 Binary files a/Carthage/Build/iOS/G4ShareSpy.framework/G4ShareSpy and b/Carthage/Build/iOS/G4ShareSpy.framework/G4ShareSpy differ diff --git a/Carthage/Build/iOS/G4ShareSpy.framework/Info.plist b/Carthage/Build/iOS/G4ShareSpy.framework/Info.plist index 51f920ad74..fac38c049e 100644 Binary files a/Carthage/Build/iOS/G4ShareSpy.framework/Info.plist and b/Carthage/Build/iOS/G4ShareSpy.framework/Info.plist differ diff --git a/Carthage/Build/iOS/GlucoseKit.framework/GlucoseKit b/Carthage/Build/iOS/GlucoseKit.framework/GlucoseKit index 07b86e9e1f..29b52ca6e1 100755 Binary files a/Carthage/Build/iOS/GlucoseKit.framework/GlucoseKit and b/Carthage/Build/iOS/GlucoseKit.framework/GlucoseKit differ diff --git a/Carthage/Build/iOS/GlucoseKit.framework/Info.plist b/Carthage/Build/iOS/GlucoseKit.framework/Info.plist index 9cf3c3b119..76fbad391e 100644 Binary files a/Carthage/Build/iOS/GlucoseKit.framework/Info.plist and b/Carthage/Build/iOS/GlucoseKit.framework/Info.plist differ diff --git a/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/arm.swiftdoc b/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/arm.swiftdoc index ec049cba41..40666f0176 100644 Binary files a/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/arm.swiftdoc and b/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/arm.swiftdoc differ diff --git a/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/arm.swiftmodule b/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/arm.swiftmodule index 1ff92db9e9..3651c86d6a 100644 Binary files a/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/arm.swiftmodule and b/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/arm.swiftmodule differ diff --git a/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/arm64.swiftdoc b/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/arm64.swiftdoc index 4d59b772c7..7d5ef0edce 100644 Binary files a/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/arm64.swiftdoc and b/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/arm64.swiftdoc differ diff --git a/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/arm64.swiftmodule b/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/arm64.swiftmodule index 0d9833b906..94cb33ceb5 100644 Binary files a/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/arm64.swiftmodule and b/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/arm64.swiftmodule differ diff --git a/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/i386.swiftdoc b/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/i386.swiftdoc index c87e77be3a..814b2f8dd9 100644 Binary files a/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/i386.swiftdoc and b/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/i386.swiftdoc differ diff --git a/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/i386.swiftmodule b/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/i386.swiftmodule index 6dd0514878..6b56359363 100644 Binary files a/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/i386.swiftmodule and b/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/i386.swiftmodule differ diff --git a/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/x86_64.swiftdoc b/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/x86_64.swiftdoc index 9c747c11f8..93f2ce0dc4 100644 Binary files a/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/x86_64.swiftdoc and b/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/x86_64.swiftdoc differ diff --git a/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/x86_64.swiftmodule b/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/x86_64.swiftmodule index 23a1ebcf37..6bffdaf2ca 100644 Binary files a/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/x86_64.swiftmodule and b/Carthage/Build/iOS/GlucoseKit.framework/Modules/GlucoseKit.swiftmodule/x86_64.swiftmodule differ diff --git a/Carthage/Build/iOS/InsulinKit.framework/Base.lproj/InsulinKit.storyboardc/UITableViewController-jGX-GA-nlH.nib b/Carthage/Build/iOS/InsulinKit.framework/Base.lproj/InsulinKit.storyboardc/UITableViewController-jGX-GA-nlH.nib index 6d9767c6ea..38582a90e2 100644 Binary files a/Carthage/Build/iOS/InsulinKit.framework/Base.lproj/InsulinKit.storyboardc/UITableViewController-jGX-GA-nlH.nib and b/Carthage/Build/iOS/InsulinKit.framework/Base.lproj/InsulinKit.storyboardc/UITableViewController-jGX-GA-nlH.nib differ diff --git a/Carthage/Build/iOS/InsulinKit.framework/Base.lproj/InsulinKit.storyboardc/jGX-GA-nlH-view-ccM-3y-LQM.nib b/Carthage/Build/iOS/InsulinKit.framework/Base.lproj/InsulinKit.storyboardc/jGX-GA-nlH-view-ccM-3y-LQM.nib index 2f70156215..df6b5c95b5 100644 Binary files a/Carthage/Build/iOS/InsulinKit.framework/Base.lproj/InsulinKit.storyboardc/jGX-GA-nlH-view-ccM-3y-LQM.nib and b/Carthage/Build/iOS/InsulinKit.framework/Base.lproj/InsulinKit.storyboardc/jGX-GA-nlH-view-ccM-3y-LQM.nib differ diff --git a/Carthage/Build/iOS/InsulinKit.framework/Headers/InsulinKit-Swift.h b/Carthage/Build/iOS/InsulinKit.framework/Headers/InsulinKit-Swift.h index 1ec9bf4309..1ef6fe6c86 100644 --- a/Carthage/Build/iOS/InsulinKit.framework/Headers/InsulinKit-Swift.h +++ b/Carthage/Build/iOS/InsulinKit.framework/Headers/InsulinKit-Swift.h @@ -103,8 +103,8 @@ typedef int swift_int4 __attribute__((__ext_vector_type__(4))); @class NSBundle; @class NSCoder; -SWIFT_CLASS("_TtC10InsulinKit28ReservoirTableViewController") -@interface ReservoirTableViewController : UITableViewController +SWIFT_CLASS("_TtC10InsulinKit34InsulinDeliveryTableViewController") +@interface InsulinDeliveryTableViewController : UITableViewController - (void)viewDidLoad; - (void)viewWillAppear:(BOOL)animated; - (void)viewDidAppear:(BOOL)animated; diff --git a/Carthage/Build/iOS/InsulinKit.framework/Info.plist b/Carthage/Build/iOS/InsulinKit.framework/Info.plist index 19ab8b110d..060858b3b4 100644 Binary files a/Carthage/Build/iOS/InsulinKit.framework/Info.plist and b/Carthage/Build/iOS/InsulinKit.framework/Info.plist differ diff --git a/Carthage/Build/iOS/InsulinKit.framework/InsulinKit b/Carthage/Build/iOS/InsulinKit.framework/InsulinKit index ec639edcf1..52ad055c1a 100755 Binary files a/Carthage/Build/iOS/InsulinKit.framework/InsulinKit and b/Carthage/Build/iOS/InsulinKit.framework/InsulinKit differ diff --git a/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/arm.swiftdoc b/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/arm.swiftdoc index 34dac97812..e665fa201b 100644 Binary files a/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/arm.swiftdoc and b/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/arm.swiftdoc differ diff --git a/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/arm.swiftmodule b/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/arm.swiftmodule index a1edae6496..b192bcebcd 100644 Binary files a/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/arm.swiftmodule and b/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/arm.swiftmodule differ diff --git a/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/arm64.swiftdoc b/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/arm64.swiftdoc index 98ab995ec1..1695793194 100644 Binary files a/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/arm64.swiftdoc and b/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/arm64.swiftdoc differ diff --git a/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/arm64.swiftmodule b/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/arm64.swiftmodule index 83e37ee111..bf61c16a6e 100644 Binary files a/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/arm64.swiftmodule and b/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/arm64.swiftmodule differ diff --git a/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/i386.swiftdoc b/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/i386.swiftdoc index 827f3ffd5b..c121c075e3 100644 Binary files a/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/i386.swiftdoc and b/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/i386.swiftdoc differ diff --git a/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/i386.swiftmodule b/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/i386.swiftmodule index e0f3059fa4..19daadfdd0 100644 Binary files a/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/i386.swiftmodule and b/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/i386.swiftmodule differ diff --git a/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/x86_64.swiftdoc b/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/x86_64.swiftdoc index bf3d5d8c10..8b07f6f3a8 100644 Binary files a/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/x86_64.swiftdoc and b/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/x86_64.swiftdoc differ diff --git a/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/x86_64.swiftmodule b/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/x86_64.swiftmodule index dfe8dbafe6..dd171cddca 100644 Binary files a/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/x86_64.swiftmodule and b/Carthage/Build/iOS/InsulinKit.framework/Modules/InsulinKit.swiftmodule/x86_64.swiftmodule differ diff --git a/Carthage/Build/iOS/LoopKit.framework/Assets.car b/Carthage/Build/iOS/LoopKit.framework/Assets.car index 18f71f802f..4ee67e3613 100644 Binary files a/Carthage/Build/iOS/LoopKit.framework/Assets.car and b/Carthage/Build/iOS/LoopKit.framework/Assets.car differ diff --git a/Carthage/Build/iOS/LoopKit.framework/GlucoseRangeOverrideTableViewCell.nib b/Carthage/Build/iOS/LoopKit.framework/GlucoseRangeOverrideTableViewCell.nib index e31994b803..02f190d5f8 100644 Binary files a/Carthage/Build/iOS/LoopKit.framework/GlucoseRangeOverrideTableViewCell.nib and b/Carthage/Build/iOS/LoopKit.framework/GlucoseRangeOverrideTableViewCell.nib differ diff --git a/Carthage/Build/iOS/LoopKit.framework/GlucoseRangeTableViewCell.nib b/Carthage/Build/iOS/LoopKit.framework/GlucoseRangeTableViewCell.nib index c3318f8ae2..f14886c636 100644 Binary files a/Carthage/Build/iOS/LoopKit.framework/GlucoseRangeTableViewCell.nib and b/Carthage/Build/iOS/LoopKit.framework/GlucoseRangeTableViewCell.nib differ diff --git a/Carthage/Build/iOS/LoopKit.framework/Headers/LoopKit-Swift.h b/Carthage/Build/iOS/LoopKit.framework/Headers/LoopKit-Swift.h index 7445f70f24..06c34bbc76 100644 --- a/Carthage/Build/iOS/LoopKit.framework/Headers/LoopKit-Swift.h +++ b/Carthage/Build/iOS/LoopKit.framework/Headers/LoopKit-Swift.h @@ -209,13 +209,16 @@ SWIFT_CLASS("_TtC7LoopKit28TextFieldTableViewController") @interface TextFieldTableViewController : UITableViewController @property (nonatomic, strong) NSIndexPath * _Nullable indexPath; @property (nonatomic, copy) NSString * _Nullable placeholder; +@property (nonatomic, copy) NSString * _Nullable unit; @property (nonatomic, copy) NSString * _Nullable value; +@property (nonatomic, copy) NSString * _Nullable contextHelp; @property (nonatomic) UIKeyboardType keyboardType; - (nonnull instancetype)init; - (void)viewDidLoad; - (void)viewDidAppear:(BOOL)animated; - (NSInteger)tableView:(UITableView * _Nonnull)tableView numberOfRowsInSection:(NSInteger)section; - (UITableViewCell * _Nonnull)tableView:(UITableView * _Nonnull)tableView cellForRowAtIndexPath:(NSIndexPath * _Nonnull)indexPath; +- (NSString * _Nullable)tableView:(UITableView * _Nonnull)tableView titleForFooterInSection:(NSInteger)section; - (BOOL)textFieldShouldEndEditing:(UITextField * _Nonnull)textField; - (BOOL)textFieldShouldReturn:(UITextField * _Nonnull)textField; - (nonnull instancetype)initWithStyle:(UITableViewStyle)style OBJC_DESIGNATED_INITIALIZER; diff --git a/Carthage/Build/iOS/LoopKit.framework/Info.plist b/Carthage/Build/iOS/LoopKit.framework/Info.plist index 410a6d7d60..2a809ed379 100644 Binary files a/Carthage/Build/iOS/LoopKit.framework/Info.plist and b/Carthage/Build/iOS/LoopKit.framework/Info.plist differ diff --git a/Carthage/Build/iOS/LoopKit.framework/LoopKit b/Carthage/Build/iOS/LoopKit.framework/LoopKit index f376494b7b..f186f046ae 100755 Binary files a/Carthage/Build/iOS/LoopKit.framework/LoopKit and b/Carthage/Build/iOS/LoopKit.framework/LoopKit differ diff --git a/Carthage/Build/iOS/LoopKit.framework/Modules/LoopKit.swiftmodule/arm.swiftmodule b/Carthage/Build/iOS/LoopKit.framework/Modules/LoopKit.swiftmodule/arm.swiftmodule index 4c46acfb4b..a08ceed42c 100644 Binary files a/Carthage/Build/iOS/LoopKit.framework/Modules/LoopKit.swiftmodule/arm.swiftmodule and b/Carthage/Build/iOS/LoopKit.framework/Modules/LoopKit.swiftmodule/arm.swiftmodule differ diff --git a/Carthage/Build/iOS/LoopKit.framework/Modules/LoopKit.swiftmodule/arm64.swiftmodule b/Carthage/Build/iOS/LoopKit.framework/Modules/LoopKit.swiftmodule/arm64.swiftmodule index 1a56807ddd..e52801b5b1 100644 Binary files a/Carthage/Build/iOS/LoopKit.framework/Modules/LoopKit.swiftmodule/arm64.swiftmodule and b/Carthage/Build/iOS/LoopKit.framework/Modules/LoopKit.swiftmodule/arm64.swiftmodule differ diff --git a/Carthage/Build/iOS/LoopKit.framework/Modules/LoopKit.swiftmodule/i386.swiftmodule b/Carthage/Build/iOS/LoopKit.framework/Modules/LoopKit.swiftmodule/i386.swiftmodule index e05db9b976..338fde5afb 100644 Binary files a/Carthage/Build/iOS/LoopKit.framework/Modules/LoopKit.swiftmodule/i386.swiftmodule and b/Carthage/Build/iOS/LoopKit.framework/Modules/LoopKit.swiftmodule/i386.swiftmodule differ diff --git a/Carthage/Build/iOS/LoopKit.framework/Modules/LoopKit.swiftmodule/x86_64.swiftmodule b/Carthage/Build/iOS/LoopKit.framework/Modules/LoopKit.swiftmodule/x86_64.swiftmodule index e9450bb533..ddee91a5d4 100644 Binary files a/Carthage/Build/iOS/LoopKit.framework/Modules/LoopKit.swiftmodule/x86_64.swiftmodule and b/Carthage/Build/iOS/LoopKit.framework/Modules/LoopKit.swiftmodule/x86_64.swiftmodule differ diff --git a/Carthage/Build/iOS/LoopKit.framework/RepeatingScheduleValueTableViewCell.nib b/Carthage/Build/iOS/LoopKit.framework/RepeatingScheduleValueTableViewCell.nib index d46c6bdff6..6969bd7288 100644 Binary files a/Carthage/Build/iOS/LoopKit.framework/RepeatingScheduleValueTableViewCell.nib and b/Carthage/Build/iOS/LoopKit.framework/RepeatingScheduleValueTableViewCell.nib differ diff --git a/Carthage/Build/iOS/LoopKit.framework/TextFieldTableViewCell.nib b/Carthage/Build/iOS/LoopKit.framework/TextFieldTableViewCell.nib index 326df39d9c..6c167b6ebe 100644 Binary files a/Carthage/Build/iOS/LoopKit.framework/TextFieldTableViewCell.nib and b/Carthage/Build/iOS/LoopKit.framework/TextFieldTableViewCell.nib differ diff --git a/Carthage/Build/iOS/MinimedKit.framework/Info.plist b/Carthage/Build/iOS/MinimedKit.framework/Info.plist index c2de159a53..4f2ecda588 100644 Binary files a/Carthage/Build/iOS/MinimedKit.framework/Info.plist and b/Carthage/Build/iOS/MinimedKit.framework/Info.plist differ diff --git a/Carthage/Build/iOS/MinimedKit.framework/MinimedKit b/Carthage/Build/iOS/MinimedKit.framework/MinimedKit index b26f6d94dc..1e816954b8 100755 Binary files a/Carthage/Build/iOS/MinimedKit.framework/MinimedKit and b/Carthage/Build/iOS/MinimedKit.framework/MinimedKit differ diff --git a/Carthage/Build/iOS/MinimedKit.framework/Modules/MinimedKit.swiftmodule/arm.swiftmodule b/Carthage/Build/iOS/MinimedKit.framework/Modules/MinimedKit.swiftmodule/arm.swiftmodule index 93749c39a1..6390b5510c 100644 Binary files a/Carthage/Build/iOS/MinimedKit.framework/Modules/MinimedKit.swiftmodule/arm.swiftmodule and b/Carthage/Build/iOS/MinimedKit.framework/Modules/MinimedKit.swiftmodule/arm.swiftmodule differ diff --git a/Carthage/Build/iOS/MinimedKit.framework/Modules/MinimedKit.swiftmodule/arm64.swiftmodule b/Carthage/Build/iOS/MinimedKit.framework/Modules/MinimedKit.swiftmodule/arm64.swiftmodule index 301f33b578..bc567ca32a 100644 Binary files a/Carthage/Build/iOS/MinimedKit.framework/Modules/MinimedKit.swiftmodule/arm64.swiftmodule and b/Carthage/Build/iOS/MinimedKit.framework/Modules/MinimedKit.swiftmodule/arm64.swiftmodule differ diff --git a/Carthage/Build/iOS/MinimedKit.framework/Modules/MinimedKit.swiftmodule/i386.swiftmodule b/Carthage/Build/iOS/MinimedKit.framework/Modules/MinimedKit.swiftmodule/i386.swiftmodule index f4d7fa0586..848842a111 100644 Binary files a/Carthage/Build/iOS/MinimedKit.framework/Modules/MinimedKit.swiftmodule/i386.swiftmodule and b/Carthage/Build/iOS/MinimedKit.framework/Modules/MinimedKit.swiftmodule/i386.swiftmodule differ diff --git a/Carthage/Build/iOS/MinimedKit.framework/Modules/MinimedKit.swiftmodule/x86_64.swiftmodule b/Carthage/Build/iOS/MinimedKit.framework/Modules/MinimedKit.swiftmodule/x86_64.swiftmodule index e9aeedebd8..67d60e79ab 100644 Binary files a/Carthage/Build/iOS/MinimedKit.framework/Modules/MinimedKit.swiftmodule/x86_64.swiftmodule and b/Carthage/Build/iOS/MinimedKit.framework/Modules/MinimedKit.swiftmodule/x86_64.swiftmodule differ diff --git a/Carthage/Build/iOS/NightscoutUploadKit.framework/Info.plist b/Carthage/Build/iOS/NightscoutUploadKit.framework/Info.plist index f05de2eab0..ea2d84fed4 100644 Binary files a/Carthage/Build/iOS/NightscoutUploadKit.framework/Info.plist and b/Carthage/Build/iOS/NightscoutUploadKit.framework/Info.plist differ diff --git a/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/arm.swiftdoc b/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/arm.swiftdoc index b8fb2a62b3..8bbab6e464 100644 Binary files a/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/arm.swiftdoc and b/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/arm.swiftdoc differ diff --git a/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/arm.swiftmodule b/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/arm.swiftmodule index 1faa611c64..14f66e281b 100644 Binary files a/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/arm.swiftmodule and b/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/arm.swiftmodule differ diff --git a/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/arm64.swiftdoc b/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/arm64.swiftdoc index f3fc985c2d..46112ca328 100644 Binary files a/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/arm64.swiftdoc and b/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/arm64.swiftdoc differ diff --git a/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/arm64.swiftmodule b/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/arm64.swiftmodule index 9da3353b7d..27bcd166d4 100644 Binary files a/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/arm64.swiftmodule and b/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/arm64.swiftmodule differ diff --git a/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/i386.swiftdoc b/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/i386.swiftdoc index c06bf1e264..3e6a37f0b5 100644 Binary files a/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/i386.swiftdoc and b/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/i386.swiftdoc differ diff --git a/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/i386.swiftmodule b/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/i386.swiftmodule index 68c894458f..e2a9678e39 100644 Binary files a/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/i386.swiftmodule and b/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/i386.swiftmodule differ diff --git a/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/x86_64.swiftdoc b/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/x86_64.swiftdoc index f9eb98bd9a..313c9cf46b 100644 Binary files a/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/x86_64.swiftdoc and b/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/x86_64.swiftdoc differ diff --git a/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/x86_64.swiftmodule b/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/x86_64.swiftmodule index 205bfb88dc..0863576273 100644 Binary files a/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/x86_64.swiftmodule and b/Carthage/Build/iOS/NightscoutUploadKit.framework/Modules/NightscoutUploadKit.swiftmodule/x86_64.swiftmodule differ diff --git a/Carthage/Build/iOS/NightscoutUploadKit.framework/NightscoutUploadKit b/Carthage/Build/iOS/NightscoutUploadKit.framework/NightscoutUploadKit index f6a8377c00..d05be9ed0e 100755 Binary files a/Carthage/Build/iOS/NightscoutUploadKit.framework/NightscoutUploadKit and b/Carthage/Build/iOS/NightscoutUploadKit.framework/NightscoutUploadKit differ diff --git a/Carthage/Build/iOS/RileyLinkBLEKit.framework/Info.plist b/Carthage/Build/iOS/RileyLinkBLEKit.framework/Info.plist index aaa78256a8..a1239cc066 100644 Binary files a/Carthage/Build/iOS/RileyLinkBLEKit.framework/Info.plist and b/Carthage/Build/iOS/RileyLinkBLEKit.framework/Info.plist differ diff --git a/Carthage/Build/iOS/RileyLinkBLEKit.framework/RileyLinkBLEKit b/Carthage/Build/iOS/RileyLinkBLEKit.framework/RileyLinkBLEKit index 0dc47d1c8c..a21ec1ad10 100755 Binary files a/Carthage/Build/iOS/RileyLinkBLEKit.framework/RileyLinkBLEKit and b/Carthage/Build/iOS/RileyLinkBLEKit.framework/RileyLinkBLEKit differ diff --git a/Carthage/Build/iOS/RileyLinkKit.framework/Info.plist b/Carthage/Build/iOS/RileyLinkKit.framework/Info.plist index 2818308cc3..c80e214378 100644 Binary files a/Carthage/Build/iOS/RileyLinkKit.framework/Info.plist and b/Carthage/Build/iOS/RileyLinkKit.framework/Info.plist differ diff --git a/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/arm.swiftdoc b/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/arm.swiftdoc index 57f98a2875..da513cc5e1 100644 Binary files a/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/arm.swiftdoc and b/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/arm.swiftdoc differ diff --git a/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/arm.swiftmodule b/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/arm.swiftmodule index 78ce43088f..bcbb922328 100644 Binary files a/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/arm.swiftmodule and b/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/arm.swiftmodule differ diff --git a/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/arm64.swiftdoc b/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/arm64.swiftdoc index d72fcf5682..875b5cbe6b 100644 Binary files a/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/arm64.swiftdoc and b/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/arm64.swiftdoc differ diff --git a/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/arm64.swiftmodule b/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/arm64.swiftmodule index c3592d2cbd..116552231f 100644 Binary files a/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/arm64.swiftmodule and b/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/arm64.swiftmodule differ diff --git a/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/i386.swiftdoc b/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/i386.swiftdoc index 998821880a..c9147f21ce 100644 Binary files a/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/i386.swiftdoc and b/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/i386.swiftdoc differ diff --git a/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/i386.swiftmodule b/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/i386.swiftmodule index 4f6c941277..aaa0d7718f 100644 Binary files a/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/i386.swiftmodule and b/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/i386.swiftmodule differ diff --git a/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/x86_64.swiftdoc b/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/x86_64.swiftdoc index f31143b35e..27dcc5ca8b 100644 Binary files a/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/x86_64.swiftdoc and b/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/x86_64.swiftdoc differ diff --git a/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/x86_64.swiftmodule b/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/x86_64.swiftmodule index 0621e37ae4..1e8e82f67b 100644 Binary files a/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/x86_64.swiftmodule and b/Carthage/Build/iOS/RileyLinkKit.framework/Modules/RileyLinkKit.swiftmodule/x86_64.swiftmodule differ diff --git a/Carthage/Build/iOS/RileyLinkKit.framework/RileyLinkDeviceTableViewCell.nib b/Carthage/Build/iOS/RileyLinkKit.framework/RileyLinkDeviceTableViewCell.nib index ec9ebe41a1..e297ad74c9 100644 Binary files a/Carthage/Build/iOS/RileyLinkKit.framework/RileyLinkDeviceTableViewCell.nib and b/Carthage/Build/iOS/RileyLinkKit.framework/RileyLinkDeviceTableViewCell.nib differ diff --git a/Carthage/Build/iOS/RileyLinkKit.framework/RileyLinkKit b/Carthage/Build/iOS/RileyLinkKit.framework/RileyLinkKit index 74fdaebcf0..84ac0f11fc 100755 Binary files a/Carthage/Build/iOS/RileyLinkKit.framework/RileyLinkKit and b/Carthage/Build/iOS/RileyLinkKit.framework/RileyLinkKit differ diff --git a/Carthage/Build/iOS/RileyLinkKit.framework/TextFieldTableViewCell.nib b/Carthage/Build/iOS/RileyLinkKit.framework/TextFieldTableViewCell.nib index c30b69ab20..707722b0c8 100644 Binary files a/Carthage/Build/iOS/RileyLinkKit.framework/TextFieldTableViewCell.nib and b/Carthage/Build/iOS/RileyLinkKit.framework/TextFieldTableViewCell.nib differ diff --git a/Documentation/Screenshots/Watch Carb Entry.png b/Documentation/Screenshots/Watch Carb Entry.png index c5990724f6..18d625d7ac 100755 Binary files a/Documentation/Screenshots/Watch Carb Entry.png and b/Documentation/Screenshots/Watch Carb Entry.png differ diff --git a/DoseMathTests/DoseMathTests.swift b/DoseMathTests/DoseMathTests.swift index 6c2eabf122..51b11f692e 100644 --- a/DoseMathTests/DoseMathTests.swift +++ b/DoseMathTests/DoseMathTests.swift @@ -119,11 +119,11 @@ class RecommendTempBasalTests: XCTestCase { // Cancel existing temp basal let lastTempBasal = DoseEntry( - type: .TempBasal, + type: .tempBasal, startDate: glucose.first!.startDate.dateByAddingTimeInterval(NSTimeInterval(minutes: -11)), endDate: glucose.first!.startDate.dateByAddingTimeInterval(NSTimeInterval(minutes: 19)), value: 0.125, - unit: .UnitsPerHour + unit: .unitsPerHour ) dose = DoseMath.recommendTempBasalFromPredictedGlucose(glucose, @@ -167,11 +167,11 @@ class RecommendTempBasalTests: XCTestCase { XCTAssertNil(dose) let lastTempBasal = DoseEntry( - type: .TempBasal, + type: .tempBasal, startDate: glucose.first!.startDate.dateByAddingTimeInterval(NSTimeInterval(minutes: -11)), endDate: glucose.first!.startDate.dateByAddingTimeInterval(NSTimeInterval(minutes: 19)), value: 1.225, - unit: .UnitsPerHour + unit: .unitsPerHour ) dose = DoseMath.recommendTempBasalFromPredictedGlucose(glucose, @@ -205,11 +205,11 @@ class RecommendTempBasalTests: XCTestCase { // Ignore due to existing dose var lastTempBasal = DoseEntry( - type: .TempBasal, + type: .tempBasal, startDate: glucose.first!.startDate.dateByAddingTimeInterval(NSTimeInterval(minutes: -11)), endDate: glucose.first!.startDate.dateByAddingTimeInterval(NSTimeInterval(minutes: 19)), value: 0.125, - unit: .UnitsPerHour + unit: .unitsPerHour ) dose = DoseMath.recommendTempBasalFromPredictedGlucose(glucose, @@ -225,11 +225,11 @@ class RecommendTempBasalTests: XCTestCase { // Cancel existing dose lastTempBasal = DoseEntry( - type: .TempBasal, + type: .tempBasal, startDate: glucose.first!.startDate.dateByAddingTimeInterval(NSTimeInterval(minutes: -11)), endDate: glucose.first!.startDate.dateByAddingTimeInterval(NSTimeInterval(minutes: 19)), value: 1.225, - unit: .UnitsPerHour + unit: .unitsPerHour ) dose = DoseMath.recommendTempBasalFromPredictedGlucose(glucose, @@ -246,11 +246,11 @@ class RecommendTempBasalTests: XCTestCase { // Continue existing dose lastTempBasal = DoseEntry( - type: .TempBasal, + type: .tempBasal, startDate: glucose.first!.startDate.dateByAddingTimeInterval(NSTimeInterval(minutes: -21)), endDate: glucose.first!.startDate.dateByAddingTimeInterval(NSTimeInterval(minutes: 9)), value: 0.125, - unit: .UnitsPerHour + unit: .unitsPerHour ) dose = DoseMath.recommendTempBasalFromPredictedGlucose(glucose, @@ -279,11 +279,11 @@ class RecommendTempBasalTests: XCTestCase { XCTAssertNil(dose) lastTempBasal = DoseEntry( - type: .TempBasal, + type: .tempBasal, startDate: glucose.first!.startDate.dateByAddingTimeInterval(NSTimeInterval(minutes: -21)), endDate: glucose.first!.startDate.dateByAddingTimeInterval(NSTimeInterval(minutes: 9)), value: 0.125, - unit: .UnitsPerHour + unit: .unitsPerHour ) dose = DoseMath.recommendTempBasalFromPredictedGlucose(glucose, @@ -345,11 +345,11 @@ class RecommendTempBasalTests: XCTestCase { XCTAssertNil(dose) let lastTempBasal = DoseEntry( - type: .TempBasal, + type: .tempBasal, startDate: glucose.first!.startDate.dateByAddingTimeInterval(NSTimeInterval(minutes: -11)), endDate: glucose.first!.startDate.dateByAddingTimeInterval(NSTimeInterval(minutes: 19)), value: 1.225, - unit: .UnitsPerHour + unit: .unitsPerHour ) dose = DoseMath.recommendTempBasalFromPredictedGlucose(glucose, @@ -528,11 +528,11 @@ class RecommendBolusTests: XCTestCase { // Don't consider net-negative temp basal let lastTempBasal = DoseEntry( - type: .TempBasal, + type: .tempBasal, startDate: glucose.first!.startDate.dateByAddingTimeInterval(NSTimeInterval(minutes: -11)), endDate: glucose.first!.startDate.dateByAddingTimeInterval(NSTimeInterval(minutes: 19)), value: 0.01, - unit: .UnitsPerHour + unit: .unitsPerHour ) dose = DoseMath.recommendBolusFromPredictedGlucose(glucose, @@ -638,11 +638,11 @@ class RecommendBolusTests: XCTestCase { // Less existing temp var lastTempBasal = DoseEntry( - type: .TempBasal, + type: .tempBasal, startDate: glucose.first!.startDate.dateByAddingTimeInterval(NSTimeInterval(minutes: -11)), endDate: glucose.first!.startDate.dateByAddingTimeInterval(NSTimeInterval(minutes: 19)), value: 1.225, - unit: .UnitsPerHour + unit: .unitsPerHour ) dose = DoseMath.recommendBolusFromPredictedGlucose(glucose, @@ -658,11 +658,11 @@ class RecommendBolusTests: XCTestCase { // But not a finished temp lastTempBasal = DoseEntry( - type: .TempBasal, + type: .tempBasal, startDate: glucose.first!.startDate.dateByAddingTimeInterval(NSTimeInterval(minutes: -35)), endDate: glucose.first!.startDate.dateByAddingTimeInterval(NSTimeInterval(minutes: -5)), value: 1.225, - unit: .UnitsPerHour + unit: .unitsPerHour ) dose = DoseMath.recommendBolusFromPredictedGlucose(glucose, diff --git a/Loop.xcodeproj/project.pbxproj b/Loop.xcodeproj/project.pbxproj index 522fea9dfc..2c76b394c3 100644 --- a/Loop.xcodeproj/project.pbxproj +++ b/Loop.xcodeproj/project.pbxproj @@ -7,6 +7,10 @@ objects = { /* Begin PBXBuildFile section */ + 4302F4DB1D4D6E9F00F0FCAF /* NSData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4302F4DA1D4D6E9F00F0FCAF /* NSData.swift */; }; + 4302F4E11D4E9C8900F0FCAF /* TextFieldTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4302F4E01D4E9C8900F0FCAF /* TextFieldTableViewController.swift */; }; + 4302F4E31D4EA54200F0FCAF /* InsulinDeliveryTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4302F4E21D4EA54200F0FCAF /* InsulinDeliveryTableViewController.swift */; }; + 4302F4E51D4EA75100F0FCAF /* DoseStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4302F4E41D4EA75100F0FCAF /* DoseStore.swift */; }; 430DA58E1D4AEC230097D1CA /* NSBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 430DA58D1D4AEC230097D1CA /* NSBundle.swift */; }; 430DA5901D4B0E4C0097D1CA /* MySentryPumpStatusMessageBody.swift in Sources */ = {isa = PBXBuildFile; fileRef = 430DA58F1D4B0E4C0097D1CA /* MySentryPumpStatusMessageBody.swift */; }; 4315D2871CA5CC3B00589052 /* CarbEntryEditTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4315D2861CA5CC3B00589052 /* CarbEntryEditTableViewController.swift */; }; @@ -91,7 +95,6 @@ 43DBF04C1C93B8D700B3C386 /* BolusViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43DBF04B1C93B8D700B3C386 /* BolusViewController.swift */; }; 43DBF0531C93EC8200B3C386 /* DeviceDataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43DBF0521C93EC8200B3C386 /* DeviceDataManager.swift */; }; 43DBF0551C93ED3000B3C386 /* DeviceDataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43DBF0541C93ED3000B3C386 /* DeviceDataManager.swift */; }; - 43DBF0571C93F6EB00B3C386 /* ReservoirTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43DBF0561C93F6EB00B3C386 /* ReservoirTableViewController.swift */; }; 43DBF0591C93F73800B3C386 /* CarbEntryTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43DBF0581C93F73800B3C386 /* CarbEntryTableViewController.swift */; }; 43DE92591C5479E4001FFDE1 /* CarbEntryUserInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43DE92581C5479E4001FFDE1 /* CarbEntryUserInfo.swift */; }; 43DE925A1C5479E4001FFDE1 /* CarbEntryUserInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43DE92581C5479E4001FFDE1 /* CarbEntryUserInfo.swift */; }; @@ -121,6 +124,9 @@ 43E2D9191D222759004DA55F /* LoopKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 43F78D4B1C914197002152D1 /* LoopKit.framework */; }; 43E3449F1B9D68E900C85C07 /* StatusTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43E3449E1B9D68E900C85C07 /* StatusTableViewController.swift */; }; 43E344A41B9E1B1C00C85C07 /* NSUserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43E344A31B9E1B1C00C85C07 /* NSUserDefaults.swift */; }; + 43EA285F1D50ED3D001BC233 /* GlucoseTrend.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43EA285E1D50ED3D001BC233 /* GlucoseTrend.swift */; }; + 43EA28601D50ED4D001BC233 /* GlucoseTrend.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43EA285E1D50ED3D001BC233 /* GlucoseTrend.swift */; }; + 43EA28621D517E42001BC233 /* SensorDisplayable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43EA28611D517E42001BC233 /* SensorDisplayable.swift */; }; 43EB40861C82646A00472A8C /* StatusChartManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43EB40851C82646A00472A8C /* StatusChartManager.swift */; }; 43EDDBF31C361C75007D89B5 /* xDripG5.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 43EDDBF11C361C75007D89B5 /* xDripG5.framework */; }; 43F41C331D3A17AA00C11ED6 /* ChartAxisValueDoubleUnit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43F41C321D3A17AA00C11ED6 /* ChartAxisValueDoubleUnit.swift */; }; @@ -137,6 +143,7 @@ 4D3B40041D4A9E1A00BC6334 /* G4ShareSpy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D3B40021D4A9DFE00BC6334 /* G4ShareSpy.framework */; }; 4D5B7A4B1D457CCA00796CA9 /* GlucoseG4.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D5B7A4A1D457CCA00796CA9 /* GlucoseG4.swift */; }; C10428971D17BAD400DD539A /* NightscoutUploadKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C10428961D17BAD400DD539A /* NightscoutUploadKit.framework */; }; + C17884631D51A7A400405663 /* BatteryIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C17884621D51A7A400405663 /* BatteryIndicator.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -220,6 +227,10 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 4302F4DA1D4D6E9F00F0FCAF /* NSData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSData.swift; sourceTree = ""; }; + 4302F4E01D4E9C8900F0FCAF /* TextFieldTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldTableViewController.swift; sourceTree = ""; }; + 4302F4E21D4EA54200F0FCAF /* InsulinDeliveryTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InsulinDeliveryTableViewController.swift; sourceTree = ""; }; + 4302F4E41D4EA75100F0FCAF /* DoseStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DoseStore.swift; sourceTree = ""; }; 430DA58D1D4AEC230097D1CA /* NSBundle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSBundle.swift; sourceTree = ""; }; 430DA58F1D4B0E4C0097D1CA /* MySentryPumpStatusMessageBody.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MySentryPumpStatusMessageBody.swift; sourceTree = ""; }; 4315D2861CA5CC3B00589052 /* CarbEntryEditTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CarbEntryEditTableViewController.swift; sourceTree = ""; }; @@ -305,7 +316,6 @@ 43DBF04B1C93B8D700B3C386 /* BolusViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = BolusViewController.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 43DBF0521C93EC8200B3C386 /* DeviceDataManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = DeviceDataManager.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 43DBF0541C93ED3000B3C386 /* DeviceDataManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeviceDataManager.swift; sourceTree = ""; }; - 43DBF0561C93F6EB00B3C386 /* ReservoirTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReservoirTableViewController.swift; sourceTree = ""; }; 43DBF0581C93F73800B3C386 /* CarbEntryTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CarbEntryTableViewController.swift; sourceTree = ""; }; 43DE92501C541832001FFDE1 /* UIColor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIColor.swift; sourceTree = ""; }; 43DE92581C5479E4001FFDE1 /* CarbEntryUserInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CarbEntryUserInfo.swift; sourceTree = ""; }; @@ -332,6 +342,8 @@ 43E2D90F1D20C581004DA55F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43E3449E1B9D68E900C85C07 /* StatusTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = StatusTableViewController.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 43E344A31B9E1B1C00C85C07 /* NSUserDefaults.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSUserDefaults.swift; sourceTree = ""; }; + 43EA285E1D50ED3D001BC233 /* GlucoseTrend.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GlucoseTrend.swift; sourceTree = ""; }; + 43EA28611D517E42001BC233 /* SensorDisplayable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SensorDisplayable.swift; sourceTree = ""; }; 43EB40851C82646A00472A8C /* StatusChartManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusChartManager.swift; sourceTree = ""; }; 43EDDBF01C361C75007D89B5 /* CommonCrypto.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CommonCrypto.framework; path = Carthage/Build/iOS/CommonCrypto.framework; sourceTree = ""; }; 43EDDBF11C361C75007D89B5 /* xDripG5.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = xDripG5.framework; path = Carthage/Build/iOS/xDripG5.framework; sourceTree = ""; }; @@ -354,6 +366,7 @@ 4D3B40021D4A9DFE00BC6334 /* G4ShareSpy.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = G4ShareSpy.framework; path = Carthage/Build/iOS/G4ShareSpy.framework; sourceTree = ""; }; 4D5B7A4A1D457CCA00796CA9 /* GlucoseG4.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GlucoseG4.swift; path = Loop/Models/GlucoseG4.swift; sourceTree = SOURCE_ROOT; }; C10428961D17BAD400DD539A /* NightscoutUploadKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NightscoutUploadKit.framework; path = Carthage/Build/iOS/NightscoutUploadKit.framework; sourceTree = ""; }; + C17884621D51A7A400405663 /* BatteryIndicator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BatteryIndicator.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -449,6 +462,7 @@ 438849ED1D2A1EBB003B3F23 /* MLabService.swift */, 430DA58F1D4B0E4C0097D1CA /* MySentryPumpStatusMessageBody.swift */, 438849E91D297CB6003B3F23 /* NightscoutService.swift */, + 43EA28611D517E42001BC233 /* SensorDisplayable.swift */, 437CCADF1D285C7B0075D2C3 /* ServiceAuthentication.swift */, 434F54601D28859B002A9274 /* ServiceCredential.swift */, 43C418B41CE0575200405B6A /* ShareGlucose+GlucoseKit.swift */, @@ -542,6 +556,7 @@ children = ( 435400301C9F744E00D5819C /* BolusSuggestionUserInfo.swift */, 43DE92581C5479E4001FFDE1 /* CarbEntryUserInfo.swift */, + 43EA285E1D50ED3D001BC233 /* GlucoseTrend.swift */, 435400331C9F878D00D5819C /* SetBolusUserInfo.swift */, 43DE925B1C547A20001FFDE1 /* WatchContext.swift */, ); @@ -582,9 +597,11 @@ 4331E0771C85302200FBE832 /* CGPoint.swift */, 4346D1F51C78501000ABAFE3 /* ChartPoint.swift */, 43649A621C7A347F00523D7F /* CollectionType.swift */, + 4302F4E41D4EA75100F0FCAF /* DoseStore.swift */, 434FF1E91CF26C29000DB779 /* IdentifiableClass.swift */, 434F54561D287FDB002A9274 /* NibLoadable.swift */, 430DA58D1D4AEC230097D1CA /* NSBundle.swift */, + 4302F4DA1D4D6E9F00F0FCAF /* NSData.swift */, 43CE7CDD1CA8B63E003CC1B0 /* NSDate.swift */, 4398973A1CD2FC2000223065 /* NSDateFormatter.swift */, 439897341CD2F7DE00223065 /* NSTimeInterval.swift */, @@ -593,6 +610,7 @@ 43DE92501C541832001FFDE1 /* UIColor.swift */, 437CEEE31CDE5C0A003C8C80 /* UIImage.swift */, 434FF1ED1CF27EEF000DB779 /* UITableViewCell.swift */, + C17884621D51A7A400405663 /* BatteryIndicator.swift */, ); path = Extensions; sourceTree = ""; @@ -604,9 +622,10 @@ 43DBF04B1C93B8D700B3C386 /* BolusViewController.swift */, 4315D2861CA5CC3B00589052 /* CarbEntryEditTableViewController.swift */, 43DBF0581C93F73800B3C386 /* CarbEntryTableViewController.swift */, - 43DBF0561C93F6EB00B3C386 /* ReservoirTableViewController.swift */, + 4302F4E21D4EA54200F0FCAF /* InsulinDeliveryTableViewController.swift */, 43F5C2DA1B92A5E1003EB13D /* SettingsTableViewController.swift */, 43E3449E1B9D68E900C85C07 /* StatusTableViewController.swift */, + 4302F4E01D4E9C8900F0FCAF /* TextFieldTableViewController.swift */, ); path = "View Controllers"; sourceTree = ""; @@ -971,9 +990,11 @@ 437CCADE1D2858FD0075D2C3 /* AuthenticationViewController.swift in Sources */, 43A5676B1C96155700334FAC /* SwitchTableViewCell.swift in Sources */, 43A567691C94880B00334FAC /* LoopDataManager.swift in Sources */, + 4302F4E11D4E9C8900F0FCAF /* TextFieldTableViewController.swift in Sources */, 43E344A41B9E1B1C00C85C07 /* NSUserDefaults.swift in Sources */, 43649A631C7A347F00523D7F /* CollectionType.swift in Sources */, 437CEEBE1CD6E0CB003C8C80 /* LoopCompletionHUDView.swift in Sources */, + 43EA28621D517E42001BC233 /* SensorDisplayable.swift in Sources */, 435400321C9F745500D5819C /* BolusSuggestionUserInfo.swift in Sources */, 43E3449F1B9D68E900C85C07 /* StatusTableViewController.swift in Sources */, 43DBF0531C93EC8200B3C386 /* DeviceDataManager.swift in Sources */, @@ -985,6 +1006,7 @@ 43DE925C1C547A20001FFDE1 /* WatchContext.swift in Sources */, 43F41C351D3B623800C11ED6 /* ChartPointsTouchHighlightLayerViewCache.swift in Sources */, 43EB40861C82646A00472A8C /* StatusChartManager.swift in Sources */, + C17884631D51A7A400405663 /* BatteryIndicator.swift in Sources */, 437CEEC81CD84CBB003C8C80 /* ReservoirVolumeHUDView.swift in Sources */, 43C0944A1CACCC73001F6403 /* NotificationManager.swift in Sources */, 434FF1EE1CF27EEF000DB779 /* UITableViewCell.swift in Sources */, @@ -994,11 +1016,12 @@ 4331E0781C85302200FBE832 /* CGPoint.swift in Sources */, 43DBF04C1C93B8D700B3C386 /* BolusViewController.swift in Sources */, 4328E0351CFC0AE100E199AA /* WatchDataManager.swift in Sources */, + 4302F4E31D4EA54200F0FCAF /* InsulinDeliveryTableViewController.swift in Sources */, 437CCAE01D285C7B0075D2C3 /* ServiceAuthentication.swift in Sources */, + 4302F4E51D4EA75100F0FCAF /* DoseStore.swift in Sources */, 430DA5901D4B0E4C0097D1CA /* MySentryPumpStatusMessageBody.swift in Sources */, 4D5B7A4B1D457CCA00796CA9 /* GlucoseG4.swift in Sources */, 438849EC1D29EC34003B3F23 /* AmplitudeService.swift in Sources */, - 43DBF0571C93F6EB00B3C386 /* ReservoirTableViewController.swift in Sources */, 435400341C9F878D00D5819C /* SetBolusUserInfo.swift in Sources */, 43F41C371D3BF32400C11ED6 /* UIAlertController.swift in Sources */, 437CEEBC1CD6DE6A003C8C80 /* HUDView.swift in Sources */, @@ -1009,6 +1032,7 @@ 436A0DA51D236A2A00104B24 /* LoopError.swift in Sources */, 437CEEC01CD6FCD8003C8C80 /* BasalRateHUDView.swift in Sources */, 43E2D8C61D204678004DA55F /* KeychainManager.swift in Sources */, + 4302F4DB1D4D6E9F00F0FCAF /* NSData.swift in Sources */, 437CEECA1CD84DB7003C8C80 /* BatteryLevelHUDView.swift in Sources */, 43F78D261C8FC000002152D1 /* DoseMath.swift in Sources */, 4331E07A1C85650D00FBE832 /* ChartAxisValueDoubleLog.swift in Sources */, @@ -1016,6 +1040,7 @@ 436FACEE1D0BA636004E2427 /* InsulinDataSource.swift in Sources */, 439897371CD2F80600223065 /* AnalyticsManager.swift in Sources */, 4346D1F61C78501000ABAFE3 /* ChartPoint.swift in Sources */, + 43EA28601D50ED4D001BC233 /* GlucoseTrend.swift in Sources */, 438849EE1D2A1EBB003B3F23 /* MLabService.swift in Sources */, 43F4EF1D1BA2A57600526CE1 /* DiagnosticLogger.swift in Sources */, 432E73CB1D24B3D6009AD15D /* RemoteDataManager.swift in Sources */, @@ -1043,6 +1068,7 @@ 4328E02B1CFBE2C500E199AA /* WKAlertAction.swift in Sources */, 4328E0281CFBE2C500E199AA /* CLKComplicationTemplate.swift in Sources */, 4328E01E1CFBE25F00E199AA /* AddCarbsInterfaceController.swift in Sources */, + 43EA285F1D50ED3D001BC233 /* GlucoseTrend.swift in Sources */, 4328E0261CFBE2C500E199AA /* IdentifiableClass.swift in Sources */, 43DE925A1C5479E4001FFDE1 /* CarbEntryUserInfo.swift in Sources */, 4328E0301CFBFAEB00E199AA /* NSTimeInterval.swift in Sources */, diff --git a/Loop/Base.lproj/Main.storyboard b/Loop/Base.lproj/Main.storyboard index ae50f299e8..b7386f3db0 100644 --- a/Loop/Base.lproj/Main.storyboard +++ b/Loop/Base.lproj/Main.storyboard @@ -1,5 +1,5 @@ - + @@ -436,7 +436,7 @@ - + diff --git a/Loop/Extensions/BatteryIndicator.swift b/Loop/Extensions/BatteryIndicator.swift new file mode 100644 index 0000000000..304a843c87 --- /dev/null +++ b/Loop/Extensions/BatteryIndicator.swift @@ -0,0 +1,23 @@ +// +// BatteryIndicator.swift +// Loop +// +// Created by Pete Schwamb on 8/2/16. +// Copyright © 2016 Nathan Racklyeft. All rights reserved. +// + +import NightscoutUploadKit +import MinimedKit + +extension BatteryIndicator { + init?(batteryStatus: MinimedKit.BatteryStatus) { + switch batteryStatus { + case .Low: + self = .Low + case .Normal: + self = .Normal + default: + return nil + } + } +} \ No newline at end of file diff --git a/Loop/Extensions/DoseStore.swift b/Loop/Extensions/DoseStore.swift new file mode 100644 index 0000000000..81432ed0f6 --- /dev/null +++ b/Loop/Extensions/DoseStore.swift @@ -0,0 +1,72 @@ +// +// DoseStore.swift +// Loop +// +// Created by Nate Racklyeft on 7/31/16. +// Copyright © 2016 Nathan Racklyeft. All rights reserved. +// + +import InsulinKit +import MinimedKit + + +// Bridges support for MinimedKit data types +extension DoseStore { + /** + Adds and persists new pump events. + */ + func add(pumpEvents: [TimestampedHistoryEvent], completionHandler: (error: DoseStore.Error?) -> Void) { + + var events: [(date: NSDate, dose: DoseEntry?, raw: NSData?, isMutable: Bool)] = [] + var lastTempBasalAmount: DoseEntry? + + for event in pumpEvents { + var dose: DoseEntry? + + switch event.pumpEvent { + case let bolus as BolusNormalPumpEvent: + InsulinKit.PumpEventType.bolus + + let unit: DoseUnit + + switch bolus.type { + case .Normal: + unit = .units + case .Square: + unit = .unitsPerHour + } + + dose = DoseEntry(type: .bolus, startDate: event.date, endDate: event.date.dateByAddingTimeInterval(bolus.duration), value: bolus.amount, unit: unit) + case is SuspendPumpEvent: + dose = DoseEntry(suspendDate: event.date) + case is ResumePumpEvent: + dose = DoseEntry(resumeDate: event.date) + case let temp as TempBasalPumpEvent: + if case .Absolute = temp.rateType { + lastTempBasalAmount = DoseEntry(type: .tempBasal, startDate: event.date, value: temp.rate, unit: .unitsPerHour) + } + case let temp as TempBasalDurationPumpEvent: + if let amount = lastTempBasalAmount where amount.startDate == event.date { + dose = DoseEntry( + type: .tempBasal, + startDate: event.date, + endDate: event.date.dateByAddingTimeInterval(NSTimeInterval(minutes: Double(temp.duration))), + value: amount.value, + unit: amount.unit + ) + } + default: + break + } + + events.append(( + date: event.date, + dose: dose, + raw: event.pumpEvent.rawData, + isMutable: event.isMutable() + )) + } + + addPumpEvents(events, completionHandler: completionHandler) + } +} diff --git a/Loop/Extensions/NSData.swift b/Loop/Extensions/NSData.swift new file mode 100644 index 0000000000..1df7d3c748 --- /dev/null +++ b/Loop/Extensions/NSData.swift @@ -0,0 +1,29 @@ +// +// NSData.swift +// Loop +// +// Created by Nate Racklyeft on 7/30/16. +// Copyright © 2016 Nathan Racklyeft. All rights reserved. +// + +import Foundation + + +extension NSData { + @nonobjc subscript(index: Int) -> UInt8 { + let bytes: [UInt8] = self[index...index] + + return bytes[0] + } + + subscript(range: Range) -> [UInt8] { + var dataArray = [UInt8](count: range.count, repeatedValue: 0) + self.getBytes(&dataArray, range: NSRange(range)) + + return dataArray + } + + subscript(range: Range) -> NSData { + return subdataWithRange(NSRange(range)) + } +} diff --git a/Loop/Info.plist b/Loop/Info.plist index 468ecb31df..c3509d8c51 100644 --- a/Loop/Info.plist +++ b/Loop/Info.plist @@ -4,6 +4,8 @@ CFBundleDevelopmentRegion en + ITSAppUsesNonExemptEncryption + CFBundleDisplayName Loop CFBundleExecutable diff --git a/Loop/Managers/AnalyticsManager.swift b/Loop/Managers/AnalyticsManager.swift index e13c50258a..da08118ccb 100644 --- a/Loop/Managers/AnalyticsManager.swift +++ b/Loop/Managers/AnalyticsManager.swift @@ -71,6 +71,14 @@ class AnalyticsManager { logEvent("Transmitter time change", withProperties: ["value" : drift]) } + func pumpBatteryWasReplaced() { + logEvent("Pump battery replacement") + } + + func reservoirWasRewound() { + logEvent("Pump reservoir rewind") + } + func didChangeBasalRateSchedule() { logEvent("Basal rate change") } diff --git a/Loop/Managers/DeviceDataManager.swift b/Loop/Managers/DeviceDataManager.swift index 830493c690..3749ac6be3 100644 --- a/Loop/Managers/DeviceDataManager.swift +++ b/Loop/Managers/DeviceDataManager.swift @@ -75,7 +75,7 @@ class DeviceDataManager: CarbStoreDelegate, TransmitterDelegate, ReceiverDelegat } var sensorInfo: SensorDisplayable? { - return latestGlucoseG5 ?? latestGlucoseG4 ?? latestPumpStatus + return latestGlucoseG5 ?? latestGlucoseG4 ?? latestPumpStatusFromMySentry } // MARK: - RileyLink @@ -101,7 +101,7 @@ class DeviceDataManager: CarbStoreDelegate, TransmitterDelegate, ReceiverDelegat case .MySentry: switch message.messageBody { case let body as MySentryPumpStatusMessageBody: - updatePumpStatus(body, fromDevice: device) + updatePumpStatus(body, from: device) case is MySentryAlertMessageBody, is MySentryAlertClearedMessageBody: break case let body: @@ -151,7 +151,7 @@ class DeviceDataManager: CarbStoreDelegate, TransmitterDelegate, ReceiverDelegat // MARK: Pump data - var latestPumpStatus: MySentryPumpStatusMessageBody? + var latestPumpStatusFromMySentry: MySentryPumpStatusMessageBody? // TODO: Expose this on DoseStore var latestReservoirValue: ReservoirValue? { @@ -176,16 +176,37 @@ class DeviceDataManager: CarbStoreDelegate, TransmitterDelegate, ReceiverDelegat - parameter status: The status message body - parameter device: The RileyLink that received the message */ - private func updatePumpStatus(status: MySentryPumpStatusMessageBody, fromDevice device: RileyLinkDevice) { + private func updatePumpStatus(status: MySentryPumpStatusMessageBody, from device: RileyLinkDevice) { status.pumpDateComponents.timeZone = pumpState?.timeZone status.glucoseDateComponents?.timeZone = pumpState?.timeZone // The pump sends the same message 3x, so ignore it if we've already seen it. - guard status != latestPumpStatus, let pumpDate = status.pumpDateComponents.date else { + guard status != latestPumpStatusFromMySentry, let pumpDate = status.pumpDateComponents.date else { return } - latestPumpStatus = status + // Report battery changes to Analytics + if let latestPumpStatusFromMySentry = latestPumpStatusFromMySentry where status.batteryRemainingPercent - latestPumpStatusFromMySentry.batteryRemainingPercent >= 50 { + AnalyticsManager.sharedManager.pumpBatteryWasReplaced() + } + + latestPumpStatusFromMySentry = status + + // Gather PumpStatus from MySentry packet + let pumpStatus: NightscoutUploadKit.PumpStatus? + if let pumpDate = status.pumpDateComponents.date, let pumpID = pumpID { + + let batteryStatus = BatteryStatus(percent: status.batteryRemainingPercent) + let iobStatus = IOBStatus(timestamp: pumpDate, iob: status.iob) + + pumpStatus = NightscoutUploadKit.PumpStatus(clock: pumpDate, pumpID: pumpID, iob: iobStatus, battery: batteryStatus, reservoir: status.reservoirRemainingUnits) + } else { + pumpStatus = nil + self.logger.addError("Could not interpret pump clock: \(status.pumpDateComponents)", fromSource: "RileyLink") + } + + // Trigger device status upload, even if something is wrong with pumpStatus + remoteDataManager.uploadDeviceStatus(pumpStatus) backfillGlucoseFromShareIfNeeded() @@ -196,7 +217,7 @@ class DeviceDataManager: CarbStoreDelegate, TransmitterDelegate, ReceiverDelegat glucoseStore?.addGlucose( HKQuantity(unit: HKUnit.milligramsPerDeciliterUnit(), doubleValue: Double(glucose)), date: date, - displayOnly: false, + isDisplayOnly: false, device: nil ) { (success, sample, error) in if let error = error { @@ -210,6 +231,9 @@ class DeviceDataManager: CarbStoreDelegate, TransmitterDelegate, ReceiverDelegat break } + // Upload sensor glucose to Nightscout + remoteDataManager.nightscoutUploader?.uploadSGVFromMySentryPumpStatus(status, device: device.deviceURI) + // Sentry packets are sent in groups of 3, 5s apart. Wait 11s before allowing the loop data to continue to avoid conflicting comms. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(11 * NSEC_PER_SEC)), dispatch_get_global_queue(QOS_CLASS_UTILITY, 0)) { self.updateReservoirVolume(status.reservoirRemainingUnits, atDate: pumpDate, withTimeLeft: NSTimeInterval(minutes: Double(status.reservoirRemainingMinutes))) @@ -219,48 +243,6 @@ class DeviceDataManager: CarbStoreDelegate, TransmitterDelegate, ReceiverDelegat if status.batteryRemainingPercent == 0 { NotificationManager.sendPumpBatteryLowNotification() } - - remoteDataManager.nightscoutUploader?.handlePumpStatus(status, device: device.deviceURI) - } - - /** - Read the pump's current reservoir and clock - - - parameter completion: A closure called after the command is complete. This closure takes a single Result argument: - - Success(units, date): The reservoir volume, in units of insulin, and date according to the pump's clock - - Failure(error): An error describing why the command failed - */ - private func readReservoirVolume(completion: (Either<(units: Double, date: NSDate), ErrorType>) -> Void) { - guard let device = rileyLinkManager.firstConnectedDevice, ops = device.ops else { - completion(.Failure(LoopError.ConfigurationError)) - return - } - - ops.readRemainingInsulin { (result) in - switch result { - case .Success(let units): - ops.readTime { (result) in - switch result { - case .Success(let components): - components.timeZone = ops.pumpState.timeZone - - guard let date = components.date else { - self.logger.addError("Could not interpret clock", fromSource: "RileyLink") - completion(.Failure(LoopError.ConfigurationError)) - return - } - - completion(.Success((units: units, date: date))) - case .Failure(let error): - self.logger.addError("Failed to fetch clock: \(error)", fromSource: "RileyLink") - completion(.Failure(error)) - } - } - case .Failure(let error): - self.logger.addError("Failed to fetch reservoir: \(error)", fromSource: "RileyLink") - completion(.Failure(error)) - } - } } /** @@ -299,6 +281,45 @@ class DeviceDataManager: CarbStoreDelegate, TransmitterDelegate, ReceiverDelegat NotificationManager.sendPumpReservoirLowNotificationForAmount(newVolume, andTimeRemaining: timeLeft) } } + + if newVolume > previousVolume + 1 { + AnalyticsManager.sharedManager.reservoirWasRewound() + } + } + } + } + + /** + Read the pump's current state, including reservoir and clock + + - parameter completion: A closure called after the command is complete. This closure takes a single Result argument: + - Success(status, date): The pump status, and the resolved date according to the pump's clock + - Failure(error): An error describing why the command failed + */ + private func readPumpData(completion: (Either<(status: RileyLinkKit.PumpStatus, date: NSDate), ErrorType>) -> Void) { + guard let device = rileyLinkManager.firstConnectedDevice, let ops = device.ops else { + completion(.Failure(LoopError.ConfigurationError)) + return + } + + ops.readPumpStatus { (result) in + switch result { + case .Success(let status): + status.clock.timeZone = ops.pumpState.timeZone + guard let date = status.clock.date else { + self.logger.addError("Could not interpret pump clock: \(status.clock)", fromSource: "RileyLink") + completion(.Failure(LoopError.ConfigurationError)) + return + } + + let battery = BatteryStatus(voltage: status.batteryVolts, status: BatteryIndicator(batteryStatus: status.batteryStatus)) + let nsPumpStatus = NightscoutUploadKit.PumpStatus(clock: date, pumpID: ops.pumpState.pumpID, iob: nil, battery: battery, suspended: status.suspended, bolusing: status.bolusing, reservoir: status.reservoir) + self.remoteDataManager.uploadDeviceStatus(nsPumpStatus) + + completion(.Success(status: status, date: date)) + case .Failure(let error): + self.logger.addError("Failed to fetch pump status: \(error)", fromSource: "RileyLink") + completion(.Failure(error)) } } } @@ -313,15 +334,15 @@ class DeviceDataManager: CarbStoreDelegate, TransmitterDelegate, ReceiverDelegat device.assertIdleListening() - // How long should we wait before we poll for new reservoir data? - let reservoirTolerance = rileyLinkManager.idleListeningEnabled ? NSTimeInterval(minutes: 11) : NSTimeInterval(minutes: 4) + // How long should we wait before we poll for new pump data? + let pumpStatusAgeTolerance = rileyLinkManager.idleListeningEnabled ? NSTimeInterval(minutes: 11) : NSTimeInterval(minutes: 4) - // If we don't yet have reservoir data, or it's old, poll for it. - if latestReservoirValue == nil || latestReservoirValue!.startDate.timeIntervalSinceNow <= -reservoirTolerance { - readReservoirVolume { (result) in + // If we don't yet have pump status, or it's old, poll for it. + if latestReservoirValue == nil || latestReservoirValue!.startDate.timeIntervalSinceNow <= -pumpStatusAgeTolerance { + readPumpData { (result) in switch result { - case .Success(let (units, date)): - self.updateReservoirVolume(units, atDate: date, withTimeLeft: nil) + case .Success(let (status, date)): + self.updateReservoirVolume(status.reservoir, atDate: date, withTimeLeft: nil) case .Failure: self.troubleshootPumpCommsWithDevice(device) } @@ -412,18 +433,18 @@ class DeviceDataManager: CarbStoreDelegate, TransmitterDelegate, ReceiverDelegat } } - // If we don't have a recent reservoir value, or the pump was recently rewound, read a new reservoir value before bolusing. + // If we don't have recent pump data, or the pump was recently rewound, read new pump data before bolusing. if latestReservoirValue == nil || latestReservoirVolumeDrop < 0 || latestReservoirValue!.startDate.timeIntervalSinceNow <= NSTimeInterval(minutes: -5) { - readReservoirVolume { (result) in + readPumpData { (result) in switch result { - case .Success(let (unitVolume, date)): - self.doseStore.addReservoirValue(unitVolume, atDate: date) { (newValue, _, error) in + case .Success(let (status, date)): + self.doseStore.addReservoirValue(status.reservoir, atDate: date) { (newValue, _, error) in if let error = error { self.logger.addError(error, fromSource: "Bolus") - completion(error: LoopError.CommunicationError) + completion(error: error) } else { self.latestReservoirValue = newValue setBolus() @@ -495,7 +516,7 @@ class DeviceDataManager: CarbStoreDelegate, TransmitterDelegate, ReceiverDelegat let device = HKDevice(name: "xDripG5", manufacturer: "Dexcom", model: "G5 Mobile", hardwareVersion: nil, firmwareVersion: nil, softwareVersion: String(xDripG5VersionNumber), localIdentifier: nil, UDIDeviceIdentifier: "00386270000002") - glucoseStore.addGlucose(glucose.quantity, date: glucose.startDate, displayOnly: glucoseMessage.glucoseIsDisplayOnly, device: device, resultHandler: { (_, _, error) -> Void in + glucoseStore.addGlucose(glucose.quantity, date: glucose.startDate, isDisplayOnly: glucoseMessage.glucoseIsDisplayOnly, device: device, resultHandler: { (_, _, error) -> Void in if let error = error { self.logger.addError(error, fromSource: "GlucoseStore") } @@ -549,7 +570,7 @@ class DeviceDataManager: CarbStoreDelegate, TransmitterDelegate, ReceiverDelegat // Ignore glucose values that are up to a minute newer than our previous value, to account for possible time shifting in Share data let newGlucose = glucose.filterDateRange(glucoseStore.latestGlucose?.startDate.dateByAddingTimeInterval(NSTimeInterval(minutes: 1)), nil).map { - return (quantity: $0.quantity, date: $0.startDate, displayOnly: false) + return (quantity: $0.quantity, date: $0.startDate, isDisplayOnly: false) } glucoseStore.addGlucoseValues(newGlucose, device: nil) { (_, _, error) -> Void in @@ -588,7 +609,7 @@ class DeviceDataManager: CarbStoreDelegate, TransmitterDelegate, ReceiverDelegat let validGlucose = glucoseHistory.flatMap({ $0.isValid ? $0 : nil }).filterDateRange(includeAfter, nil).map({ - (quantity: $0.quantity, date: $0.startDate, displayOnly: $0.isDisplayOnly) + (quantity: $0.quantity, date: $0.startDate, isDisplayOnly: $0.isDisplayOnly) }) // "Dexcom G4 Platinum Transmitter (Retail) US" - see https://accessgudid.nlm.nih.gov/devices/search?query=dexcom+g4 @@ -611,7 +632,7 @@ class DeviceDataManager: CarbStoreDelegate, TransmitterDelegate, ReceiverDelegat func receiver(receiver: Receiver, didLogBluetoothEvent event: String) { // Uncomment to debug communication - // NSLog("G4: \(event)") + // logger.addMessage(["event": "\(event)", "collectedAt": NSDateFormatter.ISO8601StrictDateFormatter().stringFromDate(NSDate())], toCollection: "g4") } // MARK: - Configuration @@ -889,6 +910,7 @@ class DeviceDataManager: CarbStoreDelegate, TransmitterDelegate, ReceiverDelegat basalProfile: basalRateSchedule, insulinSensitivitySchedule: insulinSensitivitySchedule ) + carbStore = CarbStore( carbRatioSchedule: carbRatioSchedule, insulinSensitivitySchedule: insulinSensitivitySchedule @@ -941,39 +963,3 @@ class DeviceDataManager: CarbStoreDelegate, TransmitterDelegate, ReceiverDelegat } } } - -/* - History parsing scratch. - -func translate(event: TimestampedHistoryEvent) -> DoseEntry? { - - switch event.pumpEvent { - case let bolus as BolusNormalPumpEvent: - InsulinKit.PumpEventType.Bolus - - let unit: DoseUnit - - switch bolus.type { - case .Normal: - unit = .Units - case .Square: - unit = .UnitsPerHour - } - - return DoseEntry(type: .Bolus, startDate: event.date, endDate: event.date.dateByAddingTimeInterval(bolus.duration), value: bolus.amount, unit: unit) - case let suspend as SuspendPumpEvent: - InsulinKit.PumpEventType.Suspend - case let resume as ResumePumpEvent: -// InsulinKit.PumpEventType.Resume - break - case let temp as TempBasalPumpEvent: - InsulinKit.PumpEventType.TempBasal - default: - break - } - - return nil -} -*/ - - diff --git a/Loop/Managers/DoseMath.swift b/Loop/Managers/DoseMath.swift index 624f0f0dce..0e6c44ca6a 100644 --- a/Loop/Managers/DoseMath.swift +++ b/Loop/Managers/DoseMath.swift @@ -108,7 +108,7 @@ class DoseMath { rate = nil } - if let lastTempBasal = lastTempBasal where lastTempBasal.unit == .UnitsPerHour && lastTempBasal.endDate > date { + if let lastTempBasal = lastTempBasal where lastTempBasal.unit == .unitsPerHour && lastTempBasal.endDate > date { if let determinedRate = rate { // Ignore the dose if the current dose is the same rate and has more than 10 minutes remaining if determinedRate == lastTempBasal.value && lastTempBasal.endDate.timeIntervalSinceDate(date) > NSTimeInterval(minutes: 11) { @@ -169,7 +169,7 @@ class DoseMath { var doseUnits = (eventualGlucose.quantity.doubleValueForUnit(glucoseTargetRange.unit) - targetGlucose) / currentSensitivity - if let lastTempBasal = lastTempBasal where lastTempBasal.unit == .UnitsPerHour && lastTempBasal.endDate > date { + if let lastTempBasal = lastTempBasal where lastTempBasal.unit == .unitsPerHour && lastTempBasal.endDate > date { let normalBasalRate = basalRateSchedule.valueAt(date) let remainingTime = lastTempBasal.endDate.timeIntervalSinceDate(date) let remainingUnits = (lastTempBasal.value - normalBasalRate) * remainingTime / NSTimeInterval(hours: 1) diff --git a/Loop/Managers/LoopDataManager.swift b/Loop/Managers/LoopDataManager.swift index 331b5934a3..9d19c12b29 100644 --- a/Loop/Managers/LoopDataManager.swift +++ b/Loop/Managers/LoopDataManager.swift @@ -455,7 +455,7 @@ class LoopDataManager { let endDate = now.dateByAddingTimeInterval(body.timeRemaining) let startDate = endDate.dateByAddingTimeInterval(-recommendedTempBasal.duration) - self.lastTempBasal = DoseEntry(type: .TempBasal, startDate: startDate, endDate: endDate, value: body.rate, unit: DoseUnit.UnitsPerHour) + self.lastTempBasal = DoseEntry(type: .tempBasal, startDate: startDate, endDate: endDate, value: body.rate, unit: .unitsPerHour) self.recommendedTempBasal = nil resultsHandler(success: true, error: nil) diff --git a/Loop/Managers/RemoteDataManager.swift b/Loop/Managers/RemoteDataManager.swift index c30bf09ac5..b1c240505e 100644 --- a/Loop/Managers/RemoteDataManager.swift +++ b/Loop/Managers/RemoteDataManager.swift @@ -20,6 +20,7 @@ class RemoteDataManager { var nightscoutService: NightscoutService { didSet { keychain.setNightscoutURL(nightscoutService.siteURL, secret: nightscoutService.APISecret) + UIDevice.currentDevice().batteryMonitoringEnabled = true } } @@ -44,9 +45,33 @@ class RemoteDataManager { if let (siteURL, APISecret) = keychain.getNightscoutCredentials() { nightscoutService = NightscoutService(siteURL: siteURL, APISecret: APISecret) + UIDevice.currentDevice().batteryMonitoringEnabled = true } else { nightscoutService = NightscoutService(siteURL: nil, APISecret: nil) } } + func uploadDeviceStatus(pumpStatus: NightscoutUploadKit.PumpStatus? = nil, loopStatus: LoopStatus? = nil) { + + guard let uploader = nightscoutUploader else { + return + } + + // Gather UploaderStatus + let uploaderDevice = UIDevice.currentDevice() + + let battery: Int? + if uploaderDevice.batteryMonitoringEnabled { + battery = Int(uploaderDevice.batteryLevel * 100) + } else { + battery = nil + } + let uploaderStatus = UploaderStatus(name: uploaderDevice.name, timestamp: NSDate(), battery: battery) + + // Build DeviceStatus + let deviceStatus = DeviceStatus(device: "loop://\(uploaderDevice.name)", timestamp: NSDate(), pumpStatus: pumpStatus, uploaderStatus: uploaderStatus, loopStatus: loopStatus) + + uploader.uploadDeviceStatus(deviceStatus) + } + } \ No newline at end of file diff --git a/Loop/Managers/StatusChartManager.swift b/Loop/Managers/StatusChartManager.swift index 02535069a0..3413857698 100644 --- a/Loop/Managers/StatusChartManager.swift +++ b/Loop/Managers/StatusChartManager.swift @@ -129,7 +129,7 @@ class StatusChartsManager { var doseEntries: [DoseEntry] = [] { didSet { dosePoints = doseEntries.reduce([], combine: { (points, entry) -> [ChartPoint] in - if entry.unit == .UnitsPerHour { + if entry.unit == .unitsPerHour { let startX = ChartAxisValueDate(date: entry.startDate, formatter: dateFormatter) let endX = ChartAxisValueDate(date: entry.endDate, formatter: dateFormatter) let zero = ChartAxisValueInt(0) diff --git a/Loop/Managers/WatchDataManager.swift b/Loop/Managers/WatchDataManager.swift index ae393bcefd..be230310fa 100644 --- a/Loop/Managers/WatchDataManager.swift +++ b/Loop/Managers/WatchDataManager.swift @@ -107,7 +107,7 @@ class WatchDataManager: NSObject, WCSessionDelegate { context.loopLastRunDate = lastLoopCompleted context.recommendedBolusDose = units - if let trend = self.deviceDataManager.sensorInfo?.trendDescription { + if let trend = self.deviceDataManager.sensorInfo?.trendType { context.glucoseTrend = trend } diff --git a/Loop/Models/GlucoseG4.swift b/Loop/Models/GlucoseG4.swift index 7077c73af5..33a2a5db4b 100644 --- a/Loop/Models/GlucoseG4.swift +++ b/Loop/Models/GlucoseG4.swift @@ -39,16 +39,11 @@ extension GlucoseG4: SensorDisplayable { } } + var trendType: GlucoseTrend? { + return GlucoseTrend(rawValue: Int(trend)) + } + var trendDescription: String { - switch trend { - case 1: return "⇈" - case 2: return "↑" - case 3: return "↗" - case 4: return "→" - case 5: return "↘" - case 6: return "↓" - case 7: return "⇊" - default: return "" - } + return trendType?.description ?? "" } } diff --git a/Loop/Models/GlucoseRxMessage.swift b/Loop/Models/GlucoseRxMessage.swift index d12a480749..5c890edc06 100644 --- a/Loop/Models/GlucoseRxMessage.swift +++ b/Loop/Models/GlucoseRxMessage.swift @@ -10,15 +10,6 @@ import Foundation import xDripG5 -protocol SensorDisplayable { - // Describes the state of the sensor in the current localization - var stateDescription: String { get } - - // Describes the trend of the sensor values in the current localization - var trendDescription: String { get } -} - - extension GlucoseRxMessage: SensorDisplayable { var stateDescription: String { let status: String @@ -34,25 +25,34 @@ extension GlucoseRxMessage: SensorDisplayable { return String(format: "%1$02x %2$@", state, status) } - var trendDescription: String { + var trendType: GlucoseTrend? { guard trend < Int8.max else { - return "" + return nil } - let direction: String switch trend { - case let x where x < -10: - direction = "⇊" - case let x where x < 0: - direction = "↓" - case let x where x > 10: - direction = "⇈" - case let x where x > 0: - direction = "↑" + case let x where x <= -30: + return .DownDownDown + case let x where x <= -20: + return .DownDown + case let x where x <= -10: + return .Down + case let x where x < 10: + return .Flat + case let x where x < 20: + return .Up + case let x where x < 30: + return .UpUp default: - direction = "→" + return .UpUpUp + } + } + + var trendDescription: String { + guard let trendType = trendType else { + return "" } - return String(format: NSLocalizedString("%1$d %2$@", comment: "The format string describing the G5 sensor trend (1: The raw trend value)(2: The direction arrow)"), trend, direction) + return String(format: NSLocalizedString("%1$d %2$@", comment: "The format string describing the G5 sensor trend (1: The raw trend value)(2: The direction arrow)"), trend, trendType.description) } } \ No newline at end of file diff --git a/Loop/Models/MySentryPumpStatusMessageBody.swift b/Loop/Models/MySentryPumpStatusMessageBody.swift index 465d8224f4..3ee841cf2a 100644 --- a/Loop/Models/MySentryPumpStatusMessageBody.swift +++ b/Loop/Models/MySentryPumpStatusMessageBody.swift @@ -22,22 +22,26 @@ extension MySentryPumpStatusMessageBody: SensorDisplayable { } } - var trendDescription: String { + var trendType: GlucoseTrend? { guard case .Active = glucose else { - return "" + return nil } switch glucoseTrend { - case .Flat: - return "→" - case .Up: - return "⇈" - case .UpUp: - return "↑" case .Down: - return "↓" + return .Down case .DownDown: - return "⇊" + return .DownDown + case .Up: + return .Up + case .UpUp: + return .UpUp + case .Flat: + return .Flat } } + + var trendDescription: String { + return trendType?.description ?? "" + } } \ No newline at end of file diff --git a/Loop/Models/SensorDisplayable.swift b/Loop/Models/SensorDisplayable.swift new file mode 100644 index 0000000000..3f93e0a89a --- /dev/null +++ b/Loop/Models/SensorDisplayable.swift @@ -0,0 +1,19 @@ +// +// SensorDisplayable.swift +// Loop +// +// Created by Nate Racklyeft on 8/2/16. +// Copyright © 2016 Nathan Racklyeft. All rights reserved. +// + + +protocol SensorDisplayable { + // Describes the state of the sensor in the current localization + var stateDescription: String { get } + + /// Enumerates the trend of the sensor values + var trendType: GlucoseTrend? { get } + + // Describes the trend of the sensor values in the current localization + var trendDescription: String { get } +} diff --git a/Loop/View Controllers/ReservoirTableViewController.swift b/Loop/View Controllers/InsulinDeliveryTableViewController.swift similarity index 57% rename from Loop/View Controllers/ReservoirTableViewController.swift rename to Loop/View Controllers/InsulinDeliveryTableViewController.swift index 66f0f86983..34b196fd07 100644 --- a/Loop/View Controllers/ReservoirTableViewController.swift +++ b/Loop/View Controllers/InsulinDeliveryTableViewController.swift @@ -1,5 +1,5 @@ // -// ReservoirTableViewController.swift +// InsulinDeliveryTableViewController.swift // Naterade // // Created by Nathan Racklyeft on 3/11/16. @@ -9,5 +9,5 @@ import InsulinKit -extension ReservoirTableViewController: IdentifiableClass { +extension InsulinDeliveryTableViewController: IdentifiableClass { } \ No newline at end of file diff --git a/Loop/View Controllers/SettingsTableViewController.swift b/Loop/View Controllers/SettingsTableViewController.swift index 965571debe..befd986a4e 100644 --- a/Loop/View Controllers/SettingsTableViewController.swift +++ b/Loop/View Controllers/SettingsTableViewController.swift @@ -328,38 +328,21 @@ class SettingsTableViewController: UITableViewController, DailyValueScheduleTabl let row = ConfigurationRow(rawValue: indexPath.row)! switch row { case .PumpID, .TransmitterID, .InsulinActionDuration, .MaxBasal, .MaxBolus: - let vc = TextFieldTableViewController() + let vc: TextFieldTableViewController switch row { case .PumpID: - vc.placeholder = NSLocalizedString("Enter the 6-digit pump ID", comment: "The placeholder text instructing users how to enter a pump ID") - vc.value = dataManager.pumpID + vc = .pumpID(dataManager.pumpID) case .TransmitterID: - vc.placeholder = NSLocalizedString("Enter the 6-digit transmitter ID", comment: "The placeholder text instructing users how to enter a pump ID") - vc.value = dataManager.transmitterID + vc = .transmitterID(dataManager.transmitterID) case .InsulinActionDuration: - vc.placeholder = NSLocalizedString("Enter a number of hours", comment: "The placeholder text instructing users how to enter an insulin action duration") - vc.keyboardType = .DecimalPad - - if let insulinActionDuration = dataManager.insulinActionDuration { - vc.value = valueNumberFormatter.stringFromNumber(insulinActionDuration.hours) - } + vc = .insulinActionDuration(dataManager.insulinActionDuration) case .MaxBasal: - vc.placeholder = NSLocalizedString("Enter a rate in units per hour", comment: "The placeholder text instructing users how to enter a maximum basal rate") - vc.keyboardType = .DecimalPad - - if let maxBasal = dataManager.maximumBasalRatePerHour { - vc.value = valueNumberFormatter.stringFromNumber(maxBasal) - } + vc = .maxBasal(dataManager.maximumBasalRatePerHour) case .MaxBolus: - vc.placeholder = NSLocalizedString("Enter a number of units", comment: "The placeholder text instructing users how to enter a maximum bolus") - vc.keyboardType = .DecimalPad - - if let maxBolus = dataManager.maximumBolus { - vc.value = valueNumberFormatter.stringFromNumber(maxBolus) - } + vc = .maxBolus(dataManager.maximumBolus) default: - assertionFailure() + fatalError() } vc.title = sender?.textLabel?.text diff --git a/Loop/View Controllers/StatusTableViewController.swift b/Loop/View Controllers/StatusTableViewController.swift index ca75005fcd..ae9f0c268d 100644 --- a/Loop/View Controllers/StatusTableViewController.swift +++ b/Loop/View Controllers/StatusTableViewController.swift @@ -206,15 +206,15 @@ class StatusTableViewController: UITableViewController, UIGestureRecognizerDeleg } reservoirVolume = dataManager.latestReservoirValue?.unitVolume - + if let capacity = dataManager.pumpState?.pumpModel?.reservoirCapacity, resVol = reservoirVolume { reservoirLevel = min(1, max(0, Double(resVol / Double(capacity)))) } - - if let status = dataManager.latestPumpStatus { - reservoirLevel = Double(status.reservoirRemainingPercent) / 100 + + if let status = dataManager.latestPumpStatusFromMySentry { batteryLevel = Double(status.batteryRemainingPercent) / 100 + reservoirLevel = Double(status.reservoirRemainingPercent) / 100 } loopCompletionHUD.dosingEnabled = dataManager.loopManager.dosingEnabled @@ -492,9 +492,9 @@ class StatusTableViewController: UITableViewController, UIGestureRecognizerDeleg switch PumpRow(rawValue: indexPath.row)! { case .Date: - cell.textLabel?.text = NSLocalizedString("Last Sentry", comment: "The title of the cell containing the last updated date") + cell.textLabel?.text = NSLocalizedString("Last MySentry", comment: "The title of the cell containing the last updated mysentry status packet date") - if let date = dataManager.latestPumpStatus?.pumpDateComponents.date { + if let date = dataManager.latestPumpStatusFromMySentry?.pumpDateComponents.date { cell.detailTextLabel?.text = dateFormatter.stringFromDate(date) } else { cell.detailTextLabel?.text = emptyValueString @@ -502,7 +502,7 @@ class StatusTableViewController: UITableViewController, UIGestureRecognizerDeleg case .InsulinOnBoard: 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") - if let iob = dataManager.latestPumpStatus?.iob { + if let iob = dataManager.latestPumpStatusFromMySentry?.iob { let numberValue = NSNumber(double: iob).descriptionWithLocale(locale) cell.detailTextLabel?.text = "\(numberValue) Units" } else { @@ -582,7 +582,7 @@ class StatusTableViewController: UITableViewController, UIGestureRecognizerDeleg UIApplication.sharedApplication().openURL(URL) } case .IOB, .Dose: - performSegueWithIdentifier(ReservoirTableViewController.className, sender: indexPath) + performSegueWithIdentifier(InsulinDeliveryTableViewController.className, sender: indexPath) case .COB: performSegueWithIdentifier(CarbEntryTableViewController.className, sender: indexPath) } @@ -663,7 +663,7 @@ class StatusTableViewController: UITableViewController, UIGestureRecognizerDeleg vc.defaultAbsorptionTimes = carbStore.defaultAbsorptionTimes vc.preferredUnit = carbStore.preferredUnit } - case let vc as ReservoirTableViewController: + case let vc as InsulinDeliveryTableViewController: vc.doseStore = dataManager.doseStore vc.hidesBottomBarWhenPushed = true case let vc as BolusViewController: diff --git a/Loop/View Controllers/TextFieldTableViewController.swift b/Loop/View Controllers/TextFieldTableViewController.swift new file mode 100644 index 0000000000..26f99c4de3 --- /dev/null +++ b/Loop/View Controllers/TextFieldTableViewController.swift @@ -0,0 +1,88 @@ +// +// TextFieldTableViewController.swift +// Loop +// +// Created by Nate Racklyeft on 7/31/16. +// Copyright © 2016 Nathan Racklyeft. All rights reserved. +// + +import LoopKit + + +/// Convenience static constructors used to contain common configuration +extension TextFieldTableViewController { + typealias T = TextFieldTableViewController + + private static let valueNumberFormatter: NSNumberFormatter = { + let formatter = NSNumberFormatter() + + formatter.numberStyle = .DecimalStyle + formatter.minimumFractionDigits = 0 + formatter.maximumFractionDigits = 2 + + return formatter + }() + + static func pumpID(value: String?) -> T { + let vc = T() + + vc.placeholder = NSLocalizedString("Enter the 6-digit pump ID", comment: "The placeholder text instructing users how to enter a pump ID") + vc.keyboardType = .NumberPad + vc.value = value + vc.contextHelp = NSLocalizedString("The pump ID can be found printed on the back, or near the bottom of the STATUS/Esc screen. It is the strictly numerical portion of the serial number (shown as SN or S/N).", comment: "Instructions on where to find the pump ID on a Minimed pump") + + return vc + } + + static func transmitterID(value: String?) -> T { + let vc = T() + + vc.placeholder = NSLocalizedString("Enter the 6-digit transmitter ID", comment: "The placeholder text instructing users how to enter a pump ID") + vc.value = value + vc.contextHelp = NSLocalizedString("The transmitter ID can be found printed on the back of the device, on the side of the box it came in, and from within the settings menus of the G5 receiver and mobile app.", comment: "Instructions on where to find the transmitter ID") + + return vc + } + + static func insulinActionDuration(value: NSTimeInterval?) -> T { + let vc = T() + + vc.placeholder = NSLocalizedString("Enter a number of hours", comment: "The placeholder text instructing users how to enter an insulin action duration") + vc.keyboardType = .DecimalPad + vc.unit = NSLocalizedString("hours", comment: "The unit string for hours") + + if let insulinActionDuration = value { + vc.value = valueNumberFormatter.stringFromNumber(insulinActionDuration.hours) + } + + return vc + } + + static func maxBasal(value: Double?) -> T { + let vc = T() + + vc.placeholder = NSLocalizedString("Enter a rate in units per hour", comment: "The placeholder text instructing users how to enter a maximum basal rate") + vc.keyboardType = .DecimalPad + vc.unit = NSLocalizedString("U/hour", comment: "The unit string for units per hour") + + if let maxBasal = value { + vc.value = valueNumberFormatter.stringFromNumber(maxBasal) + } + + return vc + } + + static func maxBolus(value: Double?) -> T { + let vc = T() + + vc.placeholder = NSLocalizedString("Enter a number of units", comment: "The placeholder text instructing users how to enter a maximum bolus") + vc.keyboardType = .DecimalPad + vc.unit = NSLocalizedString("Units", comment: "The unit string for units") + + if let maxBolus = value { + vc.value = valueNumberFormatter.stringFromNumber(maxBolus) + } + + return vc + } +} diff --git a/LoopTests/KeychainManagerTests.swift b/LoopTests/KeychainManagerTests.swift index 6c783dcae3..31ec0efe26 100644 --- a/LoopTests/KeychainManagerTests.swift +++ b/LoopTests/KeychainManagerTests.swift @@ -21,10 +21,10 @@ class KeychainManagerTests: XCTestCase { try manager.setDexcomShareUsername("foo", password: nil) XCTAssertNil(manager.getDexcomShareCredentials()) - try manager.setNightscoutURL(nil, secret: "foo") + manager.setNightscoutURL(nil, secret: "foo") XCTAssertNil(manager.getNightscoutCredentials()) - try manager.setNightscoutURL(NSURL(string: "foo"), secret: nil) + manager.setNightscoutURL(NSURL(string: "foo"), secret: nil) XCTAssertNil(manager.getNightscoutCredentials()) } @@ -45,12 +45,12 @@ class KeychainManagerTests: XCTestCase { try manager.setDexcomShareUsername(nil, password: nil) XCTAssertNil(manager.getDexcomShareCredentials()) - try manager.setNightscoutURL(NSURL(string: "http://mysite.azurewebsites.net")!, secret: "ABCDEFG") + manager.setNightscoutURL(NSURL(string: "http://mysite.azurewebsites.net")!, secret: "ABCDEFG") let nightscoutCredentials = manager.getNightscoutCredentials()! XCTAssertEqual(NSURL(string: "http://mysite.azurewebsites.net")!, nightscoutCredentials.URL) XCTAssertEqual("ABCDEFG", nightscoutCredentials.secret) - try manager.setNightscoutURL(nil, secret: nil) + manager.setNightscoutURL(nil, secret: nil) XCTAssertNil(manager.getNightscoutCredentials()) try manager.setMLabDatabaseName("sugarmandb", APIKey: "rodriguez") diff --git a/README.md b/README.md index 06a071b369..ca65efec60 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Please understand that this project: - Insulin Pump + Insulin Pump MM 522/722 @@ -43,27 +43,28 @@ Please understand that this project: CGM Dexcom G4 ✅1 2 - ✅1 + ✅1 3 + ✅1 3 Dexcom G5 - ✅2 3 + ✅2 + ✅3 ✅3 MM CGM ❌4 - ✅ - ✅5 + ✅3 + ✅3
1. Offline access to glucose requires a Receiver with Share and the [Share2 app](https://itunes.apple.com/us/app/dexcom-share2/id834775275?mt=8) to be running on the same device. Internet-dependent access via Share servers is also supported.
2. Pump must have a remote ID added in the [Remote Options](https://www.medtronicdiabetes.com/sites/default/files/library/download-library/workbooks/x22_menu_map.pdf) menu. -
3. Early firmware only available on select models is required for using Closed Loop and Bolus features. +
3. Early firmware (US <= 2.4A, AU/EUR <= 2.6A) is required for using Closed Loop and Bolus features.
4. It's not impossible, but comms-heavy and there's some work to be done. File an issue if you're someone who's up for the challenge and can test this hardware configuration. -
5. Confirmed working with AU MM554 firmware 2.6A - unsuccessful reports from some, need to check individual pumps. ### RileyLink @@ -94,9 +95,9 @@ Loop optionally supports select third-party remote services, which are configure | Service | Description | ---------------------- | ------------- | Dexcom Share | Downloads glucose data if a local G5 Transmitter or G4 Receiver with Share is not available. -| Nightscout | Uploads treatments and other pump data. Note you will need to set "Nightscout history uploading" to "On" in Settings for treatments to be fetched from your pump and uploaded to Nightscout. +| Nightscout | Uploads treatments and other pump data. Note that you will need to set "Nightscout history uploading" to "On" in Settings for treatments to be fetched from your pump and uploaded to Nightscout. | mLab | Uploads diagnostic data about each loop run, as well as app errors. At this time, it is strongly recommended that you configure this service in case retrospective analysis is needed. -| Amplitude | Tracks private, single-user behavioral and system analytics +| Amplitude | Tracks private, single-user behavioral and system analytics (no health data is sent) # Making it Your Own diff --git a/WatchApp Extension/Controllers/StatusInterfaceController.swift b/WatchApp Extension/Controllers/StatusInterfaceController.swift index 4740412846..b2a70f46c1 100644 --- a/WatchApp Extension/Controllers/StatusInterfaceController.swift +++ b/WatchApp Extension/Controllers/StatusInterfaceController.swift @@ -50,7 +50,7 @@ class StatusInterfaceController: ContextInterfaceController { dispatch_async(dispatch_get_main_queue()) { if let glucose = context?.glucose, unit = context?.preferredGlucoseUnit { let glucoseValue = glucose.doubleValueForUnit(unit) - let trend = context?.glucoseTrend ?? "" + let trend = context?.glucoseTrend?.description ?? "" self.glucoseLabel.setText((numberFormatter.stringFromNumber(glucoseValue) ?? "") + trend) self.glucoseLabel.setHidden(false) diff --git a/WatchApp Extension/Models/GlucoseTrend.swift b/WatchApp Extension/Models/GlucoseTrend.swift new file mode 100644 index 0000000000..97529dec6d --- /dev/null +++ b/WatchApp Extension/Models/GlucoseTrend.swift @@ -0,0 +1,37 @@ +// +// GlucoseTrend.swift +// Loop +// +// Created by Nate Racklyeft on 8/2/16. +// Copyright © 2016 Nathan Racklyeft. All rights reserved. +// + + +enum GlucoseTrend: Int { + case UpUpUp = 1 + case UpUp = 2 + case Up = 3 + case Flat = 4 + case Down = 5 + case DownDown = 6 + case DownDownDown = 7 + + var description: String { + switch self { + case UpUpUp: + return "⇈" + case UpUp: + return "↑" + case Up: + return "↗" + case Flat: + return "→" + case Down: + return "↘" + case DownDown: + return "↓" + case DownDownDown: + return "⇊" + } + } +} diff --git a/WatchApp Extension/Models/WatchContext.swift b/WatchApp Extension/Models/WatchContext.swift index 3646dc3a98..e7d4ea2872 100644 --- a/WatchApp Extension/Models/WatchContext.swift +++ b/WatchApp Extension/Models/WatchContext.swift @@ -18,7 +18,7 @@ class WatchContext: NSObject, RawRepresentable { var preferredGlucoseUnit: HKUnit? var glucose: HKQuantity? - var glucoseTrend: String? + var glucoseTrend: GlucoseTrend? var eventualGlucose: HKQuantity? var glucoseDate: NSDate? @@ -56,7 +56,10 @@ class WatchContext: NSObject, RawRepresentable { eventualGlucose = HKQuantity(unit: unit, doubleValue: glucoseValue) } } - glucoseTrend = rawValue["gt"] as? String + + if let rawTrend = rawValue["gt"] as? Int { + glucoseTrend = GlucoseTrend(rawValue: rawTrend) + } glucoseDate = rawValue["gd"] as? NSDate IOB = rawValue["iob"] as? Double @@ -87,7 +90,7 @@ class WatchContext: NSObject, RawRepresentable { raw["gv"] = glucose?.doubleValueForUnit(unit) } - raw["gtd"] = glucoseTrend + raw["gt"] = glucoseTrend?.rawValue raw["gd"] = glucoseDate raw["iob"] = IOB raw["ld"] = loopLastRunDate @@ -97,4 +100,4 @@ class WatchContext: NSObject, RawRepresentable { return raw } -} \ No newline at end of file +}