Преглед изворни кода

Merge pull request #1151 from mountrcg/fixManualBolusNotification

Fix spurious 'Bolus failed' notification after manual bolus
Deniz Cengiz пре 1 дан
родитељ
комит
cfc04e469d
1 измењених фајлова са 10 додато и 3 уклоњено
  1. 10 3
      Trio/Sources/APS/APSManager.swift

+ 10 - 3
Trio/Sources/APS/APSManager.swift

@@ -583,11 +583,18 @@ final class BaseAPSManager: APSManager, Injectable {
         do {
             try await pump.enactBolus(units: roundedAmount, automatic: isSMB)
             debug(.apsManager, "Bolus succeeded")
-            if !isSMB {
-                try await determineBasalSync()
-            }
             bolusProgress.send(0)
             callback?(true, String(localized: "Bolus enacted successfully.", comment: "Success message for enacting a bolus"))
+            if !isSMB {
+                do {
+                    try await determineBasalSync()
+                } catch {
+                    warning(
+                        .apsManager,
+                        "determineBasalSync after manual bolus failed: \(error.localizedDescription)"
+                    )
+                }
+            }
         } catch {
             warning(.apsManager, "Bolus failed with error: \(error)")
             processError(APSError.pumpError(error))