Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Common/Extensions/NumberFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ extension NumberFormatter {
return numberFormatter
}

public func describingGlucose(_ value: Double, for unit: HKUnit) -> String? {
func describingGlucose(_ value: Double, for unit: HKUnit) -> String? {
guard let stringValue = string(from: NSNumber(value: value)) else {
return nil
}
Expand All @@ -35,7 +35,7 @@ extension NumberFormatter {
)
}

@nonobjc public func describingGlucose(_ value: HKQuantity, for unit: HKUnit) -> String? {
@nonobjc func describingGlucose(_ value: HKQuantity, for unit: HKUnit) -> String? {
return describingGlucose(value.doubleValue(for: unit), for: unit)
}

Expand Down
10 changes: 10 additions & 0 deletions Loop.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
4302F4E31D4EA54200F0FCAF /* InsulinDeliveryTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4302F4E21D4EA54200F0FCAF /* InsulinDeliveryTableViewController.swift */; };
4302F4E51D4EA75100F0FCAF /* DoseStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4302F4E41D4EA75100F0FCAF /* DoseStore.swift */; };
43076BF31DFDBC4B0012A723 /* it.lproj in Resources */ = {isa = PBXBuildFile; fileRef = 43076BF21DFDBC4B0012A723 /* it.lproj */; };
430C1ABD1E5568A80067F1AE /* StatusChartManager+LoopKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 430C1ABC1E5568A80067F1AE /* StatusChartManager+LoopKit.swift */; };
430DA58E1D4AEC230097D1CA /* NSBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 430DA58D1D4AEC230097D1CA /* NSBundle.swift */; };
430DA5901D4B0E4C0097D1CA /* MySentryPumpStatusMessageBody.swift in Sources */ = {isa = PBXBuildFile; fileRef = 430DA58F1D4B0E4C0097D1CA /* MySentryPumpStatusMessageBody.swift */; };
4313EDE01D8A6BF90060FA79 /* ChartContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4313EDDF1D8A6BF90060FA79 /* ChartContentView.swift */; };
Expand Down Expand Up @@ -103,6 +104,7 @@
43CA93371CB98079000026B5 /* MinimedKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 43CA93361CB98079000026B5 /* MinimedKit.framework */; };
43CB2B2B1D924D450079823D /* WCSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43CB2B2A1D924D450079823D /* WCSession.swift */; };
43CE7CDE1CA8B63E003CC1B0 /* Data.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43CE7CDD1CA8B63E003CC1B0 /* Data.swift */; };
43CEE6E61E56AFD400CB9116 /* NightscoutUploader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43CEE6E51E56AFD400CB9116 /* NightscoutUploader.swift */; };
43DBF04C1C93B8D700B3C386 /* BolusViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43DBF04B1C93B8D700B3C386 /* BolusViewController.swift */; };
43DBF0531C93EC8200B3C386 /* DeviceDataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43DBF0521C93EC8200B3C386 /* DeviceDataManager.swift */; };
43DBF0591C93F73800B3C386 /* CarbEntryTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43DBF0581C93F73800B3C386 /* CarbEntryTableViewController.swift */; };
Expand Down Expand Up @@ -148,6 +150,7 @@
43F78D4C1C914197002152D1 /* CarbKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 43F78D481C914197002152D1 /* CarbKit.framework */; };
43F78D4D1C914197002152D1 /* GlucoseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 43F78D491C914197002152D1 /* GlucoseKit.framework */; };
43F78D4F1C914197002152D1 /* LoopKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 43F78D4B1C914197002152D1 /* LoopKit.framework */; };
43FCBBC21E51710B00343C1B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 43776F9A1B8022E90074EA36 /* LaunchScreen.storyboard */; };
4D3B40041D4A9E1A00BC6334 /* G4ShareSpy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D3B40021D4A9DFE00BC6334 /* G4ShareSpy.framework */; };
4D5B7A4B1D457CCA00796CA9 /* GlucoseG4.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D5B7A4A1D457CCA00796CA9 /* GlucoseG4.swift */; };
4F2C15741E0209F500E160D4 /* NSTimeInterval.swift in Sources */ = {isa = PBXBuildFile; fileRef = 439897341CD2F7DE00223065 /* NSTimeInterval.swift */; };
Expand Down Expand Up @@ -333,6 +336,7 @@
4302F4E21D4EA54200F0FCAF /* InsulinDeliveryTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InsulinDeliveryTableViewController.swift; sourceTree = "<group>"; };
4302F4E41D4EA75100F0FCAF /* DoseStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DoseStore.swift; sourceTree = "<group>"; };
43076BF21DFDBC4B0012A723 /* it.lproj */ = {isa = PBXFileReference; lastKnownFileType = folder; path = it.lproj; sourceTree = "<group>"; };
430C1ABC1E5568A80067F1AE /* StatusChartManager+LoopKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "StatusChartManager+LoopKit.swift"; sourceTree = "<group>"; };
430DA58D1D4AEC230097D1CA /* NSBundle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSBundle.swift; sourceTree = "<group>"; };
430DA58F1D4B0E4C0097D1CA /* MySentryPumpStatusMessageBody.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MySentryPumpStatusMessageBody.swift; sourceTree = "<group>"; };
4313EDDF1D8A6BF90060FA79 /* ChartContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChartContentView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -433,6 +437,7 @@
43CA93361CB98079000026B5 /* MinimedKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MinimedKit.framework; path = Carthage/Build/iOS/MinimedKit.framework; sourceTree = "<group>"; };
43CB2B2A1D924D450079823D /* WCSession.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WCSession.swift; sourceTree = "<group>"; };
43CE7CDD1CA8B63E003CC1B0 /* Data.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Data.swift; sourceTree = "<group>"; };
43CEE6E51E56AFD400CB9116 /* NightscoutUploader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NightscoutUploader.swift; sourceTree = "<group>"; };
43D533BB1CFD1DD7009E3085 /* WatchApp Extension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "WatchApp Extension.entitlements"; sourceTree = "<group>"; };
43DBF04B1C93B8D700B3C386 /* BolusViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = BolusViewController.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
43DBF0521C93EC8200B3C386 /* DeviceDataManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = DeviceDataManager.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
Expand Down Expand Up @@ -784,6 +789,7 @@
43CE7CDD1CA8B63E003CC1B0 /* Data.swift */,
4302F4E41D4EA75100F0FCAF /* DoseStore.swift */,
C15713811DAC6983005BC4D2 /* MealBolusNightscoutTreatment.swift */,
43CEE6E51E56AFD400CB9116 /* NightscoutUploader.swift */,
4398973A1CD2FC2000223065 /* NSDateFormatter.swift */,
43E344A31B9E1B1C00C85C07 /* NSUserDefaults.swift */,
43BFF0CA1E466C0900FF19A9 /* StateColorPalette.swift */,
Expand Down Expand Up @@ -850,6 +856,7 @@
43C094491CACCC73001F6403 /* NotificationManager.swift */,
432E73CA1D24B3D6009AD15D /* RemoteDataManager.swift */,
43EB40851C82646A00472A8C /* StatusChartManager.swift */,
430C1ABC1E5568A80067F1AE /* StatusChartManager+LoopKit.swift */,
4F70C20F1DE8FAC5006380B7 /* StatusExtensionDataManager.swift */,
4328E0341CFC0AE100E199AA /* WatchDataManager.swift */,
);
Expand Down Expand Up @@ -1234,6 +1241,7 @@
buildActionMask = 2147483647;
files = (
C1C73F081DE3D0260022FC89 /* InfoPlist.strings in Resources */,
43FCBBC21E51710B00343C1B /* LaunchScreen.storyboard in Resources */,
43776F991B8022E90074EA36 /* Assets.xcassets in Resources */,
434F54591D28805E002A9274 /* ButtonTableViewCell.xib in Resources */,
C1C73F021DE3D0250022FC89 /* Localizable.strings in Resources */,
Expand Down Expand Up @@ -1408,8 +1416,10 @@
435400341C9F878D00D5819C /* SetBolusUserInfo.swift in Sources */,
437D9BA31D7BC977007245E8 /* PredictionTableViewController.swift in Sources */,
43F41C371D3BF32400C11ED6 /* UIAlertController.swift in Sources */,
430C1ABD1E5568A80067F1AE /* StatusChartManager+LoopKit.swift in Sources */,
433EA4C41D9F71C800CD78FB /* CommandResponseViewController.swift in Sources */,
434F545F1D288345002A9274 /* ShareService.swift in Sources */,
43CEE6E61E56AFD400CB9116 /* NightscoutUploader.swift in Sources */,
4328E0331CFC091100E199AA /* WatchContext+LoopKit.swift in Sources */,
4F526D611DF8D9A900A04910 /* NetBasal.swift in Sources */,
4398973B1CD2FC2000223065 /* NSDateFormatter.swift in Sources */,
Expand Down
10 changes: 10 additions & 0 deletions Loop/Extensions/ChartPoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,13 @@ extension ChartPoint {
}


extension ChartPoint: TimelineValue {
public var startDate: Date {
if let dateValue = x as? ChartAxisValueDate {
return dateValue.date
} else {
return Date.distantPast
}
}
}

51 changes: 51 additions & 0 deletions Loop/Extensions/NightscoutUploader.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//
// NightscoutUploader.swift
// Loop
//
// Copyright © 2017 LoopKit Authors. All rights reserved.
//

import CarbKit
import NightscoutUploadKit


extension NightscoutUploader: CarbStoreSyncDelegate {
public func carbStore(_ carbStore: CarbStore, hasEntriesNeedingUpload entries: [CarbEntry], withCompletion completionHandler: @escaping (_ uploadedObjects: [String]) -> Void) {

let nsCarbEntries = entries.map({ MealBolusNightscoutTreatment(carbEntry: $0)})

upload(nsCarbEntries) { (result) in
switch result {
case .success(let ids):
// Pass new ids back
completionHandler(ids)
case .failure:
completionHandler([])
}
}
}

public func carbStore(_ carbStore: CarbStore, hasModifiedEntries entries: [CarbEntry], withCompletion completionHandler: @escaping (_ uploadedObjects: [String]) -> Void) {

let nsCarbEntries = entries.map({ MealBolusNightscoutTreatment(carbEntry: $0)})

modifyTreatments(nsCarbEntries) { (error) in
if error != nil {
completionHandler([])
} else {
completionHandler(entries.map { $0.externalId ?? "" } )
}
}
}

public func carbStore(_ carbStore: CarbStore, hasDeletedEntries ids: [String], withCompletion completionHandler: @escaping ([String]) -> Void) {

deleteTreatmentsById(ids) { (error) in
if error != nil {
completionHandler([])
} else {
completionHandler(ids)
}
}
}
}
26 changes: 13 additions & 13 deletions Loop/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>$(MAIN_APP_BUNDLE_IDENTIFIER)</string>
</array>
</dict>
</array>
<key>AppGroupIdentifier</key>
<string>$(APP_GROUP_IDENTIFIER)</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>CFBundleDisplayName</key>
<string>Loop</string>
<key>CFBundleExecutable</key>
Expand All @@ -31,8 +22,19 @@
<string>1.3.0dev</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>$(MAIN_APP_BUNDLE_IDENTIFIER)</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>dexcomcgm</string>
Expand Down Expand Up @@ -86,7 +88,5 @@ Glucose data retrieved from the CGM is stored securely in HealthKit.</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>AppGroupIdentifier</key>
<string>$(APP_GROUP_IDENTIFIER)</string>
</dict>
</plist>
Loading