Redux settings #278
2 changed files with 8 additions and 10 deletions
10
dist/bundle.es.js
vendored
10
dist/bundle.es.js
vendored
|
@ -1614,9 +1614,9 @@ var _extends$2 = Object.assign || function (target) { for (var i = 1; i < argume
|
||||||
|
|
||||||
function extractUserState(rawObj) {
|
function extractUserState(rawObj) {
|
||||||
if (rawObj && rawObj.version === '0.1' && rawObj.value) {
|
if (rawObj && rawObj.version === '0.1' && rawObj.value) {
|
||||||
const { subscriptions, tags, blocked, settings, app_welcome_version, tv_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 } : {}, tv_welcome_version ? { tv_welcome_version } : {}, sharing_3P ? { sharing_3P } : {});
|
return _extends$2({}, subscriptions ? { subscriptions } : {}, tags ? { tags } : {}, blocked ? { blocked } : {}, settings ? { settings } : {}, app_welcome_version ? { app_welcome_version } : {}, sharing_3P ? { sharing_3P } : {});
|
||||||
}
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
@ -1624,10 +1624,10 @@ function extractUserState(rawObj) {
|
||||||
|
|
||||||
function doPopulateSharedUserState(sharedSettings) {
|
function doPopulateSharedUserState(sharedSettings) {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
const { subscriptions, tags, blocked, settings, app_welcome_version, tv_welcome_version, sharing_3P } = extractUserState(sharedSettings);
|
const { subscriptions, tags, blocked, settings, app_welcome_version, sharing_3P } = extractUserState(sharedSettings);
|
||||||
dispatch({
|
dispatch({
|
||||||
type: USER_STATE_POPULATE,
|
type: USER_STATE_POPULATE,
|
||||||
data: { subscriptions, tags, blocked, settings, welcomeVersion: app_welcome_version, tvWelcomeVersion: tv_welcome_version, allowAnalytics: sharing_3P }
|
data: { subscriptions, tags, blocked, settings, welcomeVersion: app_welcome_version, allowAnalytics: sharing_3P }
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1687,7 +1687,7 @@ const buildSharedStateMiddleware = (actions, sharedStateFilters, sharedStateCb)
|
||||||
}
|
}
|
||||||
|
|
||||||
const actionResult = next(action);
|
const actionResult = next(action);
|
||||||
// Call `getState` after calling `next` to ensure the state has updated in response to the action
|
// Call `getState` after calling `next` tqo ensure the state has updated in response to the action
|
||||||
const nextState = getState();
|
const nextState = getState();
|
||||||
const shared = {};
|
const shared = {};
|
||||||
|
|
||||||
|
|
|
@ -10,14 +10,13 @@ type SharedData = {
|
||||||
blocked?: Array<string>,
|
blocked?: Array<string>,
|
||||||
settings?: any,
|
settings?: any,
|
||||||
app_welcome_version?: number,
|
app_welcome_version?: number,
|
||||||
tv_welcome_version?: number,
|
|
||||||
sharing_3P?: boolean,
|
sharing_3P?: boolean,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
function extractUserState(rawObj: SharedData) {
|
function extractUserState(rawObj: SharedData) {
|
||||||
if (rawObj && rawObj.version === '0.1' && rawObj.value) {
|
if (rawObj && rawObj.version === '0.1' && rawObj.value) {
|
||||||
const { subscriptions, tags, blocked, settings, app_welcome_version, tv_welcome_version, sharing_3P } = rawObj.value;
|
const { subscriptions, tags, blocked, settings, app_welcome_version, sharing_3P } = rawObj.value;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...(subscriptions ? { subscriptions } : {}),
|
...(subscriptions ? { subscriptions } : {}),
|
||||||
|
@ -25,7 +24,6 @@ function extractUserState(rawObj: SharedData) {
|
||||||
...(blocked ? { blocked } : {}),
|
...(blocked ? { blocked } : {}),
|
||||||
...(settings ? { settings } : {}),
|
...(settings ? { settings } : {}),
|
||||||
...(app_welcome_version ? { app_welcome_version } : {}),
|
...(app_welcome_version ? { app_welcome_version } : {}),
|
||||||
...(tv_welcome_version ? { tv_welcome_version } : {}),
|
|
||||||
...(sharing_3P ? { sharing_3P} : {}),
|
...(sharing_3P ? { sharing_3P} : {}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -35,10 +33,10 @@ function extractUserState(rawObj: SharedData) {
|
||||||
|
|
||||||
export function doPopulateSharedUserState(sharedSettings: any) {
|
export function doPopulateSharedUserState(sharedSettings: any) {
|
||||||
return (dispatch: Dispatch) => {
|
return (dispatch: Dispatch) => {
|
||||||
const { subscriptions, tags, blocked, settings, app_welcome_version, tv_welcome_version, sharing_3P } = extractUserState(sharedSettings);
|
const { subscriptions, tags, blocked, settings, app_welcome_version, sharing_3P } = extractUserState(sharedSettings);
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.USER_STATE_POPULATE,
|
type: ACTIONS.USER_STATE_POPULATE,
|
||||||
data: { subscriptions, tags, blocked, settings, welcomeVersion: app_welcome_version, tvWelcomeVersion: tv_welcome_version, allowAnalytics: sharing_3P },
|
data: { subscriptions, tags, blocked, settings, welcomeVersion: app_welcome_version, allowAnalytics: sharing_3P },
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue