Просмотр исходного кода

Merge pull request #1151 from mountrcg/fixManualBolusNotification

Fix spurious 'Bolus failed' notification after manual bolus
Deniz Cengiz 1 день назад
Родитель
Сommit
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))