-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP][LOOP-5153] Remove HealthKit dependency from LoopAlgorithm #726
base: dev
Are you sure you want to change the base?
Conversation
@@ -63,11 +62,11 @@ final class WatchContext: RawRepresentable { | |||
isClosedLoop = rawValue["cl"] as? Bool | |||
|
|||
if let unitString = rawValue["gu"] as? String { | |||
displayGlucoseUnit = HKUnit(from: unitString) | |||
displayGlucoseUnit = LoopUnit(from: unitString) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will verify this -- not 100% this will work with mmol/L
@@ -126,7 +125,15 @@ final class WatchContext: RawRepresentable { | |||
raw["gc"] = glucoseCondition?.rawValue | |||
raw["gt"] = glucoseTrend?.rawValue | |||
if let glucoseTrendRate = glucoseTrendRate { | |||
let unitPerMinute = unit.unitDivided(by: .minute()) | |||
let unitPerMinute: LoopUnit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to verify if this needed
@@ -111,11 +111,21 @@ class StatusWidgetTimelineProvider: TimelineProvider { | |||
} | |||
|
|||
let finalGlucose = glucose | |||
|
|||
let unit: LoopUnit? | |||
switch await healthStore.cachedPreferredUnits(for: .bloodGlucose) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to verify if needed
@@ -298,7 +298,17 @@ class LoopAppManager: NSObject { | |||
} | |||
|
|||
Task { @MainActor in | |||
if let unit = await self.healthStore.cachedPreferredUnits(for: .bloodGlucose) { | |||
var unit: LoopUnit? | |||
switch await self.healthStore.cachedPreferredUnits(for: .bloodGlucose) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to verify if needed
https://tidepool.atlassian.net/browse/LOOP-5153