Fix initialization of Bolus Display Threshold setting
@@ -33,6 +33,7 @@
"xGridLines" : true,
"yGridLines" : true,
"rulerMarks" : true,
+ "bolusDisplayThreshold": 0.01,
"forecastDisplayType": "cone",
"maxCarbs": 250,
"maxFat": 250,
@@ -1,6 +1,6 @@
import Foundation
-enum BolusDisplayThreshold: Decimal, CaseIterable, Encodable, Identifiable {
+enum BolusDisplayThreshold: Decimal, JSON, CaseIterable, Identifiable, Codable, Hashable {
public var id: Decimal { rawValue }
case oneUnit = 1
case halfUnit = 0.5
@@ -249,6 +249,10 @@ extension TrioSettings: Decodable {
settings.rulerMarks = rulerMarks
}
+ if let bolusDisplayThreshold = try? container.decode(BolusDisplayThreshold.self, forKey: .bolusDisplayThreshold) {
+ settings.bolusDisplayThreshold = bolusDisplayThreshold
+ }
+
if let forecastDisplayType = try? container.decode(ForecastDisplayType.self, forKey: .forecastDisplayType) {
settings.forecastDisplayType = forecastDisplayType