Skip to content

Commit

Permalink
Prevent double tapping of the add carbs button (save/continue). (#637)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon-b-m authored May 2, 2024
1 parent 70df545 commit ddf8879
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion 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 @@ -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)
Expand Down

0 comments on commit ddf8879

Please sign in to comment.