2019-12-11 21:09:27 +01:00
|
|
|
import { connect } from 'react-redux';
|
2019-12-19 14:53:15 +01:00
|
|
|
import { DAEMON_SETTINGS, selectIsWalletReconnecting } from 'lbry-redux';
|
|
|
|
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';
|
|
|
|
|
|
|
|
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),
|
2019-12-11 21:09:27 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
const perform = dispatch => ({
|
2019-12-19 14:53:15 +01:00
|
|
|
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()),
|
2019-12-19 14:53:15 +01:00
|
|
|
saveServerConfig: servers => dispatch(doSaveCustomWalletServers(servers)),
|
2019-12-11 21:09:27 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(
|
|
|
|
select,
|
|
|
|
perform
|
|
|
|
)(SettingWalletServer);
|