diff --git a/FreeAPS/Sources/Modules/Home/View/HomeRootView.swift b/FreeAPS/Sources/Modules/Home/View/HomeRootView.swift index 2534c41335..721bd334f2 100644 --- a/FreeAPS/Sources/Modules/Home/View/HomeRootView.swift +++ b/FreeAPS/Sources/Modules/Home/View/HomeRootView.swift @@ -129,6 +129,10 @@ extension Home { ) } + @FetchRequest( + entity: InsulinConcentration.entity(), sortDescriptors: [NSSortDescriptor(key: "date", ascending: true)] + ) var concentration: FetchedResults + @ViewBuilder func header(_: GeometryProxy) -> some View { HStack { Spacer() @@ -710,26 +714,35 @@ extension Home { var body: some View { GeometryReader { geo in VStack(spacing: 0) { - ZStack(alignment: .bottomTrailing) { + ZStack(alignment: .bottom) { glucoseView - if let eventualBG = state.eventualBG { - Text( - "⇢ " + targetFormatter.string( - from: ( - state.units == .mmolL ? eventualBG - .asMmolL : Decimal(eventualBG) - ) as NSNumber - )! - ) - .font(.system(size: 18, weight: .bold)).foregroundColor(.secondary) - .offset(x: 45, y: 4) - } + HStack { + if (concentration.last?.concentration ?? 1) != 1, + !state.settingsManager.settings + .hideInsulinBadge + { + NonStandardInsulin(concentration: concentration.last?.concentration ?? 1, pod: false) + } + Spacer() + if let eventualBG = state.eventualBG { + Text( + "⇢ " + targetFormatter.string( + from: ( + state.units == .mmolL ? eventualBG + .asMmolL : Decimal(eventualBG) + ) as NSNumber + )! + ) + .font(.system(size: 18, weight: .bold)).foregroundColor(.secondary) +// .offset(x: 45, y: 4) + } + }.padding(.horizontal) }.padding(.top, 10) Spacer() header(geo) - .padding(.top, 15) +// .padding(.top, 15) .padding(.horizontal, 10) Spacer() diff --git a/FreeAPS/Sources/Views/ViewModifiers.swift b/FreeAPS/Sources/Views/ViewModifiers.swift index c879ef845c..3a39881f7f 100644 --- a/FreeAPS/Sources/Views/ViewModifiers.swift +++ b/FreeAPS/Sources/Views/ViewModifiers.swift @@ -227,12 +227,12 @@ struct NonStandardInsulin: View { var body: some View { ZStack { - RoundedRectangle(cornerRadius: 15) + RoundedRectangle(cornerRadius: 20) .fill(.red) - .frame(width: 33, height: 15) + .frame(width: 40, height: 20) .overlay { Text("U" + (formatter.string(from: concentration * 100 as NSNumber) ?? "")) - .font(.system(size: 9)) + .font(.system(size: 12)) .foregroundStyle(.white) } }