test
This commit is contained in:
parent
6f9ee589a7
commit
495ba1e74b
2 changed files with 54 additions and 8 deletions
31
dist/bundle.es.js
vendored
31
dist/bundle.es.js
vendored
|
@ -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 = {};
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue