Merge pull request #49 from lbryio/syncHasChanged

adds hashChanged from sync get response
This commit is contained in:
jessopb 2019-08-19 10:46:15 -04:00 committed by GitHub
commit ea72da47df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 7 deletions

11
dist/bundle.es.js vendored
View file

@ -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;

15
dist/bundle.js vendored
View file

@ -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;
});

View file

@ -171,5 +171,6 @@ export {
selectGetSyncIsPending,
selectSetSyncIsPending,
selectSyncApplyIsPending,
selectHashChanged,
selectSyncApplyErrorMessage,
} from 'redux/selectors/sync';

View file

@ -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(() => {

View file

@ -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 =>

View file

@ -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