Explorar o código

Merge pull request #255 from Sjoerd-Bo3/watch-fixes

Various mmol watch fixes
Deniz Cengiz hai 1 ano
pai
achega
d62efd542b
Modificáronse 1 ficheiros con 4 adicións e 4 borrados
  1. 4 4
      Trio/Sources/Services/WatchManager/AppleWatchManager.swift

+ 4 - 4
Trio/Sources/Services/WatchManager/AppleWatchManager.swift

@@ -206,7 +206,7 @@ final class BaseWatchManager: NSObject, WCSessionDelegate, Injectable, WatchMana
                 watchState.currentGlucose = "\(latestGlucose.glucose)"
             } else {
                 let mgdlValue = Decimal(latestGlucose.glucose)
-                let latestGlucoseValue = Double(truncating: mgdlValue.asMmolL as NSNumber)
+                let latestGlucoseValue = mgdlValue.formattedAsMmolL
                 watchState.currentGlucose = "\(latestGlucoseValue)"
             }
 
@@ -217,9 +217,9 @@ final class BaseWatchManager: NSObject, WCSessionDelegate, Injectable, WatchMana
 
             let highGlucoseValue = isDynamicColorScheme ? hardCodedHigh : self.highGlucose
             let lowGlucoseValue = isDynamicColorScheme ? hardCodedLow : self.lowGlucose
-            let highGlucoseColorValue = self.units == .mgdL ? highGlucoseValue : highGlucoseValue.asMmolL
-            let lowGlucoseColorValue = self.units == .mgdL ? lowGlucoseValue : lowGlucoseValue.asMmolL
-            let targetGlucose = self.units == .mgdL ? self.currentGlucoseTarget : self.currentGlucoseTarget.asMmolL
+            let highGlucoseColorValue = highGlucoseValue
+            let lowGlucoseColorValue = lowGlucoseValue
+            let targetGlucose = self.currentGlucoseTarget
 
             let currentGlucoseColor = Trio.getDynamicGlucoseColor(
                 glucoseValue: Decimal(latestGlucose.glucose),