Pārlūkot izejas kodu

Merge pull request #1347 from hamDiabetes/fix/remote-meal-rejected-bolus

Do not enact a meal's explicit bolus when the meal is rejected
Deniz Cengiz 3 dienas atpakaļ
vecāks
revīzija
71b7e4261a

+ 9 - 6
Trio/Sources/Services/RemoteControl/TrioRemoteControl+Meal.swift

@@ -68,12 +68,15 @@ extension TrioRemoteControl {
 
         try await carbsStorage.storeCarbs([mealEntry], areFetchedFromRemote: false)
 
-        if payload.bolusAmount == nil {
-            await logSuccess(
-                "Remote command processed successfully. \(payload.humanReadableDescription())",
-                payload: payload,
-                customNotificationMessage: "Meal logged"
-            )
+        if payload.bolusAmount != nil {
+            try await handleBolusCommand(payload)
+            return
         }
+
+        await logSuccess(
+            "Remote command processed successfully. \(payload.humanReadableDescription())",
+            payload: payload,
+            customNotificationMessage: "Meal logged"
+        )
     }
 }

+ 0 - 3
Trio/Sources/Services/RemoteControl/TrioRemoteControl.swift

@@ -80,9 +80,6 @@ class TrioRemoteControl: Injectable {
             await cancelTempTarget(commandPayload)
         case .meal:
             try await handleMealCommand(commandPayload)
-            if commandPayload.bolusAmount != nil {
-                try await handleBolusCommand(commandPayload)
-            }
         case .startOverride:
             await handleStartOverrideCommand(commandPayload)
         case .cancelOverride: