Browse Source

Add fat and protein to Add Carbs shortcut confirmation

Mike Plante 3 months ago
parent
commit
717b83e30b
1 changed files with 11 additions and 1 deletions
  1. 11 1
      Trio/Sources/Shortcuts/Carbs/AddCarbPresetIntent.swift

+ 11 - 1
Trio/Sources/Shortcuts/Carbs/AddCarbPresetIntent.swift

@@ -122,9 +122,19 @@ struct AddCarbPresetIntent: AppIntent {
             }
 
             if confirmBeforeApplying {
+                var confirmationMessage: String
+                confirmationMessage = String(localized: "Add \(quantityCarbs) g carbs")
+                if fatQuantity > 0 {
+                    confirmationMessage = String(localized: "\(confirmationMessage) and \(fatQuantity) g fat")
+                }
+                if proteinQuantity > 0 {
+                    confirmationMessage = String(localized: "\(confirmationMessage) and \(proteinQuantity) g protein")
+                }
+                confirmationMessage = String(localized: "\(confirmationMessage)?")
+
                 try await requestConfirmation(
                     result: .result(
-                        dialog: IntentDialog(stringLiteral: String(localized: "Add \(quantityCarbs) grams of carbs?"))
+                        dialog: IntentDialog(stringLiteral: confirmationMessage)
                     )
                 )
             }