comment out broken preference sync code

This commit is contained in:
Sean Yesmunt 2020-02-25 21:04:43 -05:00
parent ee05b5498a
commit b06dbfae60

View file

@ -19,10 +19,14 @@ import {
doPreferenceGet,
doToast,
doClearSupport,
SHARED_PREFERENCES,
// SHARED_PREFERENCES,
} from 'lbry-redux';
import Native from 'native';
import { doFetchDaemonSettings, doSetAutoLaunch, doSetDaemonSetting } from 'redux/actions/settings';
import {
doFetchDaemonSettings,
doSetAutoLaunch,
// doSetDaemonSetting
} from 'redux/actions/settings';
import {
selectIsUpgradeSkipped,
selectUpdateUrl,
@ -35,7 +39,7 @@ import {
selectModal,
selectAllowAnalytics,
} from 'redux/selectors/app';
import { selectDaemonSettings } from 'redux/selectors/settings';
// import { selectDaemonSettings } from 'redux/selectors/settings';
import { doAuthenticate, doGetSync } from 'lbryinc';
import { lbrySettings as config, version as appVersion } from 'package.json';
import analytics, { SHARE_INTERNAL } from 'analytics';
@ -482,31 +486,31 @@ export function doToggle3PAnalytics(allowParam, doNotDispatch) {
export function doGetAndPopulatePreferences() {
return (dispatch, getState) => {
function successCb(savedPreferences) {
const state = getState();
const daemonSettings = selectDaemonSettings(state);
// const state = getState();
// const daemonSettings = selectDaemonSettings(state);
if (savedPreferences !== null) {
dispatch(doPopulateSharedUserState(savedPreferences));
// @if TARGET='app'
const { settings, sharing_3P: sharing3P } = savedPreferences.value;
// apply daemonSettings (todo: separate function)
Object.entries(settings).forEach(([key, val]) => {
if (val !== null && daemonSettings[key] !== val) {
if (key === SHARED_PREFERENCES.WALLET_SERVERS) {
const hasSavedServers = Array.isArray(val) && val.length > 0;
if (hasSavedServers) {
// Ignore this key if there are no actual saved servers in the list
const servers = val.map(item => `${item[0]}:${item[1]}`);
dispatch(doSetDaemonSetting(key, servers, true));
}
} else {
dispatch(doSetDaemonSetting(key, val, true));
}
}
});
if (sharing3P !== undefined) {
doToggle3PAnalytics(sharing3P, true);
}
// const { settings, sharing_3P: sharing3P } = savedPreferences.value;
// // apply daemonSettings (todo: separate function)
// Object.entries(settings).forEach(([key, val]) => {
// if (val !== null && daemonSettings[key] !== val) {
// if (key === SHARED_PREFERENCES.WALLET_SERVERS) {
// const hasSavedServers = Array.isArray(val) && val.length > 0;
// if (hasSavedServers) {
// // Ignore this key if there are no actual saved servers in the list
// const servers = val.map(item => `${item[0]}:${item[1]}`);
// dispatch(doSetDaemonSetting(key, servers, true));
// }
// } else {
// dispatch(doSetDaemonSetting(key, val, true));
// }
// }
// });
// if (sharing3P !== undefined) {
// doToggle3PAnalytics(sharing3P, true);
// }
// @endif
}
}