Skip to content

Commit

Permalink
Prevent double tapping of the add carbs button (save/continue). (Arti…
Browse files Browse the repository at this point in the history
  • Loading branch information
mountrcg committed May 20, 2024
1 parent 9dff364 commit 97ea503
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions FreeAPS/Sources/Modules/AddCarbs/View/AddCarbsRootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -130,8 +131,11 @@ extension AddCarbs {
}

Section {
Button { state.add(override, fetch: editMode) }
label: { Text((state.skipBolus && !override && !editMode) ? "Save" : "Continue") }
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)
}.listRowBackground(!empty ? Color(.systemBlue) : Color(.systemGray4))
Expand Down

0 comments on commit 97ea503

Please sign in to comment.