From 495ba1e74b7ecebcfdbc9ec583080fa61d72c74f Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Tue, 25 Feb 2020 15:54:56 -0500 Subject: [PATCH] test --- dist/bundle.es.js | 31 +++++++++++++++++++++++++++---- src/redux/actions/sync.js | 31 +++++++++++++++++++++++++++---- 2 files changed, 54 insertions(+), 8 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 63c7390..a4ecedc 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -1614,7 +1614,14 @@ var _extends$2 = Object.assign || function (target) { for (var i = 1; i < argume function extractUserState(rawObj) { if (rawObj && rawObj.version === '0.1' && rawObj.value) { - const { subscriptions, tags, blocked, settings, app_welcome_version, sharing_3P } = rawObj.value; + const { + subscriptions, + tags, + blocked, + settings, + app_welcome_version, + sharing_3P + } = rawObj.value; return _extends$2({}, subscriptions ? { subscriptions } : {}, tags ? { tags } : {}, blocked ? { blocked } : {}, settings ? { settings } : {}, app_welcome_version ? { app_welcome_version } : {}, sharing_3P ? { sharing_3P } : {}); } @@ -1624,10 +1631,24 @@ function extractUserState(rawObj) { function doPopulateSharedUserState(sharedSettings) { return dispatch => { - const { subscriptions, tags, blocked, settings, app_welcome_version, sharing_3P } = extractUserState(sharedSettings); + const { + subscriptions, + tags, + blocked, + settings, + app_welcome_version, + sharing_3P + } = extractUserState(sharedSettings); dispatch({ type: USER_STATE_POPULATE, - data: { subscriptions, tags, blocked, settings, welcomeVersion: app_welcome_version, allowAnalytics: sharing_3P } + data: { + subscriptions, + tags, + blocked, + settings, + welcomeVersion: app_welcome_version, + allowAnalytics: sharing_3P + } }); }; } @@ -1660,12 +1681,14 @@ function doPreferenceGet(key, success, fail) { lbryProxy.preference_get(options).then(result => { if (result) { + console.log('result', result); const preference = result[key]; return success(preference); } return success(null); }).catch(err => { + console.log('error', err); if (fail) { fail(err); } @@ -1687,7 +1710,7 @@ const buildSharedStateMiddleware = (actions, sharedStateFilters, sharedStateCb) } const actionResult = next(action); - // Call `getState` after calling `next` tqo ensure the state has updated in response to the action + // Call `getState` after calling `next` to ensure the state has updated in response to the action const nextState = getState(); const shared = {}; diff --git a/src/redux/actions/sync.js b/src/redux/actions/sync.js index 28b8d7a..7f21eed 100644 --- a/src/redux/actions/sync.js +++ b/src/redux/actions/sync.js @@ -16,7 +16,14 @@ type SharedData = { function extractUserState(rawObj: SharedData) { if (rawObj && rawObj.version === '0.1' && rawObj.value) { - const { subscriptions, tags, blocked, settings, app_welcome_version, sharing_3P } = rawObj.value; + const { + subscriptions, + tags, + blocked, + settings, + app_welcome_version, + sharing_3P, + } = rawObj.value; return { ...(subscriptions ? { subscriptions } : {}), @@ -24,7 +31,7 @@ function extractUserState(rawObj: SharedData) { ...(blocked ? { blocked } : {}), ...(settings ? { settings } : {}), ...(app_welcome_version ? { app_welcome_version } : {}), - ...(sharing_3P ? { sharing_3P} : {}), + ...(sharing_3P ? { sharing_3P } : {}), }; } @@ -33,10 +40,24 @@ function extractUserState(rawObj: SharedData) { export function doPopulateSharedUserState(sharedSettings: any) { return (dispatch: Dispatch) => { - const { subscriptions, tags, blocked, settings, app_welcome_version, sharing_3P } = extractUserState(sharedSettings); + const { + subscriptions, + tags, + blocked, + settings, + app_welcome_version, + sharing_3P, + } = extractUserState(sharedSettings); dispatch({ type: ACTIONS.USER_STATE_POPULATE, - data: { subscriptions, tags, blocked, settings, welcomeVersion: app_welcome_version, allowAnalytics: sharing_3P }, + data: { + subscriptions, + tags, + blocked, + settings, + welcomeVersion: app_welcome_version, + allowAnalytics: sharing_3P, + }, }); }; } @@ -78,6 +99,7 @@ export function doPreferenceGet(key: string, success: Function, fail?: Function) Lbry.preference_get(options) .then(result => { if (result) { + console.log('result', result); const preference = result[key]; return success(preference); } @@ -85,6 +107,7 @@ export function doPreferenceGet(key: string, success: Function, fail?: Function) return success(null); }) .catch(err => { + console.log('error', err); if (fail) { fail(err); }