Skip to content

Commit

Permalink
Add translations for New Carb Entry intent, fix plugins for app exten…
Browse files Browse the repository at this point in the history
…sion
  • Loading branch information
ps2 committed Aug 24, 2019
1 parent 64ce539 commit 1286353
Show file tree
Hide file tree
Showing 16 changed files with 77 additions and 24 deletions.
8 changes: 5 additions & 3 deletions Common/Base.lproj/Intents.intentdefinition
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@
<key>INIntentDefinitionModelVersion</key>
<string>1.0</string>
<key>INIntentDefinitionSystemVersion</key>
<string>17G65</string>
<string>18G87</string>
<key>INIntentDefinitionToolsBuildVersion</key>
<string>10L232m</string>
<string>10G8</string>
<key>INIntentDefinitionToolsVersion</key>
<string>10.0</string>
<string>10.3</string>
<key>INIntents</key>
<array>
<dict>
<key>INIntentCategory</key>
<string>create</string>
<key>INIntentDescription</key>
<string>Add a carb entry to Loop</string>
<key>INIntentDescriptionID</key>
<string>yc02Yq</string>
<key>INIntentLastParameterTag</key>
Expand Down
11 changes: 6 additions & 5 deletions Common/Models/PumpManagerUI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ private let managersByIdentifier: [String: PumpManagerUI.Type] = staticPumpManag

typealias PumpManagerHUDViewsRawValue = [String: Any]

