From 74eba1f297cd1fe458033323776a9c8d891a4fa1 Mon Sep 17 00:00:00 2001 From: jessop Date: Wed, 18 Dec 2019 11:47:18 -0500 Subject: [PATCH] provide walletReconnecting state in wallet reducer --- dist/bundle.es.js | 13 ++++++++++++- src/index.js | 1 + src/redux/reducers/wallet.js | 11 +++++++++++ src/redux/selectors/wallet.js | 5 +++++ 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 08cf676..ec30e15 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -1829,6 +1829,8 @@ const makeSelectLatestTransactions = reselect.createSelector(selectTransactionIt const selectFilteredTransactionCount = reselect.createSelector(selectFilteredTransactions, filteredTransactions => filteredTransactions.length); +const selectIsWalletReconnecting = reselect.createSelector(selectState$1, state => state.walletReconnecting); + var _extends$3 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; function _objectWithoutProperties$1(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } @@ -5169,7 +5171,8 @@ const defaultState$a = { walletLockPending: false, walletLockSucceded: null, walletLockResult: null, - transactionListFilter: 'all' + transactionListFilter: 'all', + walletReconnecting: false }; const walletReducer = handleActions({ @@ -5391,6 +5394,13 @@ const walletReducer = handleActions({ [UPDATE_CURRENT_HEIGHT]: (state, action) => _extends$f({}, state, { latestBlock: action.data + }), + [WALLET_RESTART]: state => _extends$f({}, state, { + walletReconnecting: true + }), + + [WALLET_RESTART_COMPLETED]: state => _extends$f({}, state, { + walletReconnecting: false }) }, defaultState$a); @@ -5701,6 +5711,7 @@ exports.selectIsResolvingPublishUris = selectIsResolvingPublishUris; exports.selectIsSearching = selectIsSearching; exports.selectIsSendingSupport = selectIsSendingSupport; exports.selectIsStillEditing = selectIsStillEditing; +exports.selectIsWalletReconnecting = selectIsWalletReconnecting; exports.selectLastPurchasedUri = selectLastPurchasedUri; exports.selectMyActiveClaims = selectMyActiveClaims; exports.selectMyChannelClaims = selectMyChannelClaims; diff --git a/src/index.js b/src/index.js index fc78d59..65f1db9 100644 --- a/src/index.js +++ b/src/index.js @@ -312,6 +312,7 @@ export { makeSelectLatestTransactions, makeSelectFilteredTransactionsForPage, selectFilteredTransactionCount, + selectIsWalletReconnecting, } from 'redux/selectors/wallet'; export { diff --git a/src/redux/reducers/wallet.js b/src/redux/reducers/wallet.js index ae7511d..26639a2 100644 --- a/src/redux/reducers/wallet.js +++ b/src/redux/reducers/wallet.js @@ -42,6 +42,7 @@ type WalletState = { walletLockPending: boolean, walletLockSucceded: ?boolean, walletLockResult: ?boolean, + walletReconnecting: boolean, }; const defaultState = { @@ -74,6 +75,7 @@ const defaultState = { walletLockSucceded: null, walletLockResult: null, transactionListFilter: 'all', + walletReconnecting: false, }; export const walletReducer = handleActions( @@ -326,6 +328,15 @@ export const walletReducer = handleActions( ...state, latestBlock: action.data, }), + [ACTIONS.WALLET_RESTART]: (state: WalletState) => ({ + ...state, + walletReconnecting: true, + }), + + [ACTIONS.WALLET_RESTART_COMPLETED]: (state: WalletState) => ({ + ...state, + walletReconnecting: false, + }), }, defaultState ); diff --git a/src/redux/selectors/wallet.js b/src/redux/selectors/wallet.js index 950b092..77b1bb3 100644 --- a/src/redux/selectors/wallet.js +++ b/src/redux/selectors/wallet.js @@ -323,3 +323,8 @@ export const selectFilteredTransactionCount = createSelector( selectFilteredTransactions, filteredTransactions => filteredTransactions.length ); + +export const selectIsWalletReconnecting = createSelector( + selectState, + state => state.walletReconnecting +); -- 2.45.2