From 29f44d5c5937db03e72cfd995da90d1aaff8b4c9 Mon Sep 17 00:00:00 2001 From: mokeyCode Date: Sun, 11 Jun 2023 23:37:57 +0800 Subject: [PATCH] fix qr scan --- android/app/src/debug/AndroidManifest.xml | 2 +- android/app/src/main/AndroidManifest.xml | 2 +- android/app/src/profile/AndroidManifest.xml | 2 +- lib/page/common/add_contacts_page.dart | 11 +++++++---- lib/page/common/back_up_page.dart | 1 + lib/page/detail/contacts_page.dart | 11 +++++++---- lib/page/wallet/wallet_page.dart | 4 +++- pubspec.yaml | 2 +- 8 files changed, 22 insertions(+), 13 deletions(-) diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index 1e0a785..0bc6f6a 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -9,7 +9,7 @@ - + diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 7368b30..e66f713 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -5,7 +5,7 @@ - + diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml index 1e0a785..0bc6f6a 100644 --- a/android/app/src/profile/AndroidManifest.xml +++ b/android/app/src/profile/AndroidManifest.xml @@ -9,7 +9,7 @@ - + diff --git a/lib/page/common/add_contacts_page.dart b/lib/page/common/add_contacts_page.dart index a7ec171..06b33f2 100644 --- a/lib/page/common/add_contacts_page.dart +++ b/lib/page/common/add_contacts_page.dart @@ -85,11 +85,14 @@ class _AddContactsPage extends State { if (res != null) { // 判断 res 是否是一个 json 字符串 bool isJosn = TransactionHelper.isJson(res); + String address = res; Map json = {}; - String address = ""; - if (isJosn) { - json = const JsonDecoder().convert(res); - address = json["address"] ?? ""; + bool flag1 = TransactionHelper.checkAddress(address); + if (!flag1) { + if (isJosn) { + json = const JsonDecoder().convert(res); + address = json["address"] ?? ""; + } } bool flag = TransactionHelper.checkAddress(address); if (flag) { diff --git a/lib/page/common/back_up_page.dart b/lib/page/common/back_up_page.dart index faeb3a8..a835226 100644 --- a/lib/page/common/back_up_page.dart +++ b/lib/page/common/back_up_page.dart @@ -34,6 +34,7 @@ class BackUpPage extends StatelessWidget { args = ModalRoute.of(context)!.settings.arguments as BackUpPageRouteParams; } if (args.type == 0) { + // print(args.data); var mnemonicList = args.data.trim().split(' '); mnemonicList.asMap().forEach((index, value) { mnemonicItemList.add(MnemonicItem(index + 1, value)); diff --git a/lib/page/detail/contacts_page.dart b/lib/page/detail/contacts_page.dart index 6e79f8b..b0798a7 100644 --- a/lib/page/detail/contacts_page.dart +++ b/lib/page/detail/contacts_page.dart @@ -80,11 +80,14 @@ class ContactsStatePage extends State { if (res != null) { // 判断 res 是否是一个 json 字符串 bool isJosn = TransactionHelper.isJson(res); + String address = res; Map json = {}; - String address = ""; - if (isJosn) { - json = const JsonDecoder().convert(res); - address = json["address"] ?? ""; + bool flag1 = TransactionHelper.checkAddress(address); + if (!flag1) { + if (isJosn) { + json = const JsonDecoder().convert(res); + address = json["address"] ?? ""; + } } bool flag = TransactionHelper.checkAddress(address); if (flag) { diff --git a/lib/page/wallet/wallet_page.dart b/lib/page/wallet/wallet_page.dart index 76107c3..cac12a9 100644 --- a/lib/page/wallet/wallet_page.dart +++ b/lib/page/wallet/wallet_page.dart @@ -110,6 +110,7 @@ class WalletPageState extends State { "id": 1 }); walletModal.setBlance(responseBalance.data['result']); + // print("$explorURL/block/${wallet.address}?addresses_page=$currentPage&addresses_per_page=100"); Response response = await dio.get( "$explorURL/block/${wallet.address}?addresses_page=$currentPage&addresses_per_page=100", cancelToken: cancelToken, @@ -146,13 +147,14 @@ class WalletPageState extends State { List newList2 = []; newList2.addAll(allList); String lastTime = ""; - for (var i = 0; i < allList.length - 1; i++) { + for (var i = 0; i < allList.length; i++) { var transaction = allList[i]; if (lastTime == "" || lastTime.substring(0, 7) != transaction.time.substring(0, 7)) { lastTime = transaction.time; newList2.insert(i, Transaction(type: 2, time: transaction.time, amount: '', address: '', status: "", from: '', to: '', hash: '', blockAddress: '', fee: 0, remark: "")); } } + // print(newList2); if (mounted) { setState(() { list = newList2; diff --git a/pubspec.yaml b/pubspec.yaml index af57502..ba9e0d0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.15+16 +version: 1.0.19+20 environment: sdk: '>=2.19.2 <3.0.0'