func PumpManagerHUDViewsFromRawValue(_ rawValue: PumpManagerHUDViewsRawValue) -> [BaseHUDView]? {
guard let rawState = rawValue["hudProviderViews"] as? HUDProvider.HUDViewsRawState,
let manager = PumpManagerTypeFromRawValue(rawValue) as? PumpManagerUI.Type
else {
func PumpManagerHUDViewsFromRawValue(_ rawValue: PumpManagerHUDViewsRawValue, pluginManager: PluginManager) -> [BaseHUDView]? {
guard
let identifier = rawValue["managerIdentifier"] as? String,
let rawState = rawValue["hudProviderViews"] as? HUDProvider.HUDViewsRawState,
let manager = pluginManager.getPumpManagerTypeByIdentifier(identifier) ?? staticPumpManagersByIdentifier[identifier] as? PumpManagerUI.Type else
{
return nil
}

return manager.createHUDViews(rawValue: rawState)
}

Expand Down
4 changes: 0 additions & 4 deletions Common/Models/StatusExtensionContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,6 @@ struct PumpManagerHUDViewsContext: RawRepresentable {

let pumpManagerHUDViewsRawValue: PumpManagerHUDViewsRawValue

var hudViews: [BaseHUDView]? {
return PumpManagerHUDViewsFromRawValue(pumpManagerHUDViewsRawValue)
}

init(pumpManagerHUDViewsRawValue: PumpManagerHUDViewsRawValue) {
self.pumpManagerHUDViewsRawValue = pumpManagerHUDViewsRawValue
}
Expand Down
6 changes: 6 additions & 0 deletions Common/de.lproj/Intents.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"80eo5o" = "Add Carb Entry";

"OcNxIj" = "Add Carb Entry";

"yc02Yq" = "Add a carb entry to Loop";

2 changes: 1 addition & 1 deletion Common/en.lproj/Intents.strings
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
"OcNxIj" = "Add Carb Entry";

/* INIntentDescription */
"yc02Yq" = "";
"yc02Yq" = "Add a carb entry to Loop";
2 changes: 1 addition & 1 deletion Common/es.lproj/Intents.strings
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
"OcNxIj" = "Agregar entrada de carbohidratos";

/* INIntentDescription */
"yc02Yq" = "";
"yc02Yq" = "Add a carb entry to Loop";
6 changes: 6 additions & 0 deletions Common/fr.lproj/Intents.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"80eo5o" = "Add Carb Entry";

"OcNxIj" = "Add Carb Entry";

"yc02Yq" = "Add a carb entry to Loop";

6 changes: 2 additions & 4 deletions Common/it.lproj/Intents.strings
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/* INIntentTitle */
"80eo5o" = "Add Carb Entry";

/* INIntentParameterCombinationTitle */
"OcNxIj" = "Add Carb Entry";

/* INIntentDescription */
"yc02Yq" = "";
"yc02Yq" = "Add a carb entry to Loop";

6 changes: 6 additions & 0 deletions Common/nb.lproj/Intents.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"80eo5o" = "Add Carb Entry";

"OcNxIj" = "Add Carb Entry";

"yc02Yq" = "Add a carb entry to Loop";

6 changes: 6 additions & 0 deletions Common/nl.lproj/Intents.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"80eo5o" = "Add Carb Entry";

"OcNxIj" = "Add Carb Entry";

"yc02Yq" = "Add a carb entry to Loop";

6 changes: 6 additions & 0 deletions Common/pl.lproj/Intents.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"80eo5o" = "Add Carb Entry";

"OcNxIj" = "Add Carb Entry";

"yc02Yq" = "Add a carb entry to Loop";

2 changes: 1 addition & 1 deletion Common/ru.lproj/Intents.strings
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
"OcNxIj" = "Добавить запись углеводов";

/* INIntentDescription */
"yc02Yq" = "";
"yc02Yq" = "Add a carb entry to Loop";
6 changes: 6 additions & 0 deletions Common/zh-Hans.lproj/Intents.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"80eo5o" = "Add Carb Entry";

"OcNxIj" = "Add Carb Entry";

"yc02Yq" = "Add a carb entry to Loop";

4 changes: 3 additions & 1 deletion Loop Status Extension/StatusViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class StatusViewController: UIViewController, NCWidgetProviding {
basalProfile: defaults?.basalRateSchedule,
insulinSensitivitySchedule: defaults?.insulinSensitivitySchedule
)

private var pluginManager = PluginManager()

override func viewDidLoad() {
super.viewDidLoad()
Expand Down Expand Up @@ -193,7 +195,7 @@ class StatusViewController: UIViewController, NCWidgetProviding {
let hudViews: [BaseHUDView]

if let hudViewsContext = context.pumpManagerHUDViewsContext,
let contextHUDViews = hudViewsContext.hudViews
let contextHUDViews = PumpManagerHUDViewsFromRawValue(hudViewsContext.pumpManagerHUDViewsRawValue, pluginManager: self.pluginManager)
{
hudViews = contextHUDViews
} else {
Expand Down
22 changes: 18 additions & 4 deletions Loop.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@
C125F31B22FE7CE200FD0545 /* copy-frameworks.sh in Resources */ = {isa = PBXBuildFile; fileRef = C125F31A22FE7CE200FD0545 /* copy-frameworks.sh */; };
C12F21A71DFA79CB00748193 /* recommend_temp_basal_very_low_end_in_range.json in Resources */ = {isa = PBXBuildFile; fileRef = C12F21A61DFA79CB00748193 /* recommend_temp_basal_very_low_end_in_range.json */; };
C13255D6223E7BE2008AF50C /* BolusProgressTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C1F8B1DB223862D500DD66CF /* BolusProgressTableViewCell.xib */; };
C136AA2423109CC6008A320D /* LoopPlugins.swift in Sources */ = {isa = PBXBuildFile; fileRef = C16DA84122E8E112008624C2 /* LoopPlugins.swift */; };
C13BAD941E8009B000050CB5 /* NumberFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43BFF0B31E45C1BE00FF19A9 /* NumberFormatter.swift */; };
C15713821DAC6983005BC4D2 /* MealBolusNightscoutTreatment.swift in Sources */ = {isa = PBXBuildFile; fileRef = C15713811DAC6983005BC4D2 /* MealBolusNightscoutTreatment.swift */; };
C16DA84222E8E112008624C2 /* LoopPlugins.swift in Sources */ = {isa = PBXBuildFile; fileRef = C16DA84122E8E112008624C2 /* LoopPlugins.swift */; };
Expand All @@ -384,9 +385,9 @@
C1C73F0D1DE3D0270022FC89 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = C1C73F0F1DE3D0270022FC89 /* InfoPlist.strings */; };
C1C7F1C1220D675800689850 /* OmniKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C1C7F1BF220D675700689850 /* OmniKit.framework */; };
C1C7F1C2220D675800689850 /* OmniKitUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C1C7F1C0220D675700689850 /* OmniKitUI.framework */; };
C1D289B522F90A52003FFBD9 /* BasalDeliveryState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1D289B422F90A52003FFBD9 /* BasalDeliveryState.swift */; };
C1D1405922FB69CC00DA6242 /* DerivedAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C1D1405822FB69CC00DA6242 /* DerivedAssets.xcassets */; };
C1D1405F22FB7ADF00DA6242 /* DerivedWatchAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C1D1405E22FB7ADF00DA6242 /* DerivedWatchAssets.xcassets */; };
C1D289B522F90A52003FFBD9 /* BasalDeliveryState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1D289B422F90A52003FFBD9 /* BasalDeliveryState.swift */; };
C1E2773E224177C000354103 /* ClockKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C1E2773D224177C000354103 /* ClockKit.framework */; };
C1E2774822433D7A00354103 /* MKRingProgressView.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C1E2774722433D7A00354103 /* MKRingProgressView.framework */; };
C1F8B243223E73FD00DD66CF /* BolusProgressTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1F8B1D122375E4200DD66CF /* BolusProgressTableViewCell.swift */; };
Expand Down Expand Up @@ -650,7 +651,6 @@
43785E9A2120E7060057DED1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.intentdefinition; name = Base; path = Base.lproj/Intents.intentdefinition; sourceTree = "<group>"; };
43785E9F2122774A0057DED1 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Intents.strings; sourceTree = "<group>"; };
43785EA12122774B0057DED1 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Intents.strings; sourceTree = "<group>"; };
43785EA32122774B0057DED1 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Intents.strings; sourceTree = "<group>"; };
4379CFEF21112CF700AADC79 /* ShareClientUI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = ShareClientUI.framework; sourceTree = BUILT_PRODUCTS_DIR; };
437AFEE6203688CF008C4892 /* LoopKitUI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = LoopKitUI.framework; sourceTree = BUILT_PRODUCTS_DIR; };
437CEEBD1CD6E0CB003C8C80 /* LoopCompletionHUDView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoopCompletionHUDView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1017,6 +1017,13 @@
C10428961D17BAD400DD539A /* NightscoutUploadKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = NightscoutUploadKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
C10B28451EA9BA5E006EA1FC /* far_future_high_bg_forecast.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = far_future_high_bg_forecast.json; sourceTree = "<group>"; };
C125F31A22FE7CE200FD0545 /* copy-frameworks.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "copy-frameworks.sh"; sourceTree = "<group>"; };
C12CB9AC23106A3C00F84978 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Intents.strings; sourceTree = "<group>"; };
C12CB9AE23106A5C00F84978 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Intents.strings; sourceTree = "<group>"; };
C12CB9B023106A5F00F84978 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Intents.strings; sourceTree = "<group>"; };
C12CB9B223106A6000F84978 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Intents.strings"; sourceTree = "<group>"; };
C12CB9B423106A6100F84978 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Intents.strings; sourceTree = "<group>"; };
C12CB9B623106A6200F84978 /* nb */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nb; path = nb.lproj/Intents.strings; sourceTree = "<group>"; };
C12CB9B823106A6300F84978 /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Intents.strings; sourceTree = "<group>"; };
C12F21A61DFA79CB00748193 /* recommend_temp_basal_very_low_end_in_range.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = recommend_temp_basal_very_low_end_in_range.json; sourceTree = "<group>"; };
C15713811DAC6983005BC4D2 /* MealBolusNightscoutTreatment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MealBolusNightscoutTreatment.swift; sourceTree = "<group>"; };
C16DA84122E8E112008624C2 /* LoopPlugins.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoopPlugins.swift; sourceTree = "<group>"; };
Expand All @@ -1034,9 +1041,9 @@
C1C6591B1E1B1FDA0025CC58 /* recommend_temp_basal_dropping_then_rising.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = recommend_temp_basal_dropping_then_rising.json; sourceTree = "<group>"; };
C1C7F1BF220D675700689850 /* OmniKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OmniKit.framework; path = Carthage/Build/iOS/OmniKit.framework; sourceTree = "<group>"; };
C1C7F1C0220D675700689850 /* OmniKitUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OmniKitUI.framework; path = Carthage/Build/iOS/OmniKitUI.framework; sourceTree = "<group>"; };
C1D289B422F90A52003FFBD9 /* BasalDeliveryState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasalDeliveryState.swift; sourceTree = "<group>"; };
C1D1405822FB69CC00DA6242 /* DerivedAssets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = DerivedAssets.xcassets; sourceTree = BUILT_PRODUCTS_DIR; };
C1D1405E22FB7ADF00DA6242 /* DerivedWatchAssets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = DerivedWatchAssets.xcassets; sourceTree = BUILT_PRODUCTS_DIR; };
C1D289B422F90A52003FFBD9 /* BasalDeliveryState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasalDeliveryState.swift; sourceTree = "<group>"; };
C1E2773D224177C000354103 /* ClockKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ClockKit.framework; path = Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/ClockKit.framework; sourceTree = DEVELOPER_DIR; };
C1E2774722433D7A00354103 /* MKRingProgressView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = MKRingProgressView.framework; sourceTree = BUILT_PRODUCTS_DIR; };
C1F8B1D122375E4200DD66CF /* BolusProgressTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BolusProgressTableViewCell.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2805,6 +2812,7 @@
43BFF0CD1E466C8400FF19A9 /* StateColorPalette.swift in Sources */,
4FC8C8021DEB943800A1452E /* NSUserDefaults+StatusExtension.swift in Sources */,
43BFF0BF1E45C8EA00FF19A9 /* UIColor+Widget.swift in Sources */,
C136AA2423109CC6008A320D /* LoopPlugins.swift in Sources */,
4F70C2121DE900EA006380B7 /* StatusExtensionContext.swift in Sources */,
4F70C1E11DE8DCA7006380B7 /* StatusViewController.swift in Sources */,
);
Expand Down Expand Up @@ -2963,8 +2971,14 @@
43785E9A2120E7060057DED1 /* Base */,
43785E9F2122774A0057DED1 /* es */,
43785EA12122774B0057DED1 /* ru */,
43785EA32122774B0057DED1 /* it */,
43C98058212A799E003B5D17 /* en */,
C12CB9AC23106A3C00F84978 /* it */,
C12CB9AE23106A5C00F84978 /* fr */,
C12CB9B023106A5F00F84978 /* de */,
C12CB9B223106A6000F84978 /* zh-Hans */,
C12CB9B423106A6100F84978 /* nl */,
C12CB9B623106A6200F84978 /* nb */,
C12CB9B823106A6300F84978 /* pl */,
);
name = Intents.intentdefinition;
sourceTree = "<group>";
Expand Down
4 changes: 4 additions & 0 deletions LoopCore/LoopSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public struct LoopSettings: Equatable {
public let minimumChartWidthPerHour: CGFloat = 50

public let statusChartMinimumHistoryDisplay: TimeInterval = .hours(1)

public var glucoseUnit: HKUnit? {
return glucoseTargetRangeSchedule?.unit
}

// MARK - Guardrails

Expand Down

0 comments on commit 1286353

Please sign in to comment.