Skip to content

Commit 5feea7f

Browse files
authored
Merge pull request #920 from LoopKit/tidepool-dev-sync
Tidepool dev sync
2 parents 1a96620 + c301285 commit 5feea7f

File tree

57 files changed

+1771
-1483
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1771
-1483
lines changed

Cartfile.resolved

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
github "LoopKit/Amplitude-iOS" "2137d5fd44bf630ed33e1e72d7af6d8f8612f270"
2-
github "LoopKit/CGMBLEKit" "ea1267791c66e884f1013fffd36faf4555cc6eaf"
3-
github "LoopKit/G4ShareSpy" "fed5a389e3e47e3a1953878dd21852aa5f44b360"
4-
github "LoopKit/LoopKit" "e386a24577244ee6b2add52e8b2aff0385c2200b"
5-
github "LoopKit/dexcom-share-client-swift" "b0419edf55c7f389b36cb47dd5c376bbd3d03d69"
2+
github "LoopKit/CGMBLEKit" "6d77ba2983ce57388d1df81c507738bb7a283149"
3+
github "LoopKit/G4ShareSpy" "ffbb8d65564f662369bbaf93dd9e147be9d1137e"
4+
github "LoopKit/LoopKit" "e560de9bd3b0e89eca5661d10186f84bf1fa10e4"
5+
github "LoopKit/dexcom-share-client-swift" "dc39f5c579c004a8305df1584a9e479ace07966c"
66
github "i-schuetz/SwiftCharts" "0.6.5"
7-
github "maxkonovalov/MKRingProgressView" "2.2.1"
8-
github "ps2/rileylink_ios" "e0dc72050510fb8bf7fc85f655b8d24dc4de0097"
7+
github "maxkonovalov/MKRingProgressView" "2.2.2"
8+
github "ps2/rileylink_ios" "be5bb7f1ef37a5c22bfa4b5493ae698786157271"

Common/Extensions/GlucoseRangeSchedule.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ extension GlucoseRangeSchedule {
4646
}
4747

4848

49-
extension Range where Bound == HKQuantity {
49+
extension ClosedRange where Bound == HKQuantity {
5050
func averageValue(for unit: HKUnit) -> Double {
5151
let minValue = lowerBound.doubleValue(for: unit)
5252
let maxValue = upperBound.doubleValue(for: unit)

Common/Extensions/HKUnit.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,6 @@ extension HKUnit {
3636
}
3737
}
3838

39-
/// An example value for the "ideal" target
40-
var glucoseExampleTargetValue: Double {
41-
if self == .milligramsPerDeciliter {
42-
return 100
43-
} else {
44-
return 5.5
45-
}
46-
}
47-
4839
/// The smallest value expected to be visible on a chart
4940
var chartableIncrement: Double {
5041
if self == .milligramsPerDeciliter {

Common/Extensions/NSBundle.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ extension Bundle {
3030
return object(forInfoDictionaryKey: "AppGroupIdentifier") as! String
3131
}
3232

33+
var isAppExtension: Bool {
34+
return bundleURL.pathExtension == "appex"
35+
}
36+
3337
var mainAppUrl: URL? {
3438
if let mainAppBundleIdentifier = mainAppBundleIdentifier {
3539
return URL(string: "\(mainAppBundleIdentifier)://")

Common/Extensions/NSTimeInterval.swift

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ extension TimeInterval {
2222
return TimeInterval(hours: hours)
2323
}
2424

25-
static func days(_ days: Double) -> TimeInterval {
26-
return TimeInterval(days: days)
27-
}
28-
2925
init(minutes: Double) {
3026
self.init(minutes * 60)
3127
}
@@ -34,15 +30,12 @@ extension TimeInterval {
3430
self.init(minutes: hours * 60)
3531
}
3632

37-
init(days: Double) {
38-
self.init(hours: days * 24)
39-
}
40-
4133
var minutes: Double {
4234
return self / 60.0
4335
}
4436

4537
var hours: Double {
4638
return minutes / 60.0
4739
}
40+
4841
}

Common/Extensions/SampleValue.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import LoopKit
1111

1212
extension Collection where Element == SampleValue {
1313
/// O(n)
14-
var quantityRange: Range<HKQuantity>? {
14+
var quantityRange: ClosedRange<HKQuantity>? {
1515
var lowest: HKQuantity?
1616
var highest: HKQuantity?
1717

@@ -33,6 +33,6 @@ extension Collection where Element == SampleValue {
3333
return nil
3434
}
3535

36-
return l..<h
36+
return l...h
3737
}
3838
}

Common/Models/StatusExtensionContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct SensorDisplayableContext: SensorDisplayable {
2727
let isLocal: Bool
2828
}
2929

30-
struct GlucoseContext {
30+
struct GlucoseContext: GlucoseValue {
3131
let value: Double
3232
let unit: HKUnit
3333
let startDate: Date

Learn/Configuration/NumberRangeEntry.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import UIKit
1111
class NumberRangeEntry: LessonSectionProviding {
1212
let headerTitle: String?
1313

14-
let footerTitle: String? = nil
15-
1614
var cells: [LessonCellProviding] {
1715
return numberCells
1816
}

Learn/Configuration/QuantityRangeEntry.swift

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,22 @@ class QuantityRangeEntry: LessonSectionProviding {
6767

6868
numberRange = NumberRangeEntry(
6969
headerTitle: headerTitle,
70-
minValue: NSNumber(value: minValue?.doubleValue(for: unit)),
71-
maxValue: NSNumber(value: maxValue?.doubleValue(for: unit)),
70+
minValue: (minValue?.doubleValue(for: unit)).map(NSNumber.init(value:)),
71+
maxValue: (maxValue?.doubleValue(for: unit)).map(NSNumber.init(value:)),
7272
formatter: quantityFormatter.numberFormatter,
7373
unitString: quantityFormatter.string(from: unit),
7474
keyboardType: keyboardType
7575
)
7676
}
77+
78+
internal class func glucoseRange(minValue: HKQuantity, maxValue: HKQuantity, quantityFormatter: QuantityFormatter, unit: HKUnit) -> QuantityRangeEntry {
79+
return QuantityRangeEntry(
80+
headerTitle: NSLocalizedString("Range", comment: "Section title for glucose range"),
81+
minValue: minValue,
82+
maxValue: maxValue,
83+
quantityFormatter: quantityFormatter,
84+
unit: unit,
85+
keyboardType: unit == .milligramsPerDeciliter ? .numberPad : .decimalPad
86+
)
87+
}
7788
}

Learn/Extensions/NSNumber.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,3 @@ extension NSNumber: Comparable {
1313
return lhs.compare(rhs) == .orderedAscending
1414
}
1515
}
16-
17-
18-
extension NSNumber {
19-
convenience init?(value: Double?) {
20-
if let value = value {
21-
self.init(value: value)
22-
} else {
23-
return nil
24-
}
25-
}
26-
}

0 commit comments

Comments
 (0)