2019-12-11 21:09:27 +01:00
|
|
|
import { connect } from 'react-redux';
|
2022-05-31 20:03:29 +02:00
|
|
|
import {
|
|
|
|
selectIsWalletReconnecting,
|
|
|
|
selectWalletRollbackToDefault,
|
|
|
|
selectWalletConnectingToDefault,
|
|
|
|
} from 'redux/selectors/wallet';
|
2021-10-08 05:47:39 +02:00
|
|
|
import * as DAEMON_SETTINGS from 'constants/daemon_settings';
|
2019-12-19 14:53:15 +01:00
|
|
|
import {
|
|
|
|
doSetDaemonSetting,
|
|
|
|
doClearDaemonSetting,
|
|
|
|
doGetDaemonStatus,
|
|
|
|
doSaveCustomWalletServers,
|
|
|
|
} from 'redux/actions/settings';
|
|
|
|
import { selectSavedWalletServers, selectDaemonStatus, selectHasWalletServerPrefs } from 'redux/selectors/settings';
|
2019-12-11 21:09:27 +01:00
|
|
|
import SettingWalletServer from './view';
|
|
|
|
|
2021-10-08 05:47:39 +02:00
|
|
|
const select = (state) => ({
|
2019-12-12 21:18:13 +01:00
|
|
|
daemonStatus: selectDaemonStatus(state),
|
|
|
|
customWalletServers: selectSavedWalletServers(state),
|
|
|
|
hasWalletServerPrefs: selectHasWalletServerPrefs(state),
|
2019-12-19 14:53:15 +01:00
|
|
|
walletReconnecting: selectIsWalletReconnecting(state),
|
2022-05-31 20:03:29 +02:00
|
|
|
walletRollbackToDefault: selectWalletRollbackToDefault(state),
|
|
|
|
walletReconnectingToDefault: selectWalletConnectingToDefault(state),
|
2019-12-11 21:09:27 +01:00
|
|
|
});
|
|
|
|
|
2021-10-08 05:47:39 +02:00
|
|
|
const perform = (dispatch) => ({
|
|
|
|
setCustomWalletServers: (value) => dispatch(doSetDaemonSetting(DAEMON_SETTINGS.LBRYUM_SERVERS, value)),
|
2019-12-11 21:09:27 +01:00
|
|
|
clearWalletServers: () => dispatch(doClearDaemonSetting(DAEMON_SETTINGS.LBRYUM_SERVERS)),
|
|
|
|
getDaemonStatus: () => dispatch(doGetDaemonStatus()),
|
2021-10-08 05:47:39 +02:00
|
|
|
saveServerConfig: (servers) => dispatch(doSaveCustomWalletServers(servers)),
|
2019-12-11 21:09:27 +01:00
|
|
|
});
|
|
|
|
|
2021-10-08 05:47:39 +02:00
|
|
|
export default connect(select, perform)(SettingWalletServer);
|