From 49eb8a4df3088e1f7e5e5c68332dd8138c0df8d3 Mon Sep 17 00:00:00 2001 From: seanyesmunt Date: Thu, 19 Mar 2020 13:49:47 -0400 Subject: [PATCH] include if sync data has changed in response callback --- dist/bundle.es.js | 9 +++++---- dist/bundle.js | 9 +++++---- src/redux/actions/sync.js | 9 +++++---- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 742f4fc..1e77ae7 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -2636,13 +2636,13 @@ function doSetSync(oldHash, newHash, data) { function doGetSync(passedPassword, callback) { const password = passedPassword === null || passedPassword === undefined ? '' : passedPassword; - function handleCallback(error) { + function handleCallback(error, hasNewData) { if (callback) { if (typeof callback !== '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; data.syncHash = syncHash; data.syncData = response.data; + data.changed = response.changed; data.hasSyncedWallet = true; if (response.changed) { @@ -2688,7 +2689,7 @@ function doGetSync(passedPassword, callback) { type: GET_SYNC_COMPLETED, data }); - handleCallback(); + handleCallback(null, data.changed); return; } @@ -2706,7 +2707,7 @@ function doGetSync(passedPassword, callback) { type: GET_SYNC_COMPLETED, data }); - handleCallback(); + handleCallback(null, data.changed); }).catch(syncAttemptError => { if (data.unlockFailed) { dispatch({ diff --git a/dist/bundle.js b/dist/bundle.js index 6032e2f..87a6fe6 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -6412,13 +6412,13 @@ function doSetSync(oldHash, newHash, data) { function doGetSync(passedPassword, callback) { var password = passedPassword === null || passedPassword === undefined ? '' : passedPassword; - function handleCallback(error) { + function handleCallback(error, hasNewData) { if (callback) { if (typeof callback !== '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; data.syncHash = syncHash; data.syncData = response.data; + data.changed = response.changed; data.hasSyncedWallet = true; if (response.changed) { @@ -6466,7 +6467,7 @@ function doGetSync(passedPassword, callback) { type: constants_action_types__WEBPACK_IMPORTED_MODULE_0__["GET_SYNC_COMPLETED"], data: data }); - handleCallback(); + handleCallback(null, data.changed); return; } @@ -6482,7 +6483,7 @@ function doGetSync(passedPassword, callback) { type: constants_action_types__WEBPACK_IMPORTED_MODULE_0__["GET_SYNC_COMPLETED"], data: data }); - handleCallback(); + handleCallback(null, data.changed); })["catch"](function (syncAttemptError) { if (data.unlockFailed) { dispatch({ diff --git a/src/redux/actions/sync.js b/src/redux/actions/sync.js index f4e75c2..eaf9cec 100644 --- a/src/redux/actions/sync.js +++ b/src/redux/actions/sync.js @@ -80,13 +80,13 @@ export function doSetSync(oldHash, newHash, data) { export function doGetSync(passedPassword, callback) { const password = passedPassword === null || passedPassword === undefined ? '' : passedPassword; - function handleCallback(error) { + function handleCallback(error, hasNewData) { if (callback) { if (typeof callback !== '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; data.syncHash = syncHash; data.syncData = response.data; + data.changed = response.changed; data.hasSyncedWallet = true; if (response.changed) { @@ -127,7 +128,7 @@ export function doGetSync(passedPassword, callback) { .then(response => { if (!response) { dispatch({ type: ACTIONS.GET_SYNC_COMPLETED, data }); - handleCallback(); + handleCallback(null, data.changed); return; } @@ -139,7 +140,7 @@ export function doGetSync(passedPassword, callback) { } dispatch({ type: ACTIONS.GET_SYNC_COMPLETED, data }); - handleCallback(); + handleCallback(null, data.changed); }) .catch(syncAttemptError => { if (data.unlockFailed) {