Skip to content

Commit a3319e3

Browse files
author
Darin Krauss
authored
Rename HealthKit observation related FeatureFlag (#198)
- https://tidepool.atlassian.net/browse/LOOP-1417 - Rename FeatureFlags.observeHealthKitForCurrentAppOnly to observeHealthKitSamplesFromOtherApps - Rename OBSERVE_HEALTHKIT_FOR_CURRENT_APP_ONLY to OBSERVE_HEALTH_KIT_SAMPLES_FROM_OTHER_APPS_DISABLED - Preparation for CarbStore using Core Data as "source of truth" - Set default observeHealthKitSamplesFromOtherApps for various stores
1 parent 616206b commit a3319e3

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed

Common/FeatureFlags.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct FeatureFlagConfiguration: Decodable {
1919
let simulatedCoreDataEnabled: Bool
2020
let walshInsulinModelEnabled: Bool
2121
let fiaspInsulinModelEnabled: Bool
22-
let observeHealthKitForCurrentAppOnly: Bool
22+
let observeHealthKitSamplesFromOtherApps: Bool
2323

2424
fileprivate init() {
2525
// Swift compiler config is inverse, since the default state is enabled.
@@ -75,10 +75,11 @@ struct FeatureFlagConfiguration: Decodable {
7575
self.fiaspInsulinModelEnabled = true
7676
#endif
7777

78-
#if OBSERVE_HEALTHKIT_FOR_CURRENT_APP_ONLY
79-
self.observeHealthKitForCurrentAppOnly = true
78+
// Swift compiler config is inverse, since the default state is enabled.
79+
#if OBSERVE_HEALTH_KIT_SAMPLES_FROM_OTHER_APPS_DISABLED
80+
self.observeHealthKitSamplesFromOtherApps = false
8081
#else
81-
self.observeHealthKitForCurrentAppOnly = false
82+
self.observeHealthKitSamplesFromOtherApps = true
8283
#endif
8384
}
8485
}
@@ -95,6 +96,7 @@ extension FeatureFlagConfiguration : CustomDebugStringConvertible {
9596
"* simulatedCoreDataEnabled: \(simulatedCoreDataEnabled)",
9697
"* walshInsulinModelEnabled: \(walshInsulinModelEnabled)",
9798
"* fiaspInsulinModelEnabled: \(fiaspInsulinModelEnabled)",
99+
"* observeHealthKitSamplesFromOtherApps: \(observeHealthKitSamplesFromOtherApps)",
98100
].joined(separator: "\n")
99101
}
100102
}

