Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
60ff1ed
Use CGMManagerUI protocol for CGM setup, settings, and ingestion
ps2 Sep 16, 2018
3a621bd
Merge pull request #808 from LoopKit/CGMManager
ps2 Sep 16, 2018
ad3c296
Merge branch 'dev' into master
ps2 Sep 18, 2018
8104ff3
Merge pull request #811 from LoopKit/master
ps2 Sep 18, 2018
21b6ec1
Shorcuts: Add Carbs (#812)
ps2 Sep 20, 2018
4685f37
Update LoopKit rev
ps2 Oct 2, 2018
0511d05
Update rileylink_ios rev
ps2 Oct 2, 2018
fbb9f02
Refactor RC as a timeline (#820)
ps2 Oct 4, 2018
8e1df7c
Watch merge (#824)
ps2 Oct 5, 2018
34c390a
Watch Feature Updates (#825)
ps2 Oct 6, 2018
f156f46
Move data to a 3rd page
Oct 14, 2018
e47b498
Clean up sizes and strings. Size is only verified on 40mm
Oct 14, 2018
e13a013
Defer Watch App page change until willActivate (#831)
ps2 Oct 14, 2018
9264678
Second pass at getting chart size correct
Oct 14, 2018
f6f982d
Merge branch 'dev' into dev-watch
Oct 15, 2018
09aeb6c
Use platter visual effect for data page
Oct 15, 2018
045ff82
Fix chart sizes for all watch variants
Oct 15, 2018
6390693
Fix issues in the code that saves the start page
Oct 16, 2018
e5e7976
Remember and restore the graph visible duration
Oct 16, 2018
faf3489
Update Watch app icons (#835)
ps2 Oct 17, 2018
86ed39b
bump version for dev
ps2 Oct 19, 2018
557e209
Switch back to 2 pages and put the data under the graph
Oct 20, 2018
df90cd5
First attempt at a hybrid mode. It's a little cluttered
Oct 23, 2018
cdc60ab
Show Active Insulin at the bottom of the graph, get rid of custom scr…
Oct 23, 2018
8e846b7
Fix dangling outlet; adjust the size of graph on 42mm
Oct 24, 2018
d623160
Remove IOB & COB text from labels
Oct 25, 2018
14d2da9
Use screen bound ranges to identify watch models; Add more top margin…
Oct 26, 2018
2f75072
minor cleanups
Nov 15, 2018
8375c05
Merge branch 'dev' into dev-watch-hybrid2
Nov 15, 2018
ee753a2
Make the spacing from the top of the graph to the baseline of the
Nov 20, 2018
ae68b7b
Fix a case where the watch chart doesn't update on appear (#858)
ps2 Jan 7, 2019
1746a75
All pump event ids must be marked as processed in upload callback (#856)
ps2 Jan 7, 2019
f9b6d42
Display longer boluses as points on delivery graph (#844)
ps2 Jan 7, 2019
812bbd7
Update dependencies (#860)
ps2 Jan 7, 2019
7797dda
Add default-level logging throughout lifecycle (#861)
ps2 Jan 8, 2019
550f4d9
Resolve warnings about complication image size (#862)
ps2 Jan 8, 2019
472e739
Bharat watch hybrid2 (#863)
ps2 Jan 8, 2019
b004e47
Merge branch 'dev' into dev-watch
Jan 14, 2019
7500ac6
Merge branch 'dev-watch' into dev-watch-hybrid2
Jan 14, 2019
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
11 changes: 6 additions & 5 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
github "LoopKit/LoopKit" == 2.1.3
github "LoopKit/CGMBLEKit" == 2.1.1

github "LoopKit/LoopKit" "dev"
github "LoopKit/CGMBLEKit" "dev"
github "i-schuetz/SwiftCharts" == 0.6.2
github "mddub/dexcom-share-client-swift" == 0.4.1
github "mddub/G4ShareSpy" == 0.3.3
github "ps2/rileylink_ios" == 2.0.6
github "LoopKit/dexcom-share-client-swift" "dev"
github "LoopKit/G4ShareSpy" "dev"
github "ps2/rileylink_ios" "dev"
github "LoopKit/Amplitude-iOS" "decreepify"
10 changes: 5 additions & 5 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github "LoopKit/Amplitude-iOS" "2137d5fd44bf630ed33e1e72d7af6d8f8612f270"
github "LoopKit/CGMBLEKit" "v2.1.1"
github "LoopKit/LoopKit" "v2.1.3"
github "LoopKit/CGMBLEKit" "f868f1366c8a464763fb86ca077e768282a9b197"
github "LoopKit/G4ShareSpy" "3c7040cc93f28b778b6d265e3224974b4ea31483"
github "LoopKit/LoopKit" "1dc7b3ec4b7c6bb9225545f5d8fe599bfe783a5c"
github "LoopKit/dexcom-share-client-swift" "13e0f5cfd98dd4bfdf5eff413ba3ed36617cbb08"
github "i-schuetz/SwiftCharts" "0.6.2"
github "mddub/G4ShareSpy" "v0.3.3"
github "mddub/dexcom-share-client-swift" "v0.4.1"
github "ps2/rileylink_ios" "v2.0.6"
github "ps2/rileylink_ios" "f3597c78ae00da2f35ef98269056126af4ce070f"
91 changes: 91 additions & 0 deletions Common/Base.lproj/Intents.intentdefinition
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>INEnums</key>
<array/>
<key>INIntentDefinitionModelVersion</key>
<string>1.0</string>
<key>INIntentDefinitionSystemVersion</key>
<string>17G65</string>
<key>INIntentDefinitionToolsBuildVersion</key>
<string>10L232m</string>
<key>INIntentDefinitionToolsVersion</key>
<string>10.0</string>
<key>INIntents</key>
<array>
<dict>
<key>INIntentCategory</key>
<string>create</string>
<key>INIntentDescriptionID</key>
<string>yc02Yq</string>
<key>INIntentLastParameterTag</key>
<integer>0</integer>
<key>INIntentName</key>
<string>NewCarbEntry</string>
<key>INIntentParameterCombinations</key>
<dict>
<key></key>
<dict>
<key>INIntentParameterCombinationIsPrimary</key>
<true/>
<key>INIntentParameterCombinationSubtitle</key>
<string></string>
<key>INIntentParameterCombinationSubtitleID</key>
<string>bOiZXO</string>
<key>INIntentParameterCombinationSupportsBackgroundExecution</key>
<false/>
<key>INIntentParameterCombinationTitle</key>
<string>Add Carb Entry</string>
<key>INIntentParameterCombinationTitleID</key>
<string>OcNxIj</string>
</dict>
</dict>
<key>INIntentParameters</key>
<array/>
<key>INIntentResponse</key>
<dict>
<key>INIntentResponseCodes</key>
<array>
<dict>
<key>INIntentResponseCodeFormatString</key>
<string></string>
<key>INIntentResponseCodeFormatStringID</key>
<string>SP7STY</string>
<key>INIntentResponseCodeName</key>
<string>failure</string>
<key>INIntentResponseCodeSuccess</key>
<false/>
</dict>
<dict>
<key>INIntentResponseCodeFormatString</key>
<string></string>
<key>INIntentResponseCodeFormatStringID</key>
<string>I1DB3p</string>
<key>INIntentResponseCodeName</key>
<string>success</string>
<key>INIntentResponseCodeSuccess</key>
<true/>
</dict>
</array>
<key>INIntentResponseLastParameterTag</key>
<integer>0</integer>
<key>INIntentResponseParameters</key>
<array/>
</dict>
<key>INIntentRestrictions</key>
<integer>0</integer>
<key>INIntentTitle</key>
<string>Add Carb Entry</string>
<key>INIntentTitleID</key>
<string>80eo5o</string>
<key>INIntentType</key>
<string>Custom</string>
<key>INIntentUserConfirmationRequired</key>
<false/>
<key>INIntentVerb</key>
<string>Add</string>
</dict>
</array>
</dict>
</plist>
28 changes: 28 additions & 0 deletions Common/Extensions/Double.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// Double.swift
// Loop
//
// Copyright © 2018 LoopKit Authors. All rights reserved.
//

import Foundation


extension FloatingPoint {
func floored(to increment: Self) -> Self {
if increment == 0 {
return self
}

return floor(self / increment) * increment
}

func ceiled(to increment: Self) -> Self {
if increment == 0 {
return self
}

return ceil(self / increment) * increment
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,26 @@ extension GlucoseRangeSchedule {
return override.isActive()
}

var activeOverrideContext: GlucoseRangeSchedule.Override.Context? {
var activeOverride: GlucoseRangeSchedule.Override? {
guard let override = override, override.isActive() else {
return nil
}

return override.context
return override
}

var activeOverrideContext: GlucoseRangeSchedule.Override.Context? {
return activeOverride?.context
}

var activeOverrideQuantityRange: Range<HKQuantity>? {
guard let activeOverride = activeOverride else {
return nil
}

let lowerBound = HKQuantity(unit: unit, doubleValue: activeOverride.value.minValue)
let upperBound = HKQuantity(unit: unit, doubleValue: activeOverride.value.maxValue)
return lowerBound..<upperBound
}

var configuredOverrideContexts: [GlucoseRangeSchedule.Override.Context] {
Expand Down
6 changes: 3 additions & 3 deletions Common/Extensions/HKUnit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import HealthKit
extension HKUnit {
// A formatting helper for determining the preferred decimal style for a given unit
var preferredFractionDigits: Int {
if self.unitString == "mg/dL" {
if self == .milligramsPerDeciliter {
return 0
} else {
return 1
Expand Down Expand Up @@ -45,7 +45,7 @@ extension HKUnit {

/// An example value for the "ideal" target
var glucoseExampleTargetValue: Double {
if unitString == "mg/dL" {
if self == .milligramsPerDeciliter {
return 100
} else {
return 5.5
Expand All @@ -54,7 +54,7 @@ extension HKUnit {

/// The smallest value expected to be visible on a chart
var chartableIncrement: Double {
if unitString == "mg/dL" {
if self == .milligramsPerDeciliter {
return 1
} else {
return 1 / 25
Expand Down
33 changes: 33 additions & 0 deletions Common/Extensions/NSUserActivity.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// NSUserActivity.swift
// Loop
//
// Copyright © 2018 LoopKit Authors. All rights reserved.
//

import Foundation


extension NSUserActivity {
/// Activity of viewing the current status of the Loop
static let viewLoopStatusActivityType = "ViewLoopStatus"

class func forViewLoopStatus() -> NSUserActivity {
return NSUserActivity(activityType: viewLoopStatusActivityType)
}

static let didAddCarbEntryOnWatchActivityType = "com.loopkit.Loop.AddCarbEntryOnWatch"

class func forDidAddCarbEntryOnWatch() -> NSUserActivity {
let activity = NSUserActivity(activityType: didAddCarbEntryOnWatchActivityType)
activity.isEligibleForSearch = true
activity.isEligibleForHandoff = false
activity.isEligibleForPublicIndexing = false
if #available(iOS 12.0, watchOSApplicationExtension 5.0, *) {
activity.isEligibleForPrediction = true
}
activity.requiredUserInfoKeys = []
activity.title = NSLocalizedString("Add Carb Entry", comment: "Title of the user activity for adding carbs")
return activity
}
}
11 changes: 11 additions & 0 deletions Common/Extensions/NewCarbEntryIntent+Loop.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//
// NewCarbEntryIntent+Loop.swift
// Loop
//
// Copyright © 2018 LoopKit Authors. All rights reserved.
//

import Foundation

@available(iOS 12.0, watchOSApplicationExtension 5.0, *)
extension NewCarbEntryIntent: IdentifiableClass { }
10 changes: 10 additions & 0 deletions Common/Extensions/PersistenceController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,14 @@ extension PersistenceController {

return self.init(directoryURL: directoryURL.appendingPathComponent("com.loopkit.LoopKit", isDirectory: true), isReadOnly: isReadOnly)
}

class func controllerInLocalDirectory() -> PersistenceController {
guard let directoryURL = try? FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true) else {
fatalError("Could not access the document directory of the current process")
}

let isReadOnly = Bundle.main.bundleURL.pathExtension == "appex"

return self.init(directoryURL: directoryURL.appendingPathComponent("com.loopkit.LoopKit"), isReadOnly: isReadOnly)
}
}
38 changes: 38 additions & 0 deletions Common/Extensions/SampleValue.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// SampleValue.swift
// Loop
//
// Copyright © 2018 LoopKit Authors. All rights reserved.
//

import HealthKit
import LoopKit


extension Collection where Element == SampleValue {
/// O(n)
var quantityRange: Range<HKQuantity>? {
var lowest: HKQuantity?
var highest: HKQuantity?

for sample in self {
if let l = lowest {
lowest = Swift.min(l, sample.quantity)
} else {
lowest = sample.quantity
}

if let h = highest {
highest = Swift.max(h, sample.quantity)
} else {
highest = sample.quantity
}
}

guard let l = lowest, let h = highest else {
return nil
}

return l..<h
}
}
2 changes: 1 addition & 1 deletion Common/Extensions/UIColor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ extension UIColor {

@nonobjc static let unknownColor = UIColor(red: 198 / 255, green: 199 / 255, blue: 201 / 255, alpha: 1)

@nonobjc static let deleteColor = UIColor.HIGRedColor()
static let delete = UIColor.HIGRedColor()
}
13 changes: 5 additions & 8 deletions Common/Extensions/UserDefaults+CGM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,20 @@
//

import Foundation
import LoopKit


extension UserDefaults {
private enum Key: String {
case cgmSettings = "com.loopkit.Loop.cgmSettings"
case cgmManagerState = "com.loopkit.Loop.CGMManagerState"
}

var cgm: CGM? {
var cgmManagerState: CGMManager.RawStateValue? {
get {
if let rawValue = dictionary(forKey: Key.cgmSettings.rawValue) {
return CGM(rawValue: rawValue)
} else {
return nil
}
return dictionary(forKey: Key.cgmManagerState.rawValue)
}
set {
set(newValue?.rawValue, forKey: Key.cgmSettings.rawValue)
set(newValue, forKey: Key.cgmManagerState.rawValue)
}
}
}
16 changes: 7 additions & 9 deletions Common/Models/BolusSuggestionUserInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
import Foundation


final class BolusSuggestionUserInfo: RawRepresentable {
let recommendedBolus: Double
let maxBolus: Double?
struct BolusSuggestionUserInfo: RawRepresentable {
let recommendedBolus: Double?
var maxBolus: Double?

init(recommendedBolus: Double, maxBolus: Double? = nil) {
init(recommendedBolus: Double?, maxBolus: Double? = nil) {
self.recommendedBolus = recommendedBolus
self.maxBolus = maxBolus
}
Expand All @@ -24,7 +24,7 @@ final class BolusSuggestionUserInfo: RawRepresentable {
static let version = 1
static let name = "BolusSuggestionUserInfo"

required init?(rawValue: RawValue) {
init?(rawValue: RawValue) {
guard rawValue["v"] as? Int == type(of: self).version && rawValue["name"] as? String == BolusSuggestionUserInfo.name,
let recommendedBolus = rawValue["br"] as? Double else
{
Expand All @@ -39,12 +39,10 @@ final class BolusSuggestionUserInfo: RawRepresentable {
var raw: RawValue = [
"v": type(of: self).version,
"name": BolusSuggestionUserInfo.name,
"br": recommendedBolus
]

if let maxBolus = maxBolus {
raw["mb"] = maxBolus
}
raw["br"] = recommendedBolus
raw["mb"] = maxBolus

return raw
}
Expand Down
Loading