Skip to content
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

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

Camji55
Copy link
Member

@Camji55 Camji55 commented Nov 21, 2024

@@ -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)
Copy link
Member Author

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
Copy link
Member Author

@Camji55 Camji55 Nov 22, 2024

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) {
Copy link
Member Author

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) {
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant