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