Skip to content

Commit 21b6ec1

Browse files
authored
Shorcuts: Add Carbs (#812)
* Shorcuts: Add Carbs * Update swiftcharts
1 parent 8104ff3 commit 21b6ec1

25 files changed

+483
-40
lines changed

Cartfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
github "LoopKit/LoopKit" "dev"
33
github "LoopKit/CGMBLEKit" "dev"
4-
github "i-schuetz/SwiftCharts" == 0.6.1
4+
github "i-schuetz/SwiftCharts" == 0.6.2
55
github "LoopKit/dexcom-share-client-swift" "carthage-recursive"
66
github "LoopKit/G4ShareSpy" "fix-cartfile"
77
github "ps2/rileylink_ios" "dev"

Cartfile.resolved

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ github "LoopKit/CGMBLEKit" "97433c2c546b50268bbfe2e1a42cb377c6066e78"
33
github "LoopKit/G4ShareSpy" "47931f1ee70f1081db6eebf3a68bb8f4146e5fca"
44
github "LoopKit/LoopKit" "8c553f7bd03c2032b146e4a52d58d527a4285c15"
55
github "LoopKit/dexcom-share-client-swift" "f0125aed8960586a9473dca02d17b3e5969558ac"
6-
github "i-schuetz/SwiftCharts" "0.6.1"
7-
github "ps2/rileylink_ios" "9f62a563cc7e6ea17a3f3be3a3f351aba202d624"
6+
github "i-schuetz/SwiftCharts" "0.6.2"
7+
github "ps2/rileylink_ios" "49a43189c1606875d27133589c6d6b92fbd3a0a1"
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>INEnums</key>
6+
<array/>
7+
<key>INIntentDefinitionModelVersion</key>
8+
<string>1.0</string>
9+
<key>INIntentDefinitionSystemVersion</key>
10+
<string>17G65</string>
11+
<key>INIntentDefinitionToolsBuildVersion</key>
12+
<string>10L232m</string>
13+
<key>INIntentDefinitionToolsVersion</key>
14+
<string>10.0</string>
15+
<key>INIntents</key>
16+
<array>
17+
<dict>
18+
<key>INIntentCategory</key>
19+
<string>create</string>
20+
<key>INIntentDescriptionID</key>
21+
<string>yc02Yq</string>
22+
<key>INIntentLastParameterTag</key>
23+
<integer>0</integer>
24+
<key>INIntentName</key>
25+
<string>NewCarbEntry</string>
26+
<key>INIntentParameterCombinations</key>
27+
<dict>
28+
<key></key>
29+
<dict>
30+
<key>INIntentParameterCombinationIsPrimary</key>
31+
<true/>
32+
<key>INIntentParameterCombinationSubtitle</key>
33+
<string></string>
34+
<key>INIntentParameterCombinationSubtitleID</key>
35+
<string>bOiZXO</string>
36+
<key>INIntentParameterCombinationSupportsBackgroundExecution</key>
37+
<false/>
38+
<key>INIntentParameterCombinationTitle</key>
39+
<string>Add Carb Entry</string>
40+
<key>INIntentParameterCombinationTitleID</key>
41+
<string>OcNxIj</string>
42+
</dict>
43+
</dict>
44+
<key>INIntentParameters</key>
45+
<array/>
46+
<key>INIntentResponse</key>
47+
<dict>
48+
<key>INIntentResponseCodes</key>
49+
<array>
50+
<dict>
51+
<key>INIntentResponseCodeFormatString</key>
52+
<string></string>
53+
<key>INIntentResponseCodeFormatStringID</key>
54+
<string>SP7STY</string>
55+
<key>INIntentResponseCodeName</key>
56+
<string>failure</string>
57+
<key>INIntentResponseCodeSuccess</key>
58+
<false/>
59+
</dict>
60+
<dict>
61+
<key>INIntentResponseCodeFormatString</key>
62+
<string></string>
63+
<key>INIntentResponseCodeFormatStringID</key>
64+
<string>I1DB3p</string>
65+
<key>INIntentResponseCodeName</key>
66+
<string>success</string>
67+
<key>INIntentResponseCodeSuccess</key>
68+
<true/>
69+
</dict>
70+
</array>
71+
<key>INIntentResponseLastParameterTag</key>
72+
<integer>0</integer>
73+
<key>INIntentResponseParameters</key>
74+
<array/>
75+
</dict>
76+
<key>INIntentRestrictions</key>
77+
<integer>0</integer>
78+
<key>INIntentTitle</key>
79+
<string>Add Carb Entry</string>
80+
<key>INIntentTitleID</key>
81+
<string>80eo5o</string>
82+
<key>INIntentType</key>
83+
<string>Custom</string>
84+
<key>INIntentUserConfirmationRequired</key>
85+
<false/>
86+
<key>INIntentVerb</key>
87+
<string>Add</string>
88+
</dict>
89+
</array>
90+
</dict>
91+
</plist>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//
2+
// NSUserActivity.swift
3+
// Loop
4+
//
5+
// Copyright © 2018 LoopKit Authors. All rights reserved.
6+
//
7+
8+
import Foundation
9+
10+
11+
extension NSUserActivity {
12+
/// Activity of viewing the current status of the Loop
13+
static let viewLoopStatusActivityType = "ViewLoopStatus"
14+
15+
class func forViewLoopStatus() -> NSUserActivity {
16+
return NSUserActivity(activityType: viewLoopStatusActivityType)
17+
}
18+
19+
static let didAddCarbEntryOnWatchActivityType = "com.loopkit.Loop.AddCarbEntryOnWatch"
20+
21+
class func forDidAddCarbEntryOnWatch() -> NSUserActivity {
22+
let activity = NSUserActivity(activityType: didAddCarbEntryOnWatchActivityType)
23+
activity.isEligibleForSearch = true
24+
activity.isEligibleForHandoff = false
25+
activity.isEligibleForPublicIndexing = false
26+
if #available(iOS 12.0, watchOSApplicationExtension 5.0, *) {
27+
activity.isEligibleForPrediction = true
28+
}
29+
activity.requiredUserInfoKeys = []
30+
activity.title = NSLocalizedString("Add Carb Entry", comment: "Title of the user activity for adding carbs")
31+
return activity
32+
}
33+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//
2+
// NewCarbEntryIntent+Loop.swift
3+
// Loop
4+
//
5+
// Copyright © 2018 LoopKit Authors. All rights reserved.
6+
//
7+
8+
import Foundation
9+
10+
@available(iOS 12.0, watchOSApplicationExtension 5.0, *)
11+
extension NewCarbEntryIntent: IdentifiableClass { }

Common/Models/WatchContext.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,14 @@ final class WatchContext: NSObject, RawRepresentable {
129129
return raw
130130
}
131131
}
132+
133+
134+
extension WatchContext {
135+
func shouldReplace(_ other: WatchContext) -> Bool {
136+
if let date = self.glucoseDate, let otherDate = other.glucoseDate {
137+
return date >= otherDate
138+
} else {
139+
return true
140+
}
141+
}
142+
}

