File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,14 +117,23 @@ struct SpendingAdvancedView: View {
117117 }
118118 }
119119 . onChange ( of: transfer. transferValues. maxLspBalance, initial: true ) { updateInputCap ( ) }
120- . onChange ( of: amountViewModel. maxExceededCount) { showMaxExceededToast ( ) }
120+ . onChange ( of: amountViewModel. maxExceededCount) { onMaxExceeded ( ) }
121121 }
122122
123123 private func updateInputCap( ) {
124124 let maxLspBalance = transfer. transferValues. maxLspBalance
125125 amountViewModel. maxAmountOverride = maxLspBalance > 0 ? maxLspBalance : nil
126126 }
127127
128+ private func onMaxExceeded( ) {
129+ // Snap the input to the max so the user lands on the highest allowed amount.
130+ let maxLspBalance = transfer. transferValues. maxLspBalance
131+ if maxLspBalance > 0 {
132+ amountViewModel. updateFromSats ( maxLspBalance, currency: currency)
133+ }
134+ showMaxExceededToast ( )
135+ }
136+
128137 private func showMaxExceededToast( ) {
129138 app. toast (
130139 type: . warning,
You can’t perform that action at this time.
0 commit comments