Merge pull request #3728 from lbryio/fix-prefToDaemonSettings
properly transforms wallet server preference
This commit is contained in:
commit
aa1a8e944f
1 changed files with 8 additions and 1 deletions
|
@ -19,6 +19,7 @@ import {
|
||||||
doPreferenceGet,
|
doPreferenceGet,
|
||||||
doToast,
|
doToast,
|
||||||
doClearSupport,
|
doClearSupport,
|
||||||
|
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';
|
||||||
|
@ -484,9 +485,15 @@ export function doGetAndPopulatePreferences() {
|
||||||
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)
|
||||||
Object.entries(settings).forEach(([key, val]) => {
|
Object.entries(settings).forEach(([key, val]) => {
|
||||||
if (val !== null && daemonSettings[key] !== val) {
|
if (val !== null && daemonSettings[key] !== val) {
|
||||||
dispatch(doSetDaemonSetting(key, val, true));
|
if (key === SHARED_PREFERENCES.WALLET_SERVERS) {
|
||||||
|
const servers = val.map(item => `${item[0]}:${item[1]}`);
|
||||||
|
dispatch(doSetDaemonSetting(key, servers, true));
|
||||||
|
} else {
|
||||||
|
dispatch(doSetDaemonSetting(key, val, true));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (sharing3P !== undefined) {
|
if (sharing3P !== undefined) {
|
||||||
|
|
Loading…
Reference in a new issue