Skip to content

Commit 129628d

Browse files
authored
Merge pull request #427 from tidepool-org/ps2/LOOP-3107/diy-sync
LOOP-3107 DIY Sync
2 parents 9163f4c + ee4c91b commit 129628d

File tree

81 files changed

+3692
-960
lines changed

Some content is hidden

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

81 files changed

+3692
-960
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: objective-c
2-
osx_image: xcode11.6
2+
osx_image: xcode12.4
33

44
cache:
55
directories:
@@ -8,13 +8,13 @@ cache:
88
jobs:
99
include:
1010
- stage: build carthage
11-
script: set -o pipefail && xcodebuild -project Loop.xcodeproj -target Cartfile
11+
script: set -o pipefail && xcodebuild -project Loop.xcodeproj -target Cartfile | xcpretty
1212
- stage: test build
1313
script: set -o pipefail && xcodebuild -project Loop.xcodeproj -scheme Loop build CODE_SIGN_IDENTITY="" CODE_SIGNING_ALLOWED=NO | xcpretty
1414
- # same stage; parallel
1515
script: set -o pipefail && xcodebuild -project Loop.xcodeproj -scheme Learn build CODE_SIGN_IDENTITY="" CODE_SIGNING_ALLOWED=NO | xcpretty
1616
- # same stage; parallel
17-
script: set -o pipefail && xcodebuild -project Loop.xcodeproj -scheme LoopTests -destination 'name=iPhone 8' test | xcpretty
17+
script: set -o pipefail && xcodebuild -project Loop.xcodeproj -scheme LoopTests -destination 'platform=iOS Simulator,name=iPhone 8' test EXCLUDED_ARCHS=arm64 | xcpretty
1818
- # same stage; parallel
1919
script: set -o pipefail && xcodebuild -project Loop.xcodeproj -scheme DoseMathTests -destination 'name=iPhone 8' test | xcpretty
2020

Cartfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ github "LoopKit/dexcom-share-client-swift" "dev"
55
github "LoopKit/G4ShareSpy" "dev"
66
github "ps2/rileylink_ios" "dev"
77
github "ps2/NightscoutService" "dev"
8+
github "LoopKit/LoopOnboarding" "dev"
89
github "LoopKit/Amplitude-iOS" "decreepify"
910
github "LoopKit/MKRingProgressView" "appex-safe"
1011
github "dexman/Minizip" "master"

Cartfile.resolved

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
github "LoopKit/Amplitude-iOS" "2137d5fd44bf630ed33e1e72d7af6d8f8612f270"
2-
github "LoopKit/CGMBLEKit" "3906d75180cd27b87b53953e9e126eab4d5e5edf"
3-
github "LoopKit/G4ShareSpy" "8535b54c28552219dc4e32f2f326ff92b69d73cf"
4-
github "LoopKit/LoopKit" "e358cbc4fe7023cc20f3deee12d295e0f4ef9a0c"
2+
github "LoopKit/CGMBLEKit" "abc194d6379a3bf72930b2601e652abdcafc371a"
3+
github "LoopKit/G4ShareSpy" "5cc240d5059f9f0afac4c0ffc790ef89a6c55010"
4+
github "LoopKit/LoopKit" "7cc4d031b8d49837f82af91538a397a3e8dea02d"
5+
github "LoopKit/LoopOnboarding" "6f1e4b81dfffa931f8166c7016b7454b76243fe4"
56
github "LoopKit/MKRingProgressView" "f548a5c64832be2d37d7c91b5800e284887a2a0a"
6-
github "LoopKit/dexcom-share-client-swift" "786e5f0c1398ddacc6964314455d55a0ac10e544"
7+
github "LoopKit/dexcom-share-client-swift" "97414afaad8b5d9e15466d3fa4958f4df8d7f282"
78
github "dexman/Minizip" "6be834b517aedb2b3b51e997a1244af738bb41f8"
89
github "i-schuetz/SwiftCharts" "0.6.5"
9-
github "ps2/NightscoutService" "0825111b75b84ca727bb54a1905d1275afaa9479"
10-
github "ps2/rileylink_ios" "29701919252f61ca3e403b81a71f0b552c0da890"
11-
github "dexman/Minizip" "6be834b517aedb2b3b51e997a1244af738bb41f8"
1210
github "instacart/TrueTime.swift" "5.1.0"
11+
github "ps2/NightscoutService" "283c18ed9bb8453dd350fda1e0816566c4b107db"
12+
github "ps2/rileylink_ios" "8b7aa6b786a45715bfc6dd1ca4d49c666edd04c8"

