-
Notifications
You must be signed in to change notification settings - Fork 1
Fix/send manual entry #271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5cd2e5d
gate manual send continue button on decoded address validity
piotr-iohk a8040fc
add editable invoice section
piotr-iohk d46dadf
editable review amount
piotr-iohk 6d02bb4
normalizeManualEntry
piotr-iohk 2db8e0f
preserve invoice amount when editing send value
piotr-iohk 47715d6
chore: trigger CI
piotr-iohk 44944ef
Merge branch 'master' into fix/send-manual-entry
piotr-iohk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,12 +79,22 @@ struct SendConfirmationView: View { | |
|
|
||
| VStack(alignment: .leading, spacing: 0) { | ||
| if app.selectedWalletToPayFrom == .lightning, let invoice = app.scannedLightningInvoice { | ||
| MoneyStack(sats: Int(wallet.sendAmountSats ?? invoice.amountSatoshis), showSymbol: true, testIdPrefix: "ReviewAmount") | ||
| .padding(.bottom, 44) | ||
| MoneyStack( | ||
| sats: Int(wallet.sendAmountSats ?? invoice.amountSatoshis), | ||
| showSymbol: true, | ||
| testIdPrefix: "ReviewAmount", | ||
| onTap: navigateToAmount | ||
| ) | ||
| .padding(.bottom, 44) | ||
| lightningView(invoice) | ||
| } else if app.selectedWalletToPayFrom == .onchain, let invoice = app.scannedOnchainInvoice { | ||
| MoneyStack(sats: Int(wallet.sendAmountSats ?? invoice.amountSatoshis), showSymbol: true, testIdPrefix: "ReviewAmount") | ||
| .padding(.bottom, 44) | ||
| MoneyStack( | ||
| sats: Int(wallet.sendAmountSats ?? invoice.amountSatoshis), | ||
| showSymbol: true, | ||
| testIdPrefix: "ReviewAmount", | ||
| onTap: navigateToAmount | ||
| ) | ||
| .padding(.bottom, 44) | ||
| onchainView(invoice) | ||
| } | ||
| } | ||
|
|
@@ -421,12 +431,10 @@ struct SendConfirmationView: View { | |
| @ViewBuilder | ||
| func onchainView(_ invoice: OnChainInvoice) -> some View { | ||
| VStack(alignment: .leading, spacing: 0) { | ||
| VStack(alignment: .leading, spacing: 8) { | ||
| CaptionMText(t("wallet__send_to")) | ||
| BodySSBText(invoice.address.ellipsis(maxLength: 20)) | ||
| .lineLimit(1) | ||
| .truncationMode(.middle) | ||
| } | ||
| editableInvoiceSection( | ||
| title: t("wallet__send_to"), | ||
| value: invoice.address | ||
| ) | ||
| .padding(.bottom) | ||
| .frame(maxWidth: .infinity, alignment: .leading) | ||
|
|
||
|
|
@@ -487,14 +495,12 @@ struct SendConfirmationView: View { | |
| } | ||
|
|
||
| @ViewBuilder | ||
| func lightningView(_: LightningInvoice) -> some View { | ||
| func lightningView(_ invoice: LightningInvoice) -> some View { | ||
| VStack(alignment: .leading, spacing: 0) { | ||
| VStack(alignment: .leading, spacing: 8) { | ||
| CaptionMText(t("wallet__send_invoice")) | ||
| BodySSBText(app.scannedLightningInvoice?.bolt11.ellipsis(maxLength: 20) ?? "") | ||
| .lineLimit(1) | ||
| .truncationMode(.middle) | ||
| } | ||
| editableInvoiceSection( | ||
| title: t("wallet__send_invoice"), | ||
| value: invoice.bolt11 | ||
| ) | ||
| .padding(.bottom) | ||
| .frame(maxWidth: .infinity, alignment: .leading) | ||
|
|
||
|
|
@@ -565,6 +571,45 @@ struct SendConfirmationView: View { | |
| } | ||
| } | ||
|
|
||
| @ViewBuilder | ||
| private func editableInvoiceSection(title: String, value: String) -> some View { | ||
| Button { | ||
| navigateToManual(with: value) | ||
| } label: { | ||
| VStack(alignment: .leading, spacing: 8) { | ||
| CaptionMText(title) | ||
| BodySSBText(value.ellipsis(maxLength: 20)) | ||
| .lineLimit(1) | ||
| .truncationMode(.middle) | ||
| } | ||
| } | ||
| .buttonStyle(.plain) | ||
| .accessibilityIdentifier("ReviewUri") | ||
| } | ||
piotr-iohk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| private func navigateToManual(with value: String) { | ||
| guard !value.isEmpty else { return } | ||
| app.manualEntryInput = value | ||
| Task { await app.validateManualEntryInput(value) } | ||
piotr-iohk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if let manualIndex = navigationPath.firstIndex(of: .manual) { | ||
| navigationPath = Array(navigationPath.prefix(manualIndex + 1)) | ||
| } else { | ||
| navigationPath = [.manual] | ||
| } | ||
| } | ||
|
|
||
| private func navigateToAmount() { | ||
| if let amountIndex = navigationPath.lastIndex(of: .amount) { | ||
| navigationPath = Array(navigationPath.prefix(amountIndex + 1)) | ||
piotr-iohk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } else { | ||
| if let confirmIndex = navigationPath.lastIndex(of: .confirm) { | ||
| navigationPath = Array(navigationPath.prefix(confirmIndex)) | ||
| } | ||
| navigationPath.append(.amount) | ||
| } | ||
| } | ||
|
Comment on lines
+603
to
+611
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When paying a Lightning invoice with a fixed amount, it shouldn't be possible to change the amount. |
||
|
|
||
| private func calculateTransactionFee() async { | ||
| guard app.selectedWalletToPayFrom == .onchain else { | ||
| return | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.