Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2a80ed4
Merge remote-tracking branch 'LoopKit/dev' into dev
dm61 Oct 9, 2017
7658972
Merge remote-tracking branch 'LoopKit/dev' into dev
dm61 Nov 3, 2017
47ad706
Merge remote-tracking branch 'LoopKit/dev' into dev
dm61 Nov 4, 2017
f573283
Merge remote-tracking branch 'LoopKit/dev' into dev
dm61 Nov 18, 2017
a87fdc0
Merge remote-tracking branch 'LoopKit/dev' into dev
dm61 Dec 5, 2017
3d9f17b
Merge remote-tracking branch 'LoopKit/dev' into dev
dm61 Dec 5, 2017
155e0a1
Merge remote-tracking branch 'LoopKit/dev' into dev
dm61 Dec 16, 2017
9335bc3
Merge remote-tracking branch 'LoopKit/dev' into dev
dm61 Dec 20, 2017
b618eb3
Merge remote-tracking branch 'LoopKit/dev' into dev
dm61 Dec 22, 2017
d6e04fc
Merge remote-tracking branch 'LoopKit/dev' into dev
dm61 Jan 13, 2018
13f5bfa
Merge remote-tracking branch 'LoopKit/dev' into dev
dm61 Feb 18, 2018
ae9768d
Merge remote-tracking branch 'LoopKit/dev' into dev
dm61 Mar 13, 2018
1a0fc78
Merge remote-tracking branch 'LoopKit/dev' into dev
dm61 Apr 7, 2018
10313f2
Merge remote-tracking branch 'LoopKit/dev' into dev
dm61 Apr 16, 2018
07e9e18
Merge branch 'LoopKit/dev' into dev
dm61 May 5, 2018
aabc1f3
Merge branch 'LoopKit/dev' into dev
dm61 May 5, 2018
1a20625
Merge remote-tracking branch 'LoopKit/dev' into dev
dm61 May 13, 2018
42e2e16
Merge remote-tracking branch 'LoopKit/dev' into dev
dm61 Jun 15, 2018
2702fc7
Merge remote-tracking branch 'LoopKit/dev' into dev
dm61 Jun 15, 2018
a90f70b
Merge remote-tracking branch 'LoopKit/dev' into dev
dm61 Jun 19, 2018
5bed039
Merge remote-tracking branch 'LoopKit/dev' into dev
dm61 Jul 18, 2018
040e7a4
Merge remote-tracking branch 'LoopKit/dev' into dev
dm61 Jul 19, 2018
1bede2b
Add suspend threshold line to glucose chart
dm61 Jul 29, 2018
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
2 changes: 2 additions & 0 deletions Loop Status Extension/StatusViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class StatusViewController: UIViewController, NCWidgetProviding {
axisLine: .axisLineColor,
axisLabel: .axisLabelColor,
grid: .gridColor,
threshold: .thresholdLineColor,
glucoseTint: .glucoseTintColor,
doseTint: .doseTintColor
),
Expand Down Expand Up @@ -295,6 +296,7 @@ class StatusViewController: UIViewController, NCWidgetProviding {
}

self.charts.targetGlucoseSchedule = defaults.loopSettings?.glucoseTargetRangeSchedule
self.charts.suspendThresholdValue = nil // do not add SuspendThreshold line to the widget

self.charts.prerender()
self.glucoseChartContentView.reloadChart()
Expand Down
2 changes: 2 additions & 0 deletions Loop Status Extension/UIColor+Widget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ extension UIColor {
@nonobjc static let pumpStatusNormal = UIColor(red: 100 / 255, green: 101 / 255, blue: 105 / 255, alpha: 1)

@nonobjc static let subtitleLabelColor = UIColor(white: 0, alpha: 0.4)

@nonobjc static let thresholdLineColor = UIColor.HIGRedColor()
}
2 changes: 1 addition & 1 deletion Loop/Extensions/ChartColorPalette+Loop.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ import LoopUI

