From 4c4c30bd5d5202c0cb09c5a78bd663c13f2448df Mon Sep 17 00:00:00 2001 From: M Date: Fri, 31 Dec 2021 15:05:27 +0200 Subject: [PATCH] Fix monero transaction history. Remove morph and xmr.to from filters. Fixe generation monero blockchain height by date. --- cw_monero/lib/get_height_by_date.dart | 2 +- lib/monero/cw_monero.dart | 5 +++-- lib/src/screens/dashboard/dashboard_page.dart | 4 ++-- .../screens/restore/wallet_restore_page.dart | 19 +++++++++++++++++-- lib/src/widgets/blockchain_height_widget.dart | 1 - .../dashboard/dashboard_view_model.dart | 10 ---------- 6 files changed, 23 insertions(+), 18 deletions(-) diff --git a/cw_monero/lib/get_height_by_date.dart b/cw_monero/lib/get_height_by_date.dart index 11921a2aa..99e834c58 100644 --- a/cw_monero/lib/get_height_by_date.dart +++ b/cw_monero/lib/get_height_by_date.dart @@ -85,7 +85,7 @@ final dates = { "2020-11": 2220000 }; -int getHeigthByDate({DateTime date}) { +int getMoneroHeigthByDate({DateTime date}) { final raw = '${date.year}' + '-' + '${date.month}'; final lastHeight = dates.values.last; int startHeight; diff --git a/lib/monero/cw_monero.dart b/lib/monero/cw_monero.dart index 6f07ac5e0..7ca101c4a 100644 --- a/lib/monero/cw_monero.dart +++ b/lib/monero/cw_monero.dart @@ -144,7 +144,8 @@ class CWMonero extends Monero { } TransactionHistoryBase getTransactionHistory(Object wallet) { - return MoneroTransactionHistory(); + final moneroWallet = wallet as MoneroWallet; + return moneroWallet.transactionHistory; } MoneroWalletDetails getMoneroWalletDetails(Object wallet) { @@ -152,7 +153,7 @@ class CWMonero extends Monero { } int getHeigthByDate({DateTime date}) { - return getHeigthByDate(date: date); + return getMoneroHeigthByDate(date: date); } TransactionPriority getDefaultTransactionPriority() { diff --git a/lib/src/screens/dashboard/dashboard_page.dart b/lib/src/screens/dashboard/dashboard_page.dart index f193bd335..99df5637b 100644 --- a/lib/src/screens/dashboard/dashboard_page.dart +++ b/lib/src/screens/dashboard/dashboard_page.dart @@ -145,14 +145,14 @@ class DashboardPage extends BasePage { image: exchangeImage, title: S.of(context).exchange, route: Routes.exchange), - if (isMoneroOnly) + if (!isMoneroOnly) ActionButton( image: buyImage, title: S.of(context).buy, onClick: () async => await _onClickBuyButton(context), ), - if (isMoneroOnly) + if (!isMoneroOnly) ActionButton( image: sellImage, title: 'Sell', diff --git a/lib/src/screens/restore/wallet_restore_page.dart b/lib/src/screens/restore/wallet_restore_page.dart index 1f34d4a79..5d83a1e97 100644 --- a/lib/src/screens/restore/wallet_restore_page.dart +++ b/lib/src/screens/restore/wallet_restore_page.dart @@ -104,7 +104,22 @@ class WalletRestorePage extends BasePage { .dateController.text = ''; }); - return Column(mainAxisAlignment: MainAxisAlignment.center, children: [ + return KeyboardActions( + config: KeyboardActionsConfig( + keyboardActionsPlatform: KeyboardActionsPlatform.IOS, + keyboardBarColor: Theme.of(context).accentTextTheme.body2 + .backgroundColor, + nextFocus: false, + actions: [ + KeyboardActionsItem( + focusNode: _blockHeightFocusNode, + toolbarButtons: [(_) => KeyboardDoneButton()], + ) + ]), + child: Container( + height: 0, + color: Theme.of(context).backgroundColor, + child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( child: PageView.builder( onPageChanged: (page) { @@ -146,7 +161,7 @@ class WalletRestorePage extends BasePage { ); }, )) - ]); + ]))); } Map _credentials() { diff --git a/lib/src/widgets/blockchain_height_widget.dart b/lib/src/widgets/blockchain_height_widget.dart index 409cacb93..b87e83bc5 100644 --- a/lib/src/widgets/blockchain_height_widget.dart +++ b/lib/src/widgets/blockchain_height_widget.dart @@ -118,7 +118,6 @@ class BlockchainHeightState extends State { if (date != null) { final height = monero.getHeigthByDate(date: date); - setState(() { dateController.text = DateFormat('yyyy-MM-dd').format(date); restoreHeightController.text = '$height'; diff --git a/lib/view_model/dashboard/dashboard_view_model.dart b/lib/view_model/dashboard/dashboard_view_model.dart index 1fc355e6d..8fc0e08a6 100644 --- a/lib/view_model/dashboard/dashboard_view_model.dart +++ b/lib/view_model/dashboard/dashboard_view_model.dart @@ -62,21 +62,11 @@ abstract class DashboardViewModelBase with Store { // onChanged: null), ], S.current.trades: [ - FilterItem( - value: () => tradeFilterStore.displayXMRTO, - caption: 'XMR.TO', - onChanged: (value) => tradeFilterStore - .toggleDisplayExchange(ExchangeProviderDescription.xmrto)), FilterItem( value: () => tradeFilterStore.displayChangeNow, caption: 'Change.NOW', onChanged: (value) => tradeFilterStore .toggleDisplayExchange(ExchangeProviderDescription.changeNow)), - FilterItem( - value: () => tradeFilterStore.displayMorphToken, - caption: 'MorphToken', - onChanged: (value) => tradeFilterStore - .toggleDisplayExchange(ExchangeProviderDescription.morphToken)), ] };