change alt preference key to local

This commit is contained in:
jessop 2020-09-16 09:56:24 -04:00
parent 437c54f164
commit 0d21b03d16
2 changed files with 16 additions and 10 deletions

6
dist/bundle.es.js vendored
View file

@ -1812,7 +1812,9 @@ const buildSharedStateMiddleware = (actions, sharedStateFilters, sharedStateCb)
const actionResult = next(action);
// Call `getState` after calling `next` to ensure the state has updated in response to the action
const nextState = getState();
const preferenceKey = nextState.user && nextState.user.user && nextState.user.user.has_verified_email ? 'shared' : 'anon';
const syncEnabled = nextState.settings && nextState.settings.syncEnabledInWallet;
const hasVerifiedEmail = nextState.user && nextState.user.user && nextState.user.user.has_verified_email;
const preferenceKey = syncEnabled && hasVerifiedEmail ? 'shared' : 'local';
const shared = {};
Object.keys(sharedStateFilters).forEach(key => {
@ -2782,7 +2784,7 @@ function doSendDraftTransaction(address, amount) {
type: SEND_TRANSACTION_COMPLETED
});
dispatch(doToast({
message: __(`You sent ${amount} LBRY Credits`),
message: __('You sent %amount% LBRY Credits', { amount: amount }),
linkText: __('History'),
linkTarget: '/wallet'
}));

View file

@ -9,9 +9,13 @@ export const buildSharedStateMiddleware = (
actions: Array<string>,
sharedStateFilters: {},
sharedStateCb?: any => void
) => ({ getState, dispatch }: { getState: () => { user: any }, dispatch: any => void }) => (
next: ({}) => void
) => (action: { type: string, data: any }) => {
) => ({
getState,
dispatch,
}: {
getState: () => { user: any, settings: any },
dispatch: any => void,
}) => (next: ({}) => void) => (action: { type: string, data: any }) => {
const currentState = getState();
// We don't care if sync is disabled here, we always want to backup preferences to the wallet
@ -21,11 +25,11 @@ export const buildSharedStateMiddleware = (
const actionResult = next(action);
// Call `getState` after calling `next` to ensure the state has updated in response to the action
const nextState: { user: any } = getState();
const preferenceKey =
nextState.user && nextState.user.user && nextState.user.user.has_verified_email
? 'shared'
: 'anon';
const nextState: { user: any, settings: any } = getState();
const syncEnabled = nextState.settings && nextState.settings.syncEnabledInWallet;
const hasVerifiedEmail =
nextState.user && nextState.user.user && nextState.user.user.has_verified_email;
const preferenceKey = syncEnabled && hasVerifiedEmail ? 'shared' : 'local';
const shared = {};
Object.keys(sharedStateFilters).forEach(key => {