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
6 changes: 3 additions & 3 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github "LoopKit/LoopKit" == 1.2.0
github "LoopKit/LoopKit" == 1.2.1
github "LoopKit/xDripG5" ~> 0.8.0
github "bharat/SwiftCharts" "0.5.1-extension-api-safe"
github "mddub/dexcom-share-client-swift" ~> 0.2.0
github "mddub/G4ShareSpy" ~> 0.3.1
github "mddub/dexcom-share-client-swift" == 0.2.0
github "mddub/G4ShareSpy" == 0.3.1
github "ps2/rileylink_ios" ~> 1.0
github "amplitude/Amplitude-iOS" ~> 3.8.5
4 changes: 2 additions & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github "LoopKit/LoopKit" "v1.2.0"
github "LoopKit/LoopKit" "v1.2.1"
github "LoopKit/xDripG5" "v0.8.0"
github "amplitude/Amplitude-iOS" "v3.14.1"
github "bharat/SwiftCharts" "0.5.1-extension-api-safe"
github "bharat/SwiftCharts" "9faad7c38762a177ae01382def605a77c0e61aba"
github "mddub/G4ShareSpy" "v0.3.1"
github "mddub/dexcom-share-client-swift" "v0.2.0"
github "ps2/rileylink_ios" "v1.0"
14 changes: 7 additions & 7 deletions Carthage/Build/.LoopKit.version

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified Carthage/Build/iOS/CarbKit.framework/CarbKit
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Carthage/Build/iOS/CarbKit.framework/Info.plist
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Carthage/Build/iOS/GlucoseKit.framework/GlucoseKit
Binary file not shown.
Binary file modified Carthage/Build/iOS/GlucoseKit.framework/Info.plist
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Carthage/Build/iOS/InsulinKit.framework/Info.plist
Binary file not shown.
Binary file modified Carthage/Build/iOS/InsulinKit.framework/InsulinKit
Binary file not shown.
Binary file modified Carthage/Build/iOS/InsulinKit.framework/Model.momd/Model.mom
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Carthage/Build/iOS/LoopKit.framework/Assets.car
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Carthage/Build/iOS/LoopKit.framework/Info.plist
Binary file not shown.
Binary file modified Carthage/Build/iOS/LoopKit.framework/LoopKit
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Carthage/Build/iOS/LoopKit.framework/TextFieldTableViewCell.nib
Binary file not shown.
6 changes: 3 additions & 3 deletions Loop/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@
<!--InsulinKit-->
<scene sceneID="n8N-hY-V0o">
<objects>
<viewControllerPlaceholder storyboardName="InsulinKit" bundleIdentifier="com.loudnate.InsulinKit" id="a8v-ef-RZZ" sceneMemberID="viewController">
<viewControllerPlaceholder storyboardName="InsulinKit" bundleIdentifier="com.loopkit.InsulinKit" id="a8v-ef-RZZ" sceneMemberID="viewController">
<navigationItem key="navigationItem" id="BWb-ny-Yc4"/>
</viewControllerPlaceholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="MjI-5q-y5n" userLabel="First Responder" sceneMemberID="firstResponder"/>
Expand All @@ -270,7 +270,7 @@
<!--CarbKit-->
<scene sceneID="4Ej-lH-3ai">
<objects>
<viewControllerPlaceholder storyboardName="CarbKit" bundleIdentifier="com.loudnate.CarbKit" id="Ykd-EQ-C1J" sceneMemberID="viewController">
<viewControllerPlaceholder storyboardName="CarbKit" bundleIdentifier="com.loopkit.CarbKit" id="Ykd-EQ-C1J" sceneMemberID="viewController">
<navigationItem key="navigationItem" id="lyJ-sc-Dqp"/>
</viewControllerPlaceholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="erV-pI-Wmo" userLabel="First Responder" sceneMemberID="firstResponder"/>
Expand Down Expand Up @@ -661,7 +661,7 @@
<!--CarbEntryEditViewController-->
<scene sceneID="efd-D7-aOf">
<objects>
<viewControllerPlaceholder storyboardName="CarbKit" bundleIdentifier="com.loudnate.CarbKit" referencedIdentifier="CarbEntryEditViewController" id="Td9-bv-106" sceneMemberID="viewController">
<viewControllerPlaceholder storyboardName="CarbKit" bundleIdentifier="com.loopkit.CarbKit" referencedIdentifier="CarbEntryEditViewController" id="Td9-bv-106" sceneMemberID="viewController">
<navigationItem key="navigationItem" id="7IM-y8-KQo"/>
</viewControllerPlaceholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="hft-ry-meg" userLabel="First Responder" sceneMemberID="firstResponder"/>
Expand Down
18 changes: 10 additions & 8 deletions Loop/Managers/LoopDataManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,13 @@ final class LoopDataManager {

if insulinEffect == nil {
updateGroup.enter()
deviceDataManager.doseStore.getGlucoseEffects(startDate: effectStartDate) { (effects, error) -> Void in
if let error = error {
deviceDataManager.doseStore.getGlucoseEffects(start: effectStartDate) { result -> Void in
switch result {
case .success(let effects):
self.insulinEffect = effects
case .failure(let error):
self.deviceDataManager.logger.addError(error, fromSource: "DoseStore")
self.insulinEffect = nil
} else {
self.insulinEffect = effects
}

updateGroup.leave()
Expand All @@ -212,12 +213,13 @@ final class LoopDataManager {

if insulinOnBoard == nil {
updateGroup.enter()
deviceDataManager.doseStore.insulinOnBoardAtDate(Date()) { (value, error) in
if let error = error {
deviceDataManager.doseStore.insulinOnBoard(at: Date()) { result in
switch result {
case .success(let values):
self.insulinOnBoard = values
case .failure(let error):
self.deviceDataManager.logger.addError(error, fromSource: "DoseStore")
self.insulinOnBoard = nil
} else {
self.insulinOnBoard = value
}
updateGroup.leave()
}
Expand Down
43 changes: 18 additions & 25 deletions Loop/Managers/StatusExtensionDataManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,31 +92,24 @@ final class StatusExtensionDataManager {
let chartEndDate = Date().addingTimeInterval(TimeInterval(hours: 3))

updateGroup.enter()
glucoseStore.getRecentGlucoseValues(startDate: chartStartDate, endDate: Date()) {
(values, error) in

if let error = error {
self.dataManager.logger.addError(error, fromSource: "GlucoseStore")
context.glucose = nil
context.predictedGlucose = nil
} else {
context.glucose = values.map({
return GlucoseContext(
value: $0.quantity.doubleValue(for: glucoseUnit),
unit: glucoseUnit,
startDate: $0.startDate
)
})

// Only tranfer the predicted glucose if we have glucose history
if let predictedGlucose = predictedGlucose,
predictedGlucose.count > 1 {
context.predictedGlucose = PredictedGlucoseContext(
values: predictedGlucose.map { $0.quantity.doubleValue(for: glucoseUnit) },
unit: glucoseUnit,
startDate: predictedGlucose[0].startDate,
interval: predictedGlucose[1].startDate.timeIntervalSince(predictedGlucose[0].startDate))
}
glucoseStore.getCachedGlucoseValues(start: chartStartDate, end: Date()) {
(values) in
context.glucose = values.map({
return GlucoseContext(
value: $0.quantity.doubleValue(for: glucoseUnit),
unit: glucoseUnit,
startDate: $0.startDate
)
})

// Only tranfer the predicted glucose if we have glucose history
if let predictedGlucose = predictedGlucose,
predictedGlucose.count > 1 {
context.predictedGlucose = PredictedGlucoseContext(
values: predictedGlucose.map { $0.quantity.doubleValue(for: glucoseUnit) },
unit: glucoseUnit,
startDate: predictedGlucose[0].startDate,
interval: predictedGlucose[1].startDate.timeIntervalSince(predictedGlucose[0].startDate))
}
updateGroup.leave()
}
Expand Down
9 changes: 5 additions & 4 deletions Loop/View Controllers/PredictionTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,14 @@ class PredictionTableViewController: UITableViewController, IdentifiableClass, U
}

reloadGroup.enter()
glucoseStore.getRecentGlucoseValues(startDate: self.charts.startDate) { (values, error) -> Void in
if let error = error {
glucoseStore.getGlucoseValues(start: self.charts.startDate) { result -> Void in
switch result {
case .success(let values):
self.charts.setGlucoseValues(values)
case .failure(let error):
self.dataManager.logger.addError(error, fromSource: "GlucoseStore")
self.needsRefresh = true
self.charts.setGlucoseValues([])
} else {
self.charts.setGlucoseValues(values)
}

reloadGroup.leave()
Expand Down
34 changes: 19 additions & 15 deletions Loop/View Controllers/StatusTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,14 @@ final class StatusTableViewController: UITableViewController, UIGestureRecognize

if self.refreshContext.remove(.glucose) != nil {
reloadGroup.enter()
glucoseStore.getRecentGlucoseValues(startDate: self.chartStartDate) { (values, error) -> Void in
if let error = error {
glucoseStore.getGlucoseValues(start: self.chartStartDate) { result -> Void in
switch result {
case .success(let values):
self.charts.setGlucoseValues(values)
case .failure(let error):
self.dataManager.logger.addError(error, fromSource: "GlucoseStore")
self.refreshContext.update(with: .glucose)
self.charts.setGlucoseValues([])
} else {
self.charts.setGlucoseValues(values)
}

reloadGroup.leave()
Expand Down Expand Up @@ -249,36 +250,39 @@ final class StatusTableViewController: UITableViewController, UIGestureRecognize

if refreshContext.remove(.insulin) != nil {
reloadGroup.enter()
dataManager.doseStore.getInsulinOnBoardValues(startDate: chartStartDate) { (values, error) -> Void in
if let error = error {
dataManager.doseStore.getInsulinOnBoardValues(start: chartStartDate) { result -> Void in
switch result {
case .success(let values):
self.charts.setIOBValues(values)
case .failure(let error):
self.dataManager.logger.addError(error, fromSource: "DoseStore")
self.refreshContext.update(with: .insulin)
self.charts.setIOBValues([])
} else {
self.charts.setIOBValues(values)
}
reloadGroup.leave()
}

reloadGroup.enter()
dataManager.doseStore.getRecentNormalizedDoseEntries(startDate: chartStartDate) { (doses, error) -> Void in
if let error = error {
dataManager.doseStore.getNormalizedDoseEntries(start: chartStartDate) { result -> Void in
switch result {
case .failure(let error):
self.dataManager.logger.addError(error, fromSource: "DoseStore")
self.refreshContext.update(with: .insulin)
self.charts.setDoseEntries([])
} else {
case .success(let doses):
self.charts.setDoseEntries(doses)
}
reloadGroup.leave()
}

reloadGroup.enter()
dataManager.doseStore.getTotalRecentUnitsDelivered { (units, _, error) in
if error != nil {
dataManager.doseStore.getTotalUnitsDelivered(since: Calendar.current.startOfDay(for: Date())) { result in
switch result {
case .success(let units):
self.totalDelivery = units.value
case .failure:
self.refreshContext.update(with: .insulin)
self.totalDelivery = nil
} else {
self.totalDelivery = units
}

reloadGroup.leave()
Expand Down