Skip to content

Commit 1ed60bd

Browse files
committed
Remove option to disable dynamic carbs
1 parent 46d64d2 commit 1ed60bd

File tree

6 files changed

+14
-17
lines changed

6 files changed

+14
-17
lines changed

Common/FeatureFlags.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ struct FeatureFlagConfiguration: Decodable {
3535
let siriEnabled: Bool
3636
let simpleBolusCalculatorEnabled: Bool
3737
let usePositiveMomentumAndRCForManualBoluses: Bool
38-
let dynamicCarbAbsorptionEnabled: Bool
3938
let adultChildInsulinModelSelectionEnabled: Bool
4039
let profileExpirationSettingsViewEnabled: Bool
4140
let missedMealNotifications: Bool
@@ -214,8 +213,6 @@ struct FeatureFlagConfiguration: Decodable {
214213
self.adultChildInsulinModelSelectionEnabled = false
215214
#endif
216215

217-
self.dynamicCarbAbsorptionEnabled = true
218-
219216
// ProfileExpirationSettingsView is inverse, since the default state is enabled.
220217
#if PROFILE_EXPIRATION_SETTINGS_VIEW_DISABLED
221218
self.profileExpirationSettingsViewEnabled = false
@@ -266,7 +263,6 @@ extension FeatureFlagConfiguration : CustomDebugStringConvertible {
266263
"* allowDebugFeatures: \(allowDebugFeatures)",
267264
"* simpleBolusCalculatorEnabled: \(simpleBolusCalculatorEnabled)",
268265
"* usePositiveMomentumAndRCForManualBoluses: \(usePositiveMomentumAndRCForManualBoluses)",
269-
"* dynamicCarbAbsorptionEnabled: \(dynamicCarbAbsorptionEnabled)",
270266
"* adultChildInsulinModelSelectionEnabled: \(adultChildInsulinModelSelectionEnabled)",
271267
"* profileExpirationSettingsViewEnabled: \(profileExpirationSettingsViewEnabled)",
272268
"* missedMealNotifications: \(missedMealNotifications)",

Loop/Managers/LoopDataManager.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ extension LoopDataManager {
10551055
updateGroup.enter()
10561056
carbStore.getGlucoseEffects(
10571057
start: retrospectiveStart, end: nil,
1058-
effectVelocities: FeatureFlags.dynamicCarbAbsorptionEnabled ? insulinCounteractionEffects : nil
1058+
effectVelocities: insulinCounteractionEffects
10591059
) { (result) -> Void in
10601060
switch result {
10611061
case .failure(let error):
@@ -1074,7 +1074,7 @@ extension LoopDataManager {
10741074

10751075
if carbsOnBoard == nil {
10761076
updateGroup.enter()
1077-
carbStore.carbsOnBoard(at: now(), effectVelocities: FeatureFlags.dynamicCarbAbsorptionEnabled ? insulinCounteractionEffects : nil) { (result) in
1077+
carbStore.carbsOnBoard(at: now(), effectVelocities: insulinCounteractionEffects) { (result) in
10781078
switch result {
10791079
case .failure(let error):
10801080
switch error {
@@ -1238,7 +1238,7 @@ extension LoopDataManager {
12381238
of: [potentialCarbEntry],
12391239
startingAt: retrospectiveStart,
12401240
endingAt: nil,
1241-
effectVelocities: FeatureFlags.dynamicCarbAbsorptionEnabled ? insulinCounteractionEffects : nil
1241+
effectVelocities: insulinCounteractionEffects
12421242
)
12431243

12441244
effects.append(potentialCarbEffect)
@@ -1257,7 +1257,7 @@ extension LoopDataManager {
12571257
of: entries,
12581258
startingAt: retrospectiveStart,
12591259
endingAt: nil,
1260-
effectVelocities: FeatureFlags.dynamicCarbAbsorptionEnabled ? insulinCounteractionEffects : nil
1260+
effectVelocities: insulinCounteractionEffects
12611261
)
12621262

12631263
effects.append(potentialCarbEffect)
@@ -1385,7 +1385,7 @@ extension LoopDataManager {
13851385
updateGroup.enter()
13861386
carbStore.getGlucoseEffects(
13871387
start: retrospectiveStart, end: nil,
1388-
effectVelocities: FeatureFlags.dynamicCarbAbsorptionEnabled ? insulinCounteractionEffects : nil
1388+
effectVelocities: insulinCounteractionEffects
13891389
) { result in
13901390
switch result {
13911391
case .failure(let error):

Loop/Managers/Store Protocols/CarbStoreProtocol.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ protocol CarbStoreProtocol: AnyObject {
4040
func generateDiagnosticReport(_ completion: @escaping (_ report: String) -> Void)
4141

4242
// MARK: COB & Effect Generation
43-
func getGlucoseEffects(start: Date, end: Date?, effectVelocities: [GlucoseEffectVelocity]?, completion: @escaping(_ result: CarbStoreResult<(entries: [StoredCarbEntry], effects: [GlucoseEffect])>) -> Void)
43+
func getGlucoseEffects(start: Date, end: Date?, effectVelocities: [GlucoseEffectVelocity], completion: @escaping(_ result: CarbStoreResult<(entries: [StoredCarbEntry], effects: [GlucoseEffect])>) -> Void)
4444

45-
func glucoseEffects<Sample: CarbEntry>(of samples: [Sample], startingAt start: Date, endingAt end: Date?, effectVelocities: [GlucoseEffectVelocity]?) throws -> [GlucoseEffect]
45+
func glucoseEffects<Sample: CarbEntry>(of samples: [Sample], startingAt start: Date, endingAt end: Date?, effectVelocities: [GlucoseEffectVelocity]) throws -> [GlucoseEffect]
4646

4747
func getCarbsOnBoardValues(start: Date, end: Date?, effectVelocities: [GlucoseEffectVelocity]?, completion: @escaping (_ result: CarbStoreResult<[CarbValue]>) -> Void)
4848

Loop/View Controllers/CarbAbsorptionViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ final class CarbAbsorptionViewController: LoopChartsTableViewController, Identif
159159
insulinCounteractionEffects = allInsulinCounteractionEffects.filterDateRange(chartStartDate, nil)
160160

161161
reloadGroup.enter()
162-
self.deviceManager.carbStore.getCarbStatus(start: listStart, end: nil, effectVelocities: FeatureFlags.dynamicCarbAbsorptionEnabled ? allInsulinCounteractionEffects : nil) { (result) in
162+
self.deviceManager.carbStore.getCarbStatus(start: listStart, end: nil, effectVelocities: allInsulinCounteractionEffects) { (result) in
163163
switch result {
164164
case .success(let status):
165165
carbStatuses = status
@@ -173,7 +173,7 @@ final class CarbAbsorptionViewController: LoopChartsTableViewController, Identif
173173
}
174174

175175
reloadGroup.enter()
176-
self.deviceManager.carbStore.getGlucoseEffects(start: chartStartDate, end: nil, effectVelocities: FeatureFlags.dynamicCarbAbsorptionEnabled ? insulinCounteractionEffects : nil) { (result) in
176+
self.deviceManager.carbStore.getGlucoseEffects(start: chartStartDate, end: nil, effectVelocities: insulinCounteractionEffects!) { (result) in
177177
switch result {
178178
case .success((_, let effects)):
179179
carbEffects = effects

Loop/View Controllers/StatusTableViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ final class StatusTableViewController: LoopChartsTableViewController {
449449

450450
if currentContext.contains(.carbs) {
451451
reloadGroup.enter()
452-
self.deviceManager.carbStore.getCarbsOnBoardValues(start: startDate, end: nil, effectVelocities: FeatureFlags.dynamicCarbAbsorptionEnabled ? state.insulinCounteractionEffects : nil) { (result) in
452+
self.deviceManager.carbStore.getCarbsOnBoardValues(start: startDate, end: nil, effectVelocities: state.insulinCounteractionEffects) { (result) in
453453
switch result {
454454
case .failure(let error):
455455
self.log.error("CarbStore failed to get carbs on board values: %{public}@", String(describing: error))

LoopTests/Mock Stores/MockCarbStore.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class MockCarbStore: CarbStoreProtocol {
7777
completion("")
7878
}
7979

80-
func glucoseEffects<Sample>(of samples: [Sample], startingAt start: Date, endingAt end: Date?, effectVelocities: [GlucoseEffectVelocity]?) throws -> [GlucoseEffect] where Sample : CarbEntry {
80+
func glucoseEffects<Sample>(of samples: [Sample], startingAt start: Date, endingAt end: Date?, effectVelocities: [LoopKit.GlucoseEffectVelocity]) throws -> [LoopKit.GlucoseEffect] where Sample : LoopKit.CarbEntry {
8181
return []
8282
}
8383

@@ -96,8 +96,9 @@ class MockCarbStore: CarbStoreProtocol {
9696
func deleteCarbEntry(_ entry: StoredCarbEntry, completion: @escaping (CarbStoreResult<Bool>) -> Void) {
9797
completion(.failure(.notConfigured))
9898
}
99-
100-
func getGlucoseEffects(start: Date, end: Date? = nil, effectVelocities: [GlucoseEffectVelocity]?, completion: @escaping(_ result: CarbStoreResult<(entries: [StoredCarbEntry], effects: [GlucoseEffect])>) -> Void) {
99+
100+
func getGlucoseEffects(start: Date, end: Date?, effectVelocities: [LoopKit.GlucoseEffectVelocity], completion: @escaping (LoopKit.CarbStoreResult<(entries: [LoopKit.StoredCarbEntry], effects: [LoopKit.GlucoseEffect])>) -> Void)
101+
{
101102
let fixture: [JSONDictionary] = loadFixture(fixtureToLoad)
102103

103104
let dateFormatter = ISO8601DateFormatter.localTimeDate()

0 commit comments

Comments
 (0)