revised bugs in transaction details screen

Tanner Silva committed Nov 30, 2020 at 21:52 UTC 558c6fff2251bb6477993d04ef5528064f0d00e8
1 file changed +19 -7
lib/src/screens/transaction_details/transaction_details_page.dart
+19 -7
@@ -15,6 +15,19 @@ import 'package:url_launcher/url_launcher.dart';
15
16 import 'package:hive/hive.dart';
17
18 +String stripURLToTXID(String inputString) {
19 + final RegExp txidRegex = new RegExp('[a-z0-9]{64}');
20 + return txidRegex.allMatches(inputString).first.group(0);
21 +}
22 +
23 +String blockExplorerName(String inputName) {
24 + if (inputName.contains("xmrchain")) {
25 + return "XMRChain.net";
26 + } else {
27 + return "Blockchain.com";
28 + }
29 +}
30 +
31 class TransactionDetailsPage extends BasePage {
32 TransactionDetailsPage(this.transactionInfo, bool showRecipientAddress,
33 Box<TransactionDescription> transactionDescriptionBox)
@@ -34,12 +47,8 @@ class TransactionDetailsPage extends BasePage {
47 StandartListItem(
48 title: S.current.transaction_details_amount,
49 value: tx.amountFormatted()),
37 - StandartListItem(title: S.current.send_fee, value: tx.feeFormatted()),
38 - StandartListItem(
39 - title: "View in Block Explorer",
40 - value: "https://xmrchain.net/search?value=${tx.id}")
50 + StandartListItem(title: S.current.send_fee, value: tx.feeFormatted())
51 ];
42 -
52 if (showRecipientAddress) {
53 final recipientAddress = transactionDescriptionBox.values
54 .firstWhere((val) => val.id == transactionInfo.id,
@@ -52,9 +61,11 @@ class TransactionDetailsPage extends BasePage {
61 value: recipientAddress));
62 }
63 }
64 + items.add(StandartListItem(
65 + title: "View in Block Explorer",
66 + value: "https://xmrchain.net/search?value=${tx.id}"));
67
68 if (tx.key?.isNotEmpty ?? null) {
57 - // FIXME: add translation
69 items.add(StandartListItem(title: 'Transaction Key', value: tx.key));
70 }
71
@@ -129,7 +140,8 @@ class TransactionDetailsPage extends BasePage {
140 },
141 child: StandartListRow(
142 title: '${item.title}:',
132 - value: item.value,
143 + value:
144 + "View transaction on ${blockExplorerName(item.value)}",
145 isDrawBottom: isFinalBlockExplorerItem),
146 );
147 }