extension ChartColorPalette {
static var `default`: ChartColorPalette {
return ChartColorPalette(axisLine: .axisLineColor, axisLabel: .axisLabelColor, grid: .gridColor, glucoseTint: .glucoseTintColor, doseTint: .doseTintColor)
return ChartColorPalette(axisLine: .axisLineColor, axisLabel: .axisLabelColor, grid: .gridColor, threshold: .thresholdLineColor, glucoseTint: .glucoseTintColor, doseTint: .doseTintColor)
}
}
2 changes: 2 additions & 0 deletions Loop/Extensions/UIColor+Loop.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ extension UIColor {
@nonobjc static let gridColor = UIColor(white: 193 / 255, alpha: 1)

@nonobjc static let pumpStatusNormal = secondaryLabelColor

@nonobjc static let thresholdLineColor = UIColor.HIGRedColor()
}
1 change: 1 addition & 0 deletions Loop/View Controllers/PredictionTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ class PredictionTableViewController: ChartsTableViewController, IdentifiableClas

if self.refreshContext.remove(.targets) != nil {
self.charts.targetGlucoseSchedule = manager.settings.glucoseTargetRangeSchedule
self.charts.suspendThresholdValue = manager.settings.suspendThreshold?.quantity.doubleValue(for: self.charts.glucoseUnit)
}

reloadGroup.leave()
Expand Down
1 change: 1 addition & 0 deletions Loop/View Controllers/StatusTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ final class StatusTableViewController: ChartsTableViewController {
if currentContext.contains(.targets) {
self.charts.targetGlucoseSchedule = self.deviceManager.loopManager.settings.glucoseTargetRangeSchedule
}
self.charts.suspendThresholdValue = self.deviceManager.loopManager.settings.suspendThreshold?.quantity.doubleValue(for: self.charts.glucoseUnit)

// Active Insulin
if let iobValues = iobValues {
Expand Down
18 changes: 18 additions & 0 deletions LoopUI/Managers/StatusChartsManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ public final class StatusChartsManager {
glucoseChart = nil
}
}

/// Suspend Threshold value
public var suspendThresholdValue: Double? = nil

/// The chart points for IOB
public var iobPoints: [ChartPoint] = [] {
Expand Down Expand Up @@ -368,6 +371,20 @@ public final class StatusChartsManager {
)
]
)

// SuspendThreshold line
var suspendThresholdLayer: ChartPointsLineLayer? = nil
if suspendThresholdValue != nil {
if suspendThresholdValue! >= yAxisLayer.axis.first {
let lineModel = ChartLineModel(
chartPoints: [ChartPoint(x: ChartAxisValueDouble(xAxisLayer.axis.first),
y: ChartAxisValueDouble(suspendThresholdValue!)),
ChartPoint(x: ChartAxisValueDouble(xAxisLayer.axis.last),
y: ChartAxisValueDouble(suspendThresholdValue!))],
lineColor: colors.threshold.withAlphaComponent(0.4), lineWidth: 1, animDuration: 0, animDelay: 0)
suspendThresholdLayer = ChartPointsLineLayer(xAxis: xAxisLayer.axis, yAxis: yAxisLayer.axis, lineModels: [lineModel])
}
}

// Grid lines
let gridLayer = ChartGuideLinesForValuesLayer(xAxis: xAxisLayer.axis, yAxis: yAxisLayer.axis, settings: guideLinesLayerSettings, axisValuesX: Array(xAxisValues.dropFirst().dropLast()), axisValuesY: yAxisValues)
Expand Down Expand Up @@ -411,6 +428,7 @@ public final class StatusChartsManager {
let layers: [ChartLayer?] = [
gridLayer,
targetsLayer,
suspendThresholdLayer,
xAxisLayer,
yAxisLayer,
glucoseChartCache?.highlightLayer,
Expand Down
4 changes: 3 additions & 1 deletion LoopUI/Models/ChartColorPalette.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ public struct ChartColorPalette {
public let axisLine: UIColor
public let axisLabel: UIColor
public let grid: UIColor
public let threshold: UIColor
public let glucoseTint: UIColor
public let doseTint: UIColor

public init(axisLine: UIColor, axisLabel: UIColor, grid: UIColor, glucoseTint: UIColor, doseTint: UIColor) {
public init(axisLine: UIColor, axisLabel: UIColor, grid: UIColor, threshold: UIColor, glucoseTint: UIColor, doseTint: UIColor) {
self.axisLine = axisLine
self.axisLabel = axisLabel
self.grid = grid
self.threshold = threshold
self.glucoseTint = glucoseTint
self.doseTint = doseTint
}
Expand Down