From aeac92275c017e4c5789abc590ebf3c7e6dfff3a Mon Sep 17 00:00:00 2001 From: jessop Date: Thu, 15 Aug 2019 21:33:07 -0400 Subject: [PATCH] adds hashChanged from sync get response --- dist/bundle.es.js | 11 ++++++++--- dist/bundle.js | 15 ++++++++++++--- src/index.js | 1 + src/redux/actions/sync.js | 7 ++++++- src/redux/reducers/sync.js | 2 ++ src/redux/selectors/sync.js | 2 ++ 6 files changed, 31 insertions(+), 7 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 9f265b0..8123f01 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -2205,7 +2205,8 @@ function doCheckSync() { const data = { hasSyncedWallet: true, syncHash: response.hash, - syncData: response.data + syncData: response.data, + hashChanged: response.changed }; dispatch({ type: GET_SYNC_COMPLETED, @@ -2732,7 +2733,8 @@ const defaultState$9 = { syncApplyErrorMessage: '', syncApplyIsPending: false, getSyncIsPending: false, - setSyncIsPending: false + setSyncIsPending: false, + hashChanged: false }; reducers$3[GET_SYNC_STARTED] = state => Object.assign({}, state, { @@ -2743,7 +2745,8 @@ reducers$3[GET_SYNC_COMPLETED] = (state, action) => Object.assign({}, state, { syncHash: action.data.syncHash, syncData: action.data.syncData, hasSyncedWallet: action.data.hasSyncedWallet, - getSyncIsPending: false + getSyncIsPending: false, + hashChanged: action.data.hashChanged }); reducers$3[SET_SYNC_STARTED] = state => Object.assign({}, state, { @@ -2822,6 +2825,7 @@ const selectSyncData = reselect.createSelector(selectState$9, state => state.syn const selectSetSyncErrorMessage = reselect.createSelector(selectState$9, state => state.setSyncErrorMessage); const selectGetSyncIsPending = reselect.createSelector(selectState$9, state => state.getSyncIsPending); const selectSetSyncIsPending = reselect.createSelector(selectState$9, state => state.setSyncIsPending); +const selectHashChanged = reselect.createSelector(selectState$9, state => state.hashChanged); const selectSyncApplyIsPending = reselect.createSelector(selectState$9, state => state.syncApplyIsPending); const selectSyncApplyErrorMessage = reselect.createSelector(selectState$9, state => state.syncApplyErrorMessage); @@ -2918,6 +2922,7 @@ exports.selectFilteredOutpoints = selectFilteredOutpoints; exports.selectFirstRunCompleted = selectFirstRunCompleted; exports.selectGetSyncIsPending = selectGetSyncIsPending; exports.selectHasSyncedWallet = selectHasSyncedWallet; +exports.selectHashChanged = selectHashChanged; exports.selectIdentityVerifyErrorMessage = selectIdentityVerifyErrorMessage; exports.selectIdentityVerifyIsPending = selectIdentityVerifyIsPending; exports.selectIsAuthenticating = selectIsAuthenticating; diff --git a/dist/bundle.js b/dist/bundle.js index e50abce..d261c2f 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -418,6 +418,8 @@ __webpack_require__.r(__webpack_exports__); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectSyncApplyIsPending", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_32__["selectSyncApplyIsPending"]; }); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectHashChanged", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_32__["selectHashChanged"]; }); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectSyncApplyErrorMessage", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_32__["selectSyncApplyErrorMessage"]; }); @@ -3681,7 +3683,8 @@ function doCheckSync() { var data = { hasSyncedWallet: true, syncHash: response.hash, - syncData: response.data + syncData: response.data, + hashChanged: response.changed }; dispatch({ type: constants_action_types__WEBPACK_IMPORTED_MODULE_0__["GET_SYNC_COMPLETED"], @@ -4379,7 +4382,8 @@ var defaultState = { syncApplyErrorMessage: '', syncApplyIsPending: false, getSyncIsPending: false, - setSyncIsPending: false + setSyncIsPending: false, + hashChanged: false }; reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["GET_SYNC_STARTED"]] = function (state) { @@ -4393,7 +4397,8 @@ reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["GET_SYNC_COMPLETED syncHash: action.data.syncHash, syncData: action.data.syncData, hasSyncedWallet: action.data.hasSyncedWallet, - getSyncIsPending: false + getSyncIsPending: false, + hashChanged: action.data.hashChanged }); }; @@ -4614,6 +4619,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectSetSyncErrorMessage", function() { return selectSetSyncErrorMessage; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectGetSyncIsPending", function() { return selectGetSyncIsPending; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectSetSyncIsPending", function() { return selectSetSyncIsPending; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectHashChanged", function() { return selectHashChanged; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectSyncApplyIsPending", function() { return selectSyncApplyIsPending; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectSyncApplyErrorMessage", function() { return selectSyncApplyErrorMessage; }); /* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14); @@ -4642,6 +4648,9 @@ var selectGetSyncIsPending = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["creat var selectSetSyncIsPending = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) { return state.setSyncIsPending; }); +var selectHashChanged = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) { + return state.hashChanged; +}); var selectSyncApplyIsPending = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) { return state.syncApplyIsPending; }); diff --git a/src/index.js b/src/index.js index 2870e5b..81f1156 100644 --- a/src/index.js +++ b/src/index.js @@ -171,5 +171,6 @@ export { selectGetSyncIsPending, selectSetSyncIsPending, selectSyncApplyIsPending, + selectHashChanged, selectSyncApplyErrorMessage, } from 'redux/selectors/sync'; diff --git a/src/redux/actions/sync.js b/src/redux/actions/sync.js index 1c4d712..ac63634 100644 --- a/src/redux/actions/sync.js +++ b/src/redux/actions/sync.js @@ -143,7 +143,12 @@ export function doCheckSync() { Lbry.sync_hash().then(hash => { Lbryio.call('sync', 'get', { hash }, 'post') .then(response => { - const data = { hasSyncedWallet: true, syncHash: response.hash, syncData: response.data }; + const data = { + hasSyncedWallet: true, + syncHash: response.hash, + syncData: response.data, + hashChanged: response.changed, + }; dispatch({ type: ACTIONS.GET_SYNC_COMPLETED, data }); }) .catch(() => { diff --git a/src/redux/reducers/sync.js b/src/redux/reducers/sync.js index f57cbf0..c571489 100644 --- a/src/redux/reducers/sync.js +++ b/src/redux/reducers/sync.js @@ -10,6 +10,7 @@ const defaultState = { syncApplyIsPending: false, getSyncIsPending: false, setSyncIsPending: false, + hashChanged: false, }; reducers[ACTIONS.GET_SYNC_STARTED] = state => @@ -23,6 +24,7 @@ reducers[ACTIONS.GET_SYNC_COMPLETED] = (state, action) => syncData: action.data.syncData, hasSyncedWallet: action.data.hasSyncedWallet, getSyncIsPending: false, + hashChanged: action.data.hashChanged, }); reducers[ACTIONS.SET_SYNC_STARTED] = state => diff --git a/src/redux/selectors/sync.js b/src/redux/selectors/sync.js index 7eba1a3..01f7a1b 100644 --- a/src/redux/selectors/sync.js +++ b/src/redux/selectors/sync.js @@ -17,6 +17,8 @@ export const selectGetSyncIsPending = createSelector(selectState, state => state export const selectSetSyncIsPending = createSelector(selectState, state => state.setSyncIsPending); +export const selectHashChanged = createSelector(selectState, state => state.hashChanged); + export const selectSyncApplyIsPending = createSelector( selectState, state => state.syncApplyIsPending -- 2.45.2