@@ -79,12 +79,22 @@ struct SendConfirmationView: View {
7979
8080 VStack ( alignment: . leading, spacing: 0 ) {
8181 if app. selectedWalletToPayFrom == . lightning, let invoice = app. scannedLightningInvoice {
82- MoneyStack ( sats: Int ( wallet. sendAmountSats ?? invoice. amountSatoshis) , showSymbol: true , testIdPrefix: " ReviewAmount " )
83- . padding ( . bottom, 44 )
82+ MoneyStack (
83+ sats: Int ( wallet. sendAmountSats ?? invoice. amountSatoshis) ,
84+ showSymbol: true ,
85+ testIdPrefix: " ReviewAmount " ,
86+ onTap: navigateToAmount
87+ )
88+ . padding ( . bottom, 44 )
8489 lightningView ( invoice)
8590 } else if app. selectedWalletToPayFrom == . onchain, let invoice = app. scannedOnchainInvoice {
86- MoneyStack ( sats: Int ( wallet. sendAmountSats ?? invoice. amountSatoshis) , showSymbol: true , testIdPrefix: " ReviewAmount " )
87- . padding ( . bottom, 44 )
91+ MoneyStack (
92+ sats: Int ( wallet. sendAmountSats ?? invoice. amountSatoshis) ,
93+ showSymbol: true ,
94+ testIdPrefix: " ReviewAmount " ,
95+ onTap: navigateToAmount
96+ )
97+ . padding ( . bottom, 44 )
8898 onchainView ( invoice)
8999 }
90100 }
@@ -421,12 +431,10 @@ struct SendConfirmationView: View {
421431 @ViewBuilder
422432 func onchainView( _ invoice: OnChainInvoice ) -> some View {
423433 VStack ( alignment: . leading, spacing: 0 ) {
424- VStack ( alignment: . leading, spacing: 8 ) {
425- CaptionMText ( t ( " wallet__send_to " ) )
426- BodySSBText ( invoice. address. ellipsis ( maxLength: 20 ) )
427- . lineLimit ( 1 )
428- . truncationMode ( . middle)
429- }
434+ editableInvoiceSection (
435+ title: t ( " wallet__send_to " ) ,
436+ value: invoice. address
437+ )
430438 . padding ( . bottom)
431439 . frame ( maxWidth: . infinity, alignment: . leading)
432440
@@ -487,14 +495,12 @@ struct SendConfirmationView: View {
487495 }
488496
489497 @ViewBuilder
490- func lightningView( _: LightningInvoice ) -> some View {
498+ func lightningView( _ invoice : LightningInvoice ) -> some View {
491499 VStack ( alignment: . leading, spacing: 0 ) {
492- VStack ( alignment: . leading, spacing: 8 ) {
493- CaptionMText ( t ( " wallet__send_invoice " ) )
494- BodySSBText ( app. scannedLightningInvoice? . bolt11. ellipsis ( maxLength: 20 ) ?? " " )
495- . lineLimit ( 1 )
496- . truncationMode ( . middle)
497- }
500+ editableInvoiceSection (
501+ title: t ( " wallet__send_invoice " ) ,
502+ value: invoice. bolt11
503+ )
498504 . padding ( . bottom)
499505 . frame ( maxWidth: . infinity, alignment: . leading)
500506
@@ -565,6 +571,45 @@ struct SendConfirmationView: View {
565571 }
566572 }
567573
574+ @ViewBuilder
575+ private func editableInvoiceSection( title: String , value: String ) -> some View {
576+ Button {
577+ navigateToManual ( with: value)
578+ } label: {
579+ VStack ( alignment: . leading, spacing: 8 ) {
580+ CaptionMText ( title)
581+ BodySSBText ( value. ellipsis ( maxLength: 20 ) )
582+ . lineLimit ( 1 )
583+ . truncationMode ( . middle)
584+ }
585+ }
586+ . buttonStyle ( . plain)
587+ . accessibilityIdentifier ( " ReviewUri " )
588+ }
589+
590+ private func navigateToManual( with value: String ) {
591+ guard !value. isEmpty else { return }
592+ app. manualEntryInput = value
593+ Task { await app. validateManualEntryInput ( value) }
594+
595+ if let manualIndex = navigationPath. firstIndex ( of: . manual) {
596+ navigationPath = Array ( navigationPath. prefix ( manualIndex + 1 ) )
597+ } else {
598+ navigationPath = [ . manual]
599+ }
600+ }
601+
602+ private func navigateToAmount( ) {
603+ if let amountIndex = navigationPath. lastIndex ( of: . amount) {
604+ navigationPath = Array ( navigationPath. prefix ( amountIndex + 1 ) )
605+ } else {
606+ if let confirmIndex = navigationPath. lastIndex ( of: . confirm) {
607+ navigationPath = Array ( navigationPath. prefix ( confirmIndex) )
608+ }
609+ navigationPath. append ( . amount)
610+ }
611+ }
612+
568613 private func calculateTransactionFee( ) async {
569614 guard app. selectedWalletToPayFrom == . onchain else {
570615 return
0 commit comments