From 70ff2883fec2c68abaca79ba7f2a79cf28d76530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20M=C3=A5rtensson?= Date: Thu, 2 May 2024 11:36:24 +0200 Subject: [PATCH] Prevent double tapping of the add carbs button (save/continue). --- .../Sources/Modules/AddCarbs/View/AddCarbsRootView.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/FreeAPS/Sources/Modules/AddCarbs/View/AddCarbsRootView.swift b/FreeAPS/Sources/Modules/AddCarbs/View/AddCarbsRootView.swift index 60cfadf2c5..d3ebed4bfc 100644 --- a/FreeAPS/Sources/Modules/AddCarbs/View/AddCarbsRootView.swift +++ b/FreeAPS/Sources/Modules/AddCarbs/View/AddCarbsRootView.swift @@ -12,6 +12,7 @@ extension AddCarbs { @State var isPromptPresented = false @State var saved = false @State var pushed = false + @State var button = false @State private var showAlert = false @FocusState private var isFocused: Bool @@ -113,7 +114,10 @@ extension AddCarbs { } Section { - Button { state.add(override, fetch: editMode) } + Button { + button.toggle() + if button { state.add(override, fetch: editMode) } + } label: { Text(((state.skipBolus && !override && !editMode) || state.carbs <= 0) ? "Save" : "Continue") } .disabled(empty) .frame(maxWidth: .infinity, alignment: .center)