1
- Submodule Loop befcbcb..a7b2444 :
1
+ Submodule Loop befcbcb..4d65b26 :
2
2
diff --git a/Loop/Common/Extensions/GlucoseRangeSchedule.swift b/Loop/Common/Extensions/GlucoseRangeSchedule.swift
3
3
index c8ef74fe..ccc75b0b 100644
4
4
--- a/Loop/Common/Extensions/GlucoseRangeSchedule.swift
@@ -11,8 +11,8 @@ index c8ef74fe..ccc75b0b 100644
11
11
+ return HKQuantity(unit: unit, doubleValue: value(at: date).maxValue)
12
12
+ }
13
13
}
14
-
15
-
14
+
15
+
16
16
diff --git a/Loop/Common/FeatureFlags.swift b/Loop/Common/FeatureFlags.swift
17
17
index b2f0953e..b5c39d73 100644
18
18
--- a/Loop/Common/FeatureFlags.swift
@@ -22,8 +22,8 @@ index b2f0953e..b5c39d73 100644
22
22
let adultChildInsulinModelSelectionEnabled: Bool
23
23
let profileExpirationSettingsViewEnabled: Bool
24
24
+ let allowAlgorithmExperiments: Bool
25
-
26
-
25
+
26
+
27
27
fileprivate init() {
28
28
@@ -220,6 +221,11 @@ struct FeatureFlagConfiguration: Decodable {
29
29
#else
@@ -36,7 +36,7 @@ index b2f0953e..b5c39d73 100644
36
36
+ #endif
37
37
}
38
38
}
39
-
39
+
40
40
@@ -253,7 +259,8 @@ extension FeatureFlagConfiguration : CustomDebugStringConvertible {
41
41
"* usePositiveMomentumAndRCForManualBoluses: \(usePositiveMomentumAndRCForManualBoluses)",
42
42
"* dynamicCarbAbsorptionEnabled: \(dynamicCarbAbsorptionEnabled)",
@@ -153,21 +153,21 @@ index 31b6ebff..6800c7f2 100644
153
153
431A8C401EC6E8AB00823B9C /* CircleMaskView.swift in Sources */,
154
154
1D05219D2469F1F5000EBBDE /* AlertStore.swift in Sources */,
155
155
diff --git a/Loop/Loop/Managers/LoopDataManager.swift b/Loop/Loop/Managers/LoopDataManager.swift
156
- index 18a08166..5f3c1625 100644
156
+ index 18a08166..726878ed 100644
157
157
--- a/Loop/Loop/Managers/LoopDataManager.swift
158
158
+++ b/Loop/Loop/Managers/LoopDataManager.swift
159
159
@@ -123,8 +123,6 @@ final class LoopDataManager {
160
-
160
+
161
161
self.trustedTimeOffset = trustedTimeOffset
162
-
162
+
163
163
- retrospectiveCorrection = settings.enabledRetrospectiveCorrectionAlgorithm
164
164
-
165
165
overrideIntentObserver = UserDefaults.appGroup?.observe(\.intentExtensionOverrideToSet, options: [.new], changeHandler: {[weak self] (defaults, change) in
166
166
guard let name = change.newValue??.lowercased(), let appGroup = UserDefaults.appGroup else {
167
167
return
168
168
@@ -435,7 +433,23 @@ final class LoopDataManager {
169
169
}
170
-
170
+
171
171
// Confined to dataAccessQueue
172
172
- private var retrospectiveCorrection: RetrospectiveCorrection
173
173
+ private var lastIntegralRetrospectiveCorrectionEnabled: Bool?
@@ -187,13 +187,13 @@ index 18a08166..5f3c1625 100644
187
187
+
188
188
+ return cachedRetrospectiveCorrection!
189
189
+ }
190
-
190
+
191
191
// MARK: - Background task management
192
-
192
+
193
193
@@ -1696,7 +1710,23 @@ extension LoopDataManager {
194
194
return self.delegate?.roundBolusVolume(units: units) ?? units
195
195
}
196
-
196
+
197
197
- let maxAutomaticBolus = min(iobHeadroom, maxBolus! * LoopConstants.bolusPartialApplicationFactor)
198
198
+ // Create dosing strategy based on user setting
199
199
+ let applicationFactorStrategy: ApplicationFactorStrategy = UserDefaults.standard.glucoseBasedApplicationFactorEnabled
@@ -212,7 +212,7 @@ index 18a08166..5f3c1625 100644
212
212
+
213
213
+ // If a user customizes maxPartialApplicationFactor > 1; this respects maxBolus
214
214
+ let maxAutomaticBolus = min(iobHeadroom, maxBolus! * min(effectiveBolusApplicationFactor, 1.0))
215
-
215
+
216
216
dosingRecommendation = predictedGlucose.recommendedAutomaticDose(
217
217
to: glucoseTargetRange!,
218
218
@@ -1706,7 +1736,7 @@ extension LoopDataManager {
@@ -227,7 +227,7 @@ index 18a08166..5f3c1625 100644
227
227
@@ -2102,9 +2132,11 @@ extension LoopDataManager {
228
228
}),
229
229
"]",
230
-
230
+
231
231
+ "integralRetrospectiveCorrectionEnabled: \(UserDefaults.standard.integralRetrospectiveCorrectionEnabled)",
232
232
+
233
233
"retrospectiveGlucoseDiscrepancies: [",
@@ -349,23 +349,21 @@ index 00000000..41caa3d7
349
349
+ }
350
350
+ }
351
351
diff --git a/Loop/Loop/Models/LoopSettings+Loop.swift b/Loop/Loop/Models/LoopSettings+Loop.swift
352
- index ce7433a9..fd35b641 100644
352
+ index ce7433a9..c285fb89 100644
353
353
--- a/Loop/Loop/Models/LoopSettings+Loop.swift
354
354
+++ b/Loop/Loop/Models/LoopSettings+Loop.swift
355
- @@ -19,9 +19,5 @@ extension LoopSettings {
356
- }
357
-
355
+ @@ -20,8 +20,4 @@ extension LoopSettings {
356
+
358
357
static let retrospectiveCorrectionEffectDuration = TimeInterval(hours: 1)
359
- -
358
+
360
359
- /// Creates an instance of the enabled retrospective correction implementation
361
360
- var enabledRetrospectiveCorrectionAlgorithm: RetrospectiveCorrection {
362
361
- return StandardRetrospectiveCorrection(effectDuration: LoopSettings.retrospectiveCorrectionEffectDuration)
363
362
- }
364
- +
365
363
}
366
364
diff --git a/Loop/Loop/Models/RetrospectiveCorrection/IntegralRetrospectiveCorrection.swift b/Loop/Loop/Models/RetrospectiveCorrection/IntegralRetrospectiveCorrection.swift
367
365
new file mode 100644
368
- index 00000000..e6ece1c7
366
+ index 00000000..b3b9445a
369
367
--- /dev/null
370
368
+++ b/Loop/Loop/Models/RetrospectiveCorrection/IntegralRetrospectiveCorrection.swift
371
369
@@ -0,0 +1,231 @@
@@ -601,16 +599,13 @@ index 00000000..e6ece1c7
601
599
+
602
600
+ }
603
601
diff --git a/Loop/Loop/View Controllers/PredictionTableViewController.swift b/Loop/Loop/View Controllers/PredictionTableViewController.swift
604
- index 10ed414a..55ade065 100644
605
- --- a/Loop/Loop/View Controllers/PredictionTableViewController.swift
606
- +++ b/Loop/Loop/View Controllers/PredictionTableViewController.swift
602
+ index 10ed414a..52e71ccf 100644
603
+ --- a/Loop/Loop/View Controllers/PredictionTableViewController.swift
604
+ +++ b/Loop/Loop/View Controllers/PredictionTableViewController.swift
607
605
@@ -276,9 +276,26 @@ class PredictionTableViewController: LoopChartsTableViewController, Identifiable
608
606
format: NSLocalizedString("Predicted: %1$@\nActual: %2$@ (%3$@)", comment: "Format string describing retrospective glucose prediction comparison. (1: Predicted glucose)(2: Actual glucose)(3: difference)"),
609
607
values[0], values[1], values[2]
610
608
)
611
- -
612
- - // Standard retrospective correction
613
- - subtitleText = String(format: "%@\n%@", subtitleText, retro)
614
609
+ let isIntegralRetrospectiveCorrectionEnabled = UserDefaults.standard.integralRetrospectiveCorrectionEnabled
615
610
+
616
611
+ if isIntegralRetrospectiveCorrectionEnabled {
@@ -630,9 +625,11 @@ index 10ed414a..55ade065 100644
630
625
+ } else {
631
626
+ subtitleText = String(format: "%@\n%@", subtitleText, retro)
632
627
+ }
633
- +
628
+
629
+ - // Standard retrospective correction
630
+ - subtitleText = String(format: "%@\n%@", subtitleText, retro)
634
631
}
635
-
632
+
636
633
cell.subtitleLabel?.text = subtitleText
637
634
diff --git a/Loop/Loop/Views/GlucoseBasedApplicationFactorSelectionView.swift b/Loop/Loop/Views/GlucoseBasedApplicationFactorSelectionView.swift
638
635
new file mode 100644
@@ -703,7 +700,7 @@ index 00000000..09a68d58
703
700
+ }
704
701
diff --git a/Loop/Loop/Views/IntegralRetrospectiveCorrectionSelectionView.swift b/Loop/Loop/Views/IntegralRetrospectiveCorrectionSelectionView.swift
705
702
new file mode 100644
706
- index 00000000..dfeb37d5
703
+ index 00000000..38e7c7f2
707
704
--- /dev/null
708
705
+++ b/Loop/Loop/Views/IntegralRetrospectiveCorrectionSelectionView.swift
709
706
@@ -0,0 +1,46 @@
@@ -866,18 +863,9 @@ index 00000000..54bd2c71
866
863
+
867
864
+ }
868
865
diff --git a/Loop/Loop/Views/SettingsView.swift b/Loop/Loop/Views/SettingsView.swift
869
- index 90859273..347adb52 100644
866
+ index 90859273..68af9eda 100644
870
867
--- a/Loop/Loop/Views/SettingsView.swift
871
868
+++ b/Loop/Loop/Views/SettingsView.swift
872
- @@ -30,7 +30,7 @@ public struct SettingsView: View {
873
- @State private var therapySettingsIsPresented: Bool = false
874
- @State private var deletePumpDataAlertIsPresented = false
875
- @State private var deleteCGMDataAlertIsPresented = false
876
- -
877
- +
878
- public init(viewModel: SettingsViewModel) {
879
- self.viewModel = viewModel
880
- self.versionUpdateViewModel = viewModel.versionUpdateViewModel
881
869
@@ -177,6 +177,10 @@ extension SettingsView {
882
870
ForEach(configurationMenuItemsForSupportPlugins) { item in
883
871
item.view
@@ -888,15 +876,15 @@ index 90859273..347adb52 100644
888
876
+ }
889
877
}
890
878
}
891
-
879
+
892
880
diff --git a/Loop/Loop/en.lproj/Localizable.strings b/Loop/Loop/en.lproj/Localizable.strings
893
881
index 78907ea3..54d0ee57 100644
894
882
--- a/Loop/Loop/en.lproj/Localizable.strings
895
883
+++ b/Loop/Loop/en.lproj/Localizable.strings
896
884
@@ -246,6 +246,12 @@
897
885
/* The title text for the issue report cell */
898
886
"Issue Report" = "Issue Report";
899
-
887
+
900
888
+ /* Format string describing retrospective glucose prediction comparison. (1: Predicted glucose)(2: Actual glucose)(3: difference) */
901
889
+ "prediction-description-retrospective-correction" = "Predicted: %1$@\nActual: %2$@ (%3$@)";
902
890
+
@@ -905,17 +893,16 @@ index 78907ea3..54d0ee57 100644
905
893
+
906
894
/* Glucose HUD accessibility hint */
907
895
"Launches CGM app" = "Launches CGM app";
908
-
896
+
909
897
diff --git a/LoopConfigOverride.xcconfig b/LoopConfigOverride.xcconfig
910
- index 3ffab2c..bcf7df7 100644
898
+ index 3ffab2c..2714276 100644
911
899
--- a/LoopConfigOverride.xcconfig
912
900
+++ b/LoopConfigOverride.xcconfig
913
- @@ -10,7 +10,7 @@
914
- //URL_SCHEME_NAME = $(MAIN_APP_DISPLAY_NAME)
915
-
916
- // Features
917
- - SWIFT_ACTIVE_COMPILATION_CONDITIONS = $(inherited) SIMULATORS_ENABLED //DEBUG_FEATURES_ENABLED
918
- + SWIFT_ACTIVE_COMPILATION_CONDITIONS = $(inherited) SIMULATORS_ENABLED ALLOW_ALGORITHM_EXPERIMENTS //DEBUG_FEATURES_ENABLED
919
-
901
+ @@ -14,3 +14,6 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = $(inherited) SIMULATORS_ENABLED //DEBUG_FE
902
+
920
903
// Put your team id here for signing
921
904
//LOOP_DEVELOPMENT_TEAM = UY678SP37Q
905
+ +
906
+ + // Add ALLOW_ALGORITHM_EXPERIMENTS to compilation conditions
907
+ + SWIFT_ACTIVE_COMPILATION_CONDITIONS = $(SWIFT_ACTIVE_COMPILATION_CONDITIONS) ALLOW_ALGORITHM_EXPERIMENTS
908
+ \ No newline at end of file
0 commit comments