Merge pull request #88 from lbryio/changed-callback
include if sync data has changed in response callback
This commit is contained in:
commit
9259233c6f
3 changed files with 15 additions and 12 deletions
9
dist/bundle.es.js
vendored
9
dist/bundle.es.js
vendored
|
@ -2636,13 +2636,13 @@ function doSetSync(oldHash, newHash, data) {
|
||||||
function doGetSync(passedPassword, callback) {
|
function doGetSync(passedPassword, callback) {
|
||||||
const password = passedPassword === null || passedPassword === undefined ? '' : passedPassword;
|
const password = passedPassword === null || passedPassword === undefined ? '' : passedPassword;
|
||||||
|
|
||||||
function handleCallback(error) {
|
function handleCallback(error, hasNewData) {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
if (typeof callback !== 'function') {
|
if (typeof callback !== 'function') {
|
||||||
throw new Error('Second argument passed to "doGetSync" must be a function');
|
throw new Error('Second argument passed to "doGetSync" must be a function');
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(error);
|
callback(error, hasNewData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2673,6 +2673,7 @@ function doGetSync(passedPassword, callback) {
|
||||||
const syncHash = response.hash;
|
const syncHash = response.hash;
|
||||||
data.syncHash = syncHash;
|
data.syncHash = syncHash;
|
||||||
data.syncData = response.data;
|
data.syncData = response.data;
|
||||||
|
data.changed = response.changed;
|
||||||
data.hasSyncedWallet = true;
|
data.hasSyncedWallet = true;
|
||||||
|
|
||||||
if (response.changed) {
|
if (response.changed) {
|
||||||
|
@ -2688,7 +2689,7 @@ function doGetSync(passedPassword, callback) {
|
||||||
type: GET_SYNC_COMPLETED,
|
type: GET_SYNC_COMPLETED,
|
||||||
data
|
data
|
||||||
});
|
});
|
||||||
handleCallback();
|
handleCallback(null, data.changed);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2706,7 +2707,7 @@ function doGetSync(passedPassword, callback) {
|
||||||
type: GET_SYNC_COMPLETED,
|
type: GET_SYNC_COMPLETED,
|
||||||
data
|
data
|
||||||
});
|
});
|
||||||
handleCallback();
|
handleCallback(null, data.changed);
|
||||||
}).catch(syncAttemptError => {
|
}).catch(syncAttemptError => {
|
||||||
if (data.unlockFailed) {
|
if (data.unlockFailed) {
|
||||||
dispatch({
|
dispatch({
|
||||||
|
|
9
dist/bundle.js
vendored
9
dist/bundle.js
vendored
|
@ -6412,13 +6412,13 @@ function doSetSync(oldHash, newHash, data) {
|
||||||
function doGetSync(passedPassword, callback) {
|
function doGetSync(passedPassword, callback) {
|
||||||
var password = passedPassword === null || passedPassword === undefined ? '' : passedPassword;
|
var password = passedPassword === null || passedPassword === undefined ? '' : passedPassword;
|
||||||
|
|
||||||
function handleCallback(error) {
|
function handleCallback(error, hasNewData) {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
if (typeof callback !== 'function') {
|
if (typeof callback !== 'function') {
|
||||||
throw new Error('Second argument passed to "doGetSync" must be a function');
|
throw new Error('Second argument passed to "doGetSync" must be a function');
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(error);
|
callback(error, hasNewData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6451,6 +6451,7 @@ function doGetSync(passedPassword, callback) {
|
||||||
var syncHash = response.hash;
|
var syncHash = response.hash;
|
||||||
data.syncHash = syncHash;
|
data.syncHash = syncHash;
|
||||||
data.syncData = response.data;
|
data.syncData = response.data;
|
||||||
|
data.changed = response.changed;
|
||||||
data.hasSyncedWallet = true;
|
data.hasSyncedWallet = true;
|
||||||
|
|
||||||
if (response.changed) {
|
if (response.changed) {
|
||||||
|
@ -6466,7 +6467,7 @@ function doGetSync(passedPassword, callback) {
|
||||||
type: constants_action_types__WEBPACK_IMPORTED_MODULE_0__["GET_SYNC_COMPLETED"],
|
type: constants_action_types__WEBPACK_IMPORTED_MODULE_0__["GET_SYNC_COMPLETED"],
|
||||||
data: data
|
data: data
|
||||||
});
|
});
|
||||||
handleCallback();
|
handleCallback(null, data.changed);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6482,7 +6483,7 @@ function doGetSync(passedPassword, callback) {
|
||||||
type: constants_action_types__WEBPACK_IMPORTED_MODULE_0__["GET_SYNC_COMPLETED"],
|
type: constants_action_types__WEBPACK_IMPORTED_MODULE_0__["GET_SYNC_COMPLETED"],
|
||||||
data: data
|
data: data
|
||||||
});
|
});
|
||||||
handleCallback();
|
handleCallback(null, data.changed);
|
||||||
})["catch"](function (syncAttemptError) {
|
})["catch"](function (syncAttemptError) {
|
||||||
if (data.unlockFailed) {
|
if (data.unlockFailed) {
|
||||||
dispatch({
|
dispatch({
|
||||||
|
|
|
@ -80,13 +80,13 @@ export function doSetSync(oldHash, newHash, data) {
|
||||||
export function doGetSync(passedPassword, callback) {
|
export function doGetSync(passedPassword, callback) {
|
||||||
const password = passedPassword === null || passedPassword === undefined ? '' : passedPassword;
|
const password = passedPassword === null || passedPassword === undefined ? '' : passedPassword;
|
||||||
|
|
||||||
function handleCallback(error) {
|
function handleCallback(error, hasNewData) {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
if (typeof callback !== 'function') {
|
if (typeof callback !== 'function') {
|
||||||
throw new Error('Second argument passed to "doGetSync" must be a function');
|
throw new Error('Second argument passed to "doGetSync" must be a function');
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(error);
|
callback(error, hasNewData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,6 +118,7 @@ export function doGetSync(passedPassword, callback) {
|
||||||
const syncHash = response.hash;
|
const syncHash = response.hash;
|
||||||
data.syncHash = syncHash;
|
data.syncHash = syncHash;
|
||||||
data.syncData = response.data;
|
data.syncData = response.data;
|
||||||
|
data.changed = response.changed;
|
||||||
data.hasSyncedWallet = true;
|
data.hasSyncedWallet = true;
|
||||||
|
|
||||||
if (response.changed) {
|
if (response.changed) {
|
||||||
|
@ -127,7 +128,7 @@ export function doGetSync(passedPassword, callback) {
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (!response) {
|
if (!response) {
|
||||||
dispatch({ type: ACTIONS.GET_SYNC_COMPLETED, data });
|
dispatch({ type: ACTIONS.GET_SYNC_COMPLETED, data });
|
||||||
handleCallback();
|
handleCallback(null, data.changed);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +140,7 @@ export function doGetSync(passedPassword, callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch({ type: ACTIONS.GET_SYNC_COMPLETED, data });
|
dispatch({ type: ACTIONS.GET_SYNC_COMPLETED, data });
|
||||||
handleCallback();
|
handleCallback(null, data.changed);
|
||||||
})
|
})
|
||||||
.catch(syncAttemptError => {
|
.catch(syncAttemptError => {
|
||||||
if (data.unlockFailed) {
|
if (data.unlockFailed) {
|
||||||
|
|
Loading…
Reference in a new issue