From 7724d5e24885962a5dc2bcac8ee58626c6162813 Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Thu, 24 Jun 2021 18:59:19 +0300 Subject: [PATCH 1/4] CAKE-333 | fixed commit() method in the pending_bitcoin_transaction.dart; added bitcoin_commit_transaction_exception.dart to the app --- lib/bitcoin/bitcoin_commit_transaction_exception.dart | 4 ++++ lib/bitcoin/pending_bitcoin_transaction.dart | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 lib/bitcoin/bitcoin_commit_transaction_exception.dart diff --git a/lib/bitcoin/bitcoin_commit_transaction_exception.dart b/lib/bitcoin/bitcoin_commit_transaction_exception.dart new file mode 100644 index 00000000..3e21bae8 --- /dev/null +++ b/lib/bitcoin/bitcoin_commit_transaction_exception.dart @@ -0,0 +1,4 @@ +class BitcoinCommitTransactionException implements Exception { + @override + String toString() => 'Transaction commit is failed.'; +} \ No newline at end of file diff --git a/lib/bitcoin/pending_bitcoin_transaction.dart b/lib/bitcoin/pending_bitcoin_transaction.dart index ec3e3a98..b2681433 100644 --- a/lib/bitcoin/pending_bitcoin_transaction.dart +++ b/lib/bitcoin/pending_bitcoin_transaction.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/bitcoin/bitcoin_commit_transaction_exception.dart'; import 'package:flutter/foundation.dart'; import 'package:bitcoin_flutter/bitcoin_flutter.dart' as bitcoin; import 'package:cake_wallet/core/pending_transaction.dart'; @@ -33,7 +34,13 @@ class PendingBitcoinTransaction with PendingTransaction { @override Future commit() async { - await electrumClient.broadcastTransaction(transactionRaw: _tx.toHex()); + final result = + await electrumClient.broadcastTransaction(transactionRaw: _tx.toHex()); + + if (result.isEmpty) { + throw BitcoinCommitTransactionException(); + } + _listeners?.forEach((listener) => listener(transactionInfo())); } From 889b02871374cfc712687b5fdad0919790f1abe5 Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Fri, 25 Jun 2021 17:49:39 +0300 Subject: [PATCH 2/4] CAKE-333 | fixed isDisabled property of the send button (send_page.dart) --- lib/src/screens/send/send_page.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index eb415367..d9106218 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -570,8 +570,7 @@ class SendPage extends BasePage { textColor: Colors.white, isLoading: sendViewModel.state is IsExecutingState || sendViewModel.state is TransactionCommitting, - isDisabled: - false // FIXME !(syncStore.status is SyncedSyncStatus), + isDisabled: !sendViewModel.isReadyForSend, ); })), )); From 800a8c6984e260a0a53f8bbc96ee4dafb37d4448 Mon Sep 17 00:00:00 2001 From: OleksandrSobol Date: Thu, 22 Jul 2021 14:49:20 +0300 Subject: [PATCH 3/4] CAKE-333 | increased area of tapping on "Coin control" --- lib/src/screens/send/send_page.dart | 35 ++++++++++++++++------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index 769254da..45401b55 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -436,22 +436,25 @@ class SendPage extends BasePage { child: GestureDetector( onTap: () => Navigator.of(context) .pushNamed(Routes.unspentCoinsList), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - S.of(context).coin_control, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - color: Colors.white)), - Icon( - Icons.arrow_forward_ios, - size: 12, - color: Colors.white, - ) - ], + child: Container( + color: Colors.transparent, + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + S.of(context).coin_control, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Colors.white)), + Icon( + Icons.arrow_forward_ios, + size: 12, + color: Colors.white, + ) + ], + ) ) ) ) From 800376b6b20cdf122b98af910768b84313117a5d Mon Sep 17 00:00:00 2001 From: M Date: Thu, 22 Jul 2021 17:30:52 +0300 Subject: [PATCH 4/4] Hide info alert for coin control. --- ios/Podfile.lock | 3 +- .../unspent_coins_list_page.dart | 40 +++++++++---------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 4be2c24b..cfd17c25 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -290,5 +290,6 @@ SPEC CHECKSUMS: url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef webview_flutter: 9f491a9b5a66f2573946a389b2677987b0ff8c0b +PODFILE CHECKSUM: 82161cafcb98ddf3e6a0ff8149da3f656be3f1e3 -COCOAPODS: 1.10.1 +COCOAPODS: 1.9.3 diff --git a/lib/src/screens/unspent_coins/unspent_coins_list_page.dart b/lib/src/screens/unspent_coins/unspent_coins_list_page.dart index 55b283b7..074979eb 100644 --- a/lib/src/screens/unspent_coins/unspent_coins_list_page.dart +++ b/lib/src/screens/unspent_coins/unspent_coins_list_page.dart @@ -15,25 +15,25 @@ class UnspentCoinsListPage extends BasePage { @override String get title => S.current.unspent_coins_title; - @override - Widget trailing(BuildContext context) { - final questionImage = Image.asset('assets/images/question_mark.png', - color: Theme.of(context).primaryTextTheme.title.color); - - return SizedBox( - height: 20.0, - width: 20.0, - child: ButtonTheme( - minWidth: double.minPositive, - child: FlatButton( - highlightColor: Colors.transparent, - splashColor: Colors.transparent, - padding: EdgeInsets.all(0), - onPressed: () => showUnspentCoinsAlert(context), - child: questionImage), - ), - ); - } + //@override + //Widget trailing(BuildContext context) { + // final questionImage = Image.asset('assets/images/question_mark.png', + // color: Theme.of(context).primaryTextTheme.title.color); + + // return SizedBox( + // height: 20.0, + // width: 20.0, + // child: ButtonTheme( + // minWidth: double.minPositive, + // child: FlatButton( + // highlightColor: Colors.transparent, + // splashColor: Colors.transparent, + // padding: EdgeInsets.all(0), + // onPressed: () => showUnspentCoinsAlert(context), + // child: questionImage), + // ), + // ); + //} final UnspentCoinsListViewModel unspentCoinsListViewModel; @@ -64,7 +64,7 @@ class UnspentCoinsListFormState extends State { } void afterLayout(dynamic _) { - showUnspentCoinsAlert(context); + //showUnspentCoinsAlert(context); } @override