Common/Base.lproj/Intents.intentdefinition

Lines changed: 136 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
<key>INEnums</key>
66
<array/>
77
<key>INIntentDefinitionModelVersion</key>
8-
<string>1.0</string>
8+
<string>1.2</string>
9+
<key>INIntentDefinitionNamespace</key>
10+
<string>wqYaJi</string>
911
<key>INIntentDefinitionSystemVersion</key>
10-
<string>18G87</string>
12+
<string>19G2021</string>
1113
<key>INIntentDefinitionToolsBuildVersion</key>
12-
<string>10G8</string>
14+
<string>12B45b</string>
1315
<key>INIntentDefinitionToolsVersion</key>
14-
<string>10.3</string>
16+
<string>12.2</string>
1517
<key>INIntents</key>
1618
<array>
1719
<dict>
@@ -21,8 +23,6 @@
2123
<string>Add a carb entry to Loop</string>
2224
<key>INIntentDescriptionID</key>
2325
<string>yc02Yq</string>
24-
<key>INIntentLastParameterTag</key>
25-
<integer>0</integer>
2626
<key>INIntentName</key>
2727
<string>NewCarbEntry</string>
2828
<key>INIntentParameterCombinations</key>
@@ -31,10 +31,6 @@
3131
<dict>
3232
<key>INIntentParameterCombinationIsPrimary</key>
3333
<true/>
34-
<key>INIntentParameterCombinationSubtitle</key>
35-
<string></string>
36-
<key>INIntentParameterCombinationSubtitleID</key>
37-
<string>bOiZXO</string>
3834
<key>INIntentParameterCombinationSupportsBackgroundExecution</key>
3935
<false/>
4036
<key>INIntentParameterCombinationTitle</key>
@@ -43,51 +39,160 @@
4339
<string>OcNxIj</string>
4440
</dict>
4541
</dict>
46-
<key>INIntentParameters</key>
47-
<array/>
4842
<key>INIntentResponse</key>
4943
<dict>
5044
<key>INIntentResponseCodes</key>
5145
<array>
5246
<dict>
53-
<key>INIntentResponseCodeFormatString</key>
54-
<string></string>
55-
<key>INIntentResponseCodeFormatStringID</key>
56-
<string>SP7STY</string>
5747
<key>INIntentResponseCodeName</key>
58-
<string>failure</string>
48+
<string>success</string>
5949
<key>INIntentResponseCodeSuccess</key>
60-
<false/>
50+
<true/>
6151
</dict>
52+
<dict>
53+
<key>INIntentResponseCodeName</key>
54+
<string>failure</string>
55+
</dict>
56+
</array>
57+
</dict>
58+
<key>INIntentTitle</key>
59+
<string>Add Carb Entry</string>
60+
<key>INIntentTitleID</key>
61+
<string>80eo5o</string>
62+
<key>INIntentType</key>
63+
<string>Custom</string>
64+
<key>INIntentVerb</key>
65+
<string>Add</string>
66+
</dict>
67+
<dict>
68+
<key>INIntentCategory</key>
69+
<string>generic</string>
70+
<key>INIntentConfigurable</key>
71+
<true/>
72+
<key>INIntentDescription</key>
73+
<string>Enable an override preset in Loop</string>
74+
<key>INIntentDescriptionID</key>
75+
<string>ZZ3mtM</string>
76+
<key>INIntentLastParameterTag</key>
77+
<integer>1</integer>
78+
<key>INIntentManagedParameterCombinations</key>
79+
<dict>
80+
<key>overrideName</key>
81+
<dict>
82+
<key>INIntentParameterCombinationSupportsBackgroundExecution</key>
83+
<true/>
84+
<key>INIntentParameterCombinationUpdatesLinked</key>
85+
<true/>
86+
</dict>
87+
</dict>
88+
<key>INIntentName</key>
89+
<string>EnableOverridePreset</string>
90+
<key>INIntentParameterCombinations</key>
91+
<dict>
92+
<key>overrideName</key>
93+
<dict>
94+
<key>INIntentParameterCombinationSubtitle</key>
95+
<string>Enable preset in Loop</string>
96+
<key>INIntentParameterCombinationSubtitleID</key>
97+
<string>XNNmtH</string>
98+
<key>INIntentParameterCombinationSupportsBackgroundExecution</key>
99+
<true/>
100+
<key>INIntentParameterCombinationTitle</key>
101+
<string>Enable '${overrideName}' Override Preset</string>
102+
<key>INIntentParameterCombinationTitleID</key>
103+
<string>oLQSsJ</string>
104+
</dict>
105+
</dict>
106+
<key>INIntentParameters</key>
107+
<array>
108+
<dict>
109+
<key>INIntentParameterConfigurable</key>
110+
<true/>
111+
<key>INIntentParameterCustomDisambiguation</key>
112+
<true/>
113+
<key>INIntentParameterDisplayName</key>
114+
<string>Override Name</string>
115+
<key>INIntentParameterDisplayNameID</key>
116+
<string>lYMuWV</string>
117+
<key>INIntentParameterDisplayPriority</key>
118+
<integer>1</integer>
119+
<key>INIntentParameterMetadata</key>
120+
<dict>
121+
<key>INIntentParameterMetadataCapitalization</key>
122+
<string>None</string>
123+
<key>INIntentParameterMetadataDefaultValueID</key>
124+
<string>sfi0XQ</string>
125+
</dict>
126+
<key>INIntentParameterName</key>
127+
<string>overrideName</string>
128+
<key>INIntentParameterPromptDialogs</key>
129+
<array>
130+
<dict>
131+
<key>INIntentParameterPromptDialogCustom</key>
132+
<true/>
133+
<key>INIntentParameterPromptDialogFormatString</key>
134+
<string>Override Selection</string>
135+
<key>INIntentParameterPromptDialogFormatStringID</key>
136+
<string>yBzwCL</string>
137+
<key>INIntentParameterPromptDialogType</key>
138+
<string>Configuration</string>
139+
</dict>
140+
<dict>
141+
<key>INIntentParameterPromptDialogCustom</key>
142+
<true/>
143+
<key>INIntentParameterPromptDialogFormatString</key>
144+
<string>What's the name of the override you'd like to set?</string>
145+
<key>INIntentParameterPromptDialogFormatStringID</key>
146+
<string>nDKAmn</string>
147+
<key>INIntentParameterPromptDialogType</key>
148+
<string>Primary</string>
149+
</dict>
150+
</array>
151+
<key>INIntentParameterSupportsDynamicEnumeration</key>
152+
<true/>
153+
<key>INIntentParameterSupportsResolution</key>
154+
<true/>
155+
<key>INIntentParameterTag</key>
156+
<integer>1</integer>
157+
<key>INIntentParameterType</key>
158+
<string>String</string>
159+
</dict>
160+
</array>
161+
<key>INIntentResponse</key>
162+
<dict>
163+
<key>INIntentResponseCodes</key>
164+
<array>
62165
<dict>
63166
<key>INIntentResponseCodeFormatString</key>
64-
<string></string>
167+
<string>I've set the preset</string>
65168
<key>INIntentResponseCodeFormatStringID</key>
66-
<string>I1DB3p</string>
169+
<string>9KhaIS</string>
67170
<key>INIntentResponseCodeName</key>
68171
<string>success</string>
69172
<key>INIntentResponseCodeSuccess</key>
70173
<true/>
71174
</dict>
175+
<dict>
176+
<key>INIntentResponseCodeFormatString</key>
177+
<string>I wasn't able to set the preset.</string>
178+
<key>INIntentResponseCodeFormatStringID</key>
179+
<string>b085BW</string>
180+
<key>INIntentResponseCodeName</key>
181+
<string>failure</string>
182+
</dict>
72183
</array>
73-
<key>INIntentResponseLastParameterTag</key>
74-
<integer>0</integer>
75-
<key>INIntentResponseParameters</key>
76-
<array/>
77184
</dict>
78-
<key>INIntentRestrictions</key>
79-
<integer>0</integer>
80185
<key>INIntentTitle</key>
81-
<string>Add Carb Entry</string>
186+
<string>Enable Override Preset</string>
82187
<key>INIntentTitleID</key>
83-
<string>80eo5o</string>
188+
<string>I4OZy8</string>
84189
<key>INIntentType</key>
85190
<string>Custom</string>
86-
<key>INIntentUserConfirmationRequired</key>
87-
<false/>
88191
<key>INIntentVerb</key>
89-
<string>Add</string>
192+
<string>Do</string>
90193
</dict>
91194
</array>
195+
<key>INTypes</key>
196+
<array/>
92197
</dict>
93198
</plist>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
//
2+
// UserDefaults+LoopIntents.swift
3+
// Loop Intent Extension
4+
//
5+
// Created by Anna Quinlan on 10/17/20.
6+
// Copyright © 2020 LoopKit Authors. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
extension UserDefaults {
12+
13+
private enum Key: String {
14+
case IntentExtensionContext = "com.loopkit.Loop.IntentExtensionContext"
15+
// This key needs to be EXACTLY the same string as the objc dynamic var for the KVO to work correctly
16+
case IntentExtensionOverrideToSet = "intentExtensionOverrideToSet"
17+
}
18+
19+
// Information for the extension from Loop
20+
var intentExtensionInfo: IntentExtensionInfo? {
21+
get {
22+
if let rawValue = dictionary(forKey: Key.IntentExtensionContext.rawValue) {
23+
return IntentExtensionInfo(rawValue: rawValue)
24+
} else {
25+
return nil
26+
}
27+
}
28+
set {
29+
set(newValue?.rawValue, forKey: Key.IntentExtensionContext.rawValue)
30+
}
31+
}
32+
33+
@objc dynamic var intentExtensionOverrideToSet: String? {
34+
get {
35+
return object(forKey: Key.IntentExtensionOverrideToSet.rawValue) as? String
36+
}
37+
set {
38+
set(newValue, forKey: Key.IntentExtensionOverrideToSet.rawValue)
39+
}
40+
}
41+
}
42+