Common/en.lproj/Intents.strings

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* INIntentTitle */
2+
"80eo5o" = "Add Carb Entry";
3+
4+
/* INIntentParameterCombinationTitle */
5+
"OcNxIj" = "Add Carb Entry";
6+
7+
/* INIntentDescription */
8+
"yc02Yq" = "";

Common/es.lproj/Intents.strings

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* INIntentTitle */
2+
"80eo5o" = "Agregar entrada de carbohidratos";
3+
4+
/* INIntentParameterCombinationTitle */
5+
"OcNxIj" = "Agregar entrada de carbohidratos";
6+
7+
/* INIntentDescription */
8+
"yc02Yq" = "";

Common/it.lproj/Intents.strings

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* INIntentTitle */
2+
"80eo5o" = "Add Carb Entry";
3+
4+
/* INIntentParameterCombinationTitle */
5+
"OcNxIj" = "Add Carb Entry";
6+
7+
/* INIntentDescription */
8+
"yc02Yq" = "";

Common/ru.lproj/Intents.strings

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* INIntentTitle */
2+
"80eo5o" = "Добавить запись углеводов";
3+
4+
/* INIntentParameterCombinationTitle */
5+
"OcNxIj" = "Добавить запись углеводов";
6+
7+
/* INIntentDescription */
8+
"yc02Yq" = "";

0 commit comments

Comments
 (0)