@@ -874,26 +874,28 @@ extension LoopDataManager {
874
874
logger. default ( " Loop ended " )
875
875
notify ( forChange: . loopFinished)
876
876
877
- let carbEffectStart = now ( ) . addingTimeInterval ( - MissedMealSettings. maxRecency)
878
- carbStore. getGlucoseEffects ( start: carbEffectStart, end: now ( ) , effectVelocities: insulinCounteractionEffects) { [ weak self] result in
879
- guard
880
- let self = self ,
881
- case . success( ( _, let carbEffects) ) = result
882
- else {
883
- if case . failure( let error) = result {
884
- self ? . logger. error ( " Failed to fetch glucose effects to check for missed meal: %{public}@ " , String ( describing: error) )
877
+ if FeatureFlags . missedMealNotifications {
878
+ let carbEffectStart = now ( ) . addingTimeInterval ( - MissedMealSettings. maxRecency)
879
+ carbStore. getGlucoseEffects ( start: carbEffectStart, end: now ( ) , effectVelocities: insulinCounteractionEffects) { [ weak self] result in
880
+ guard
881
+ let self = self ,
882
+ case . success( ( _, let carbEffects) ) = result
883
+ else {
884
+ if case . failure( let error) = result {
885
+ self ? . logger. error ( " Failed to fetch glucose effects to check for missed meal: %{public}@ " , String ( describing: error) )
886
+ }
887
+ return
885
888
}
886
- return
889
+
890
+ self . mealDetectionManager. generateMissedMealNotificationIfNeeded (
891
+ insulinCounteractionEffects: self . insulinCounteractionEffects,
892
+ carbEffects: carbEffects,
893
+ pendingAutobolusUnits: self . recommendedAutomaticDose? . recommendation. bolusUnits,
894
+ bolusDurationEstimator: { [ unowned self] bolusAmount in
895
+ return self . delegate? . loopDataManager ( self , estimateBolusDuration: bolusAmount)
896
+ }
897
+ )
887
898
}
888
-
889
- self . mealDetectionManager. generateMissedMealNotificationIfNeeded (
890
- insulinCounteractionEffects: self . insulinCounteractionEffects,
891
- carbEffects: carbEffects,
892
- pendingAutobolusUnits: self . recommendedAutomaticDose? . recommendation. bolusUnits,
893
- bolusDurationEstimator: { [ unowned self] bolusAmount in
894
- return self . delegate? . loopDataManager ( self , estimateBolusDuration: bolusAmount)
895
- }
896
- )
897
899
}
898
900
899
901
// 5 second delay to allow stores to cache data before it is read by widget
0 commit comments