Common/FeatureFlags.swift

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ struct FeatureFlagConfiguration: Decodable {
2424
let scenariosEnabled: Bool
2525
let sensitivityOverridesEnabled: Bool
2626
let simulatedCoreDataEnabled: Bool
27-
let walshInsulinModelEnabled: Bool
27+
let siriEnabled: Bool
28+
let automaticBolusEnabled: Bool
29+
let manualDoseEntryEnabled: Bool
2830

2931
fileprivate init() {
3032
#if CGM_MANAGER_CATEGORIZE_GLUCOSE_RANGE_ENABLED
@@ -114,10 +116,24 @@ struct FeatureFlagConfiguration: Decodable {
114116
#endif
115117

116118
// Swift compiler config is inverse, since the default state is enabled.
117-
#if WALSH_INSULIN_MODEL_DISABLED
118-
self.walshInsulinModelEnabled = false
119+
#if SIRI_DISABLED
120+
self.siriEnabled = false
119121
#else
120-
self.walshInsulinModelEnabled = true
122+
self.siriEnabled = true
123+
#endif
124+
125+
// Swift compiler config is inverse, since the default state is enabled.
126+
#if AUTOMATIC_BOLUS_DISABLED
127+
self.automaticBolusEnabled = false
128+
#else
129+
self.automaticBolusEnabled = true
130+
#endif
131+
132+
// Swift compiler config is inverse, since the default state is enabled.
133+
#if MANUAL_DOSE_ENTRY_DISABLED
134+
self.manualDoseEntryEnabled = false
135+
#else
136+
self.manualDoseEntryEnabled = true
121137
#endif
122138
}
123139
}
@@ -139,7 +155,9 @@ extension FeatureFlagConfiguration : CustomDebugStringConvertible {
139155
"* scenariosEnabled: \(scenariosEnabled)",
140156
"* sensitivityOverridesEnabled: \(sensitivityOverridesEnabled)",
141157
"* simulatedCoreDataEnabled: \(simulatedCoreDataEnabled)",
142-
"* walshInsulinModelEnabled: \(walshInsulinModelEnabled)"
158+
"* siriEnabled: \(siriEnabled)",
159+
"* automaticBolusEnabled: \(automaticBolusEnabled)",
160+
"* manualDoseEntryEnabled: \(manualDoseEntryEnabled)"
143161
].joined(separator: "\n")
144162
}
145163
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//
2+
// IntentExtensionInfo.swift
3+
// Loop Intent Extension
4+
//
5+
// Created by Anna Quinlan on 10/17/20.
6+
// Copyright © 2020 LoopKit Authors. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
struct IntentExtensionInfo: RawRepresentable {
12+
typealias RawValue = [String: Any]
13+
14+
var overridePresetNames: [String]?
15+
16+
init() { }
17+
18+
init(rawValue: RawValue) {
19+
overridePresetNames = rawValue["overridePresetNames"] as? [String]
20+
}
21+
22+
init(overridePresetNames: [String]?) {
23+
self.overridePresetNames = overridePresetNames
24+
}
25+
26+
var rawValue: RawValue {
27+
var raw: RawValue = [:]
28+
29+
raw["overridePresetNames"] = overridePresetNames
30+
31+
return raw
32+
}
33+
}

0 commit comments

Comments
 (0)