quick fix for sync #4718

Merged
jessopb merged 1 commit from sync-quick-fix into master 2020-08-28 17:25:48 +02:00
2 changed files with 16 additions and 16 deletions

View file

@ -605,18 +605,20 @@ export function doGetAndPopulatePreferences() {
// @if TARGET='app'
const { settings } = savedPreferences.value;
Object.entries(settings).forEach(([key, val]) => {
if (SDK_SYNC_KEYS.includes(key)) {
if (shouldSetSetting(key, val, daemonSettings[key])) {
if (key === DAEMON_SETTINGS.LBRYUM_SERVERS) {
const servers = stringifyServerParam(val);
dispatch(doSetDaemonSetting(key, servers, true));
} else {
dispatch(doSetDaemonSetting(key, val, true));
if (settings) {
Object.entries(settings).forEach(([key, val]) => {
if (SDK_SYNC_KEYS.includes(key)) {
if (shouldSetSetting(key, val, daemonSettings[key])) {
if (key === DAEMON_SETTINGS.LBRYUM_SERVERS) {
const servers = stringifyServerParam(val);
dispatch(doSetDaemonSetting(key, servers, true));
} else {
dispatch(doSetDaemonSetting(key, val, true));
}
}
}
}
});
});
}
// @endif
}
}

View file

@ -167,12 +167,10 @@ reducers[LBRY_REDUX_ACTIONS.USER_STATE_POPULATE] = (state, action) => {
const { clientSettings: currentClientSettings } = state;
const { settings: sharedPreferences } = action.data;
if (currentClientSettings[SETTINGS.ENABLE_SYNC]) {
const selectedSettings = getSubsetFromKeysArray(sharedPreferences, clientSyncKeys);
const mergedClientSettings = { ...currentClientSettings, ...selectedSettings };
return Object.assign({}, state, { sharedPreferences, clientSettings: mergedClientSettings });
}
return Object.assign({}, state, { sharedPreferences, clientSettings: currentClientSettings });
const selectedSettings = sharedPreferences ? getSubsetFromKeysArray(sharedPreferences, clientSyncKeys) : {};
const mergedClientSettings = { ...currentClientSettings, ...selectedSettings };
const newSharedPreferences = sharedPreferences || {};
return Object.assign({}, state, { sharedPreferences: newSharedPreferences, clientSettings: mergedClientSettings });
};
reducers[LBRY_REDUX_ACTIONS.SAVE_CUSTOM_WALLET_SERVERS] = (state, action) => {