Learn/Managers/DataManager.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ final class DataManager {
3434

3535
carbStore = CarbStore(
3636
healthStore: healthStore,
37-
observeHealthKitForCurrentAppOnly: false,
3837
cacheStore: cacheStore,
3938
cacheLength: .hours(24),
4039
defaultAbsorptionTimes: (fast: .minutes(30), medium: .hours(3), slow: .hours(5)),
@@ -45,7 +44,6 @@ final class DataManager {
4544

4645
doseStore = DoseStore(
4746
healthStore: healthStore,
48-
observeHealthKitForCurrentAppOnly: false,
4947
cacheStore: cacheStore,
5048
observationEnabled: false,
5149
insulinModel: insulinModelSettings?.model,
@@ -55,7 +53,6 @@ final class DataManager {
5553

5654
glucoseStore = GlucoseStore(
5755
healthStore: healthStore,
58-
observeHealthKitForCurrentAppOnly: false,
5956
cacheStore: cacheStore,
6057
observationEnabled: false
6158
)

Loop Status Extension/StatusViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ class StatusViewController: UIViewController, NCWidgetProviding {
7575

7676
lazy var glucoseStore = GlucoseStore(
7777
healthStore: healthStore,
78-
observeHealthKitForCurrentAppOnly: FeatureFlags.observeHealthKitForCurrentAppOnly,
78+
observeHealthKitSamplesFromOtherApps: FeatureFlags.observeHealthKitSamplesFromOtherApps,
7979
cacheStore: cacheStore,
8080
observationEnabled: false
8181
)
8282

8383
lazy var doseStore = DoseStore(
8484
healthStore: healthStore,
85-
observeHealthKitForCurrentAppOnly: FeatureFlags.observeHealthKitForCurrentAppOnly,
85+
observeHealthKitSamplesFromOtherApps: FeatureFlags.observeHealthKitSamplesFromOtherApps,
8686
cacheStore: cacheStore,
8787
observationEnabled: false,
8888
insulinModel: defaults?.insulinModelSettings?.model,
@@ -92,7 +92,7 @@ class StatusViewController: UIViewController, NCWidgetProviding {
9292

9393
let absorptionTimes = LoopSettings.defaultCarbAbsorptionTimes
9494
lazy var carbStore = CarbStore(healthStore: healthStore,
95-
observeHealthKitForCurrentAppOnly: FeatureFlags.observeHealthKitForCurrentAppOnly,
95+
observeHealthKitSamplesFromOtherApps: FeatureFlags.observeHealthKitSamplesFromOtherApps,
9696
cacheStore: cacheStore,
9797
cacheLength: TimeInterval(days: 1),
9898
defaultAbsorptionTimes: absorptionTimes,

Loop/Managers/LoopDataManager.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ final class LoopDataManager {
8080

8181
carbStore = CarbStore(
8282
healthStore: healthStore,
83-
observeHealthKitForCurrentAppOnly: FeatureFlags.observeHealthKitForCurrentAppOnly,
83+
observeHealthKitSamplesFromOtherApps: FeatureFlags.observeHealthKitSamplesFromOtherApps,
8484
cacheStore: cacheStore,
8585
cacheLength: localCacheDuration,
8686
defaultAbsorptionTimes: absorptionTimes,
@@ -93,7 +93,7 @@ final class LoopDataManager {
9393

9494
doseStore = DoseStore(
9595
healthStore: healthStore,
96-
observeHealthKitForCurrentAppOnly: FeatureFlags.observeHealthKitForCurrentAppOnly,
96+
observeHealthKitSamplesFromOtherApps: FeatureFlags.observeHealthKitSamplesFromOtherApps,
9797
cacheStore: cacheStore,
9898
cacheLength: localCacheDuration,
9999
insulinModel: insulinModelSettings?.model,
@@ -107,7 +107,7 @@ final class LoopDataManager {
107107

108108
glucoseStore = GlucoseStore(
109109
healthStore: healthStore,
110-
observeHealthKitForCurrentAppOnly: FeatureFlags.observeHealthKitForCurrentAppOnly,
110+
observeHealthKitSamplesFromOtherApps: FeatureFlags.observeHealthKitSamplesFromOtherApps,
111111
cacheStore: cacheStore,
112112
cacheLength: localCacheDuration,
113113
observationInterval: .hours(24)

WatchApp Extension/Managers/LoopDataManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class LoopDataManager {
6868

6969
carbStore = CarbStore(
7070
healthStore: healthStore,
71-
observeHealthKitForCurrentAppOnly: FeatureFlags.observeHealthKitForCurrentAppOnly,
71+
observeHealthKitSamplesFromOtherApps: FeatureFlags.observeHealthKitSamplesFromOtherApps,
7272
cacheStore: cacheStore,
7373
cacheLength: cacheDuration,
7474
defaultAbsorptionTimes: absorptionTimes,
@@ -77,7 +77,7 @@ class LoopDataManager {
7777
)
7878
glucoseStore = GlucoseStore(
7979
healthStore: healthStore,
80-
observeHealthKitForCurrentAppOnly: FeatureFlags.observeHealthKitForCurrentAppOnly,
80+
observeHealthKitSamplesFromOtherApps: FeatureFlags.observeHealthKitSamplesFromOtherApps,
8181
cacheStore: cacheStore,
8282
cacheLength: .hours(4)
8383
)

0 commit comments

Comments
 (0)