From 20ba334b2c3b62ba296e67695bc015c4e5c868d4 Mon Sep 17 00:00:00 2001 From: bjornoleh Date: Mon, 17 Jun 2024 22:26:57 +0200 Subject: [PATCH] Eventual BG with 1 decimal in the app and watch app - Use `targetFormatter` instead of `numberFormater` for `eventualBG` in the app, since this has the appropriate `maximumFractionDigits = 1` - Change eventualFormatter to use `maximumFractionDigits = 1` instead of `2` on the watch --- FreeAPS/Sources/Modules/Home/View/HomeRootView.swift | 2 +- FreeAPS/Sources/Services/WatchManager/WatchManager.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FreeAPS/Sources/Modules/Home/View/HomeRootView.swift b/FreeAPS/Sources/Modules/Home/View/HomeRootView.swift index 37af36839..96125ed2d 100644 --- a/FreeAPS/Sources/Modules/Home/View/HomeRootView.swift +++ b/FreeAPS/Sources/Modules/Home/View/HomeRootView.swift @@ -344,7 +344,7 @@ extension Home { if let eventualBG = state.eventualBG { Text( - "⇢ " + numberFormatter.string( + "⇢ " + targetFormatter.string( from: (state.units == .mmolL ? eventualBG.asMmolL : Decimal(eventualBG)) as NSNumber )! ) diff --git a/FreeAPS/Sources/Services/WatchManager/WatchManager.swift b/FreeAPS/Sources/Services/WatchManager/WatchManager.swift index f28c44f4c..3757cd74f 100644 --- a/FreeAPS/Sources/Services/WatchManager/WatchManager.swift +++ b/FreeAPS/Sources/Services/WatchManager/WatchManager.swift @@ -216,7 +216,7 @@ final class BaseWatchManager: NSObject, WatchManager, Injectable { private var eventualFormatter: NumberFormatter { let formatter = NumberFormatter() formatter.numberStyle = .decimal - formatter.maximumFractionDigits = 2 + formatter.maximumFractionDigits = 1 return formatter }