Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Common/Models/WatchPredictedGlucose.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ extension WatchPredictedGlucose: RawRepresentable {
var rawValue: RawValue {

return [
"v": values.map { UInt16($0.quantity.doubleValue(for: .milligramsPerDeciliter)) },
"v": values.map { Int16($0.quantity.doubleValue(for: .milligramsPerDeciliter)) },
"d": values[0].startDate,
"i": values[1].startDate.timeIntervalSince(values[0].startDate)
]
}

init?(rawValue: RawValue) {
guard
let values = rawValue["v"] as? [UInt16],
let values = rawValue["v"] as? [Int16],
let firstDate = rawValue["d"] as? Date,
let interval = rawValue["i"] as? TimeInterval
else {
Expand Down
19 changes: 7 additions & 12 deletions WatchApp Extension/Controllers/ChartHUDController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,13 @@ final class ChartHUDController: HUDInterfaceController, WKCrownDelegate {
}

cobLabel.setHidden(true)
if let carbsOnBoard = activeContext.COB {
let carbFormatter = NumberFormatter()
carbFormatter.numberStyle = .decimal
carbFormatter.maximumFractionDigits = 0
let valueStr = carbFormatter.string(from:NSNumber(value:carbsOnBoard))

cobLabel.setText(String(format: NSLocalizedString(
"COB %1$@ g",
comment: "The subtitle format describing grams of active carbs. (1: localized carb value description)"),
valueStr!))
cobLabel.setHidden(false)
}
let carbsOnBoard = activeContext.COB ?? 0
let carbFormatter = NumberFormatter()
carbFormatter.numberStyle = .decimal
carbFormatter.maximumFractionDigits = 0
let valueStr = carbFormatter.string(from:NSNumber(value:carbsOnBoard))
cobLabel.setText(String(format: NSLocalizedString("COB %1$@ g", comment: "The subtitle format describing grams of active carbs. (1: localized carb value description)"), valueStr!))
cobLabel.setHidden(false)

basalLabel.setHidden(true)
if let tempBasal = activeContext.lastNetTempBasalDose {
Expand Down