lbry-desktop/ui/util/sync-settings.js
jessop d9bf72a351 all settings constants come from redux
sync settings

backout nav cases and anon preference key

more robust backout header

put notificationSettings under backout bar

review changes
2020-07-27 11:53:14 -04:00

26 lines
700 B
JavaScript

import { DAEMON_SETTINGS } from 'lbry-redux';
import isEqual from 'util/deep-equal';
export function stringifyServerParam(configList) {
return configList.reduce((acc, cur) => {
acc.push(`${cur[0]}:${cur[1]}`);
return acc;
}, []);
}
export const getSubsetFromKeysArray = (obj, keys) =>
Object.keys(obj)
.filter(i => keys.includes(i))
.reduce((acc, key) => {
acc[key] = obj[key];
return acc;
}, {});
export const shouldSetSetting = (key, val, current) => {
switch (key) {
case DAEMON_SETTINGS.LBRYUM_SERVERS:
return val !== null && Array.isArray(val) && val.length && !isEqual(val, current);
default:
return !isEqual(val, current);
}
};