lbry-desktop/ui/component/settingSystem/index.js

45 lines
1.6 KiB
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
import { doWalletStatus, selectWalletIsEncrypted } from 'lbry-redux';
import {
doClearCache,
doNotifyDecryptWallet,
doNotifyEncryptWallet,
doNotifyForgetPassword,
doToggle3PAnalytics,
} from 'redux/actions/app';
2021-08-07 15:35:11 +02:00
import { doSetDaemonSetting, doClearDaemonSetting, doFindFFmpeg } from 'redux/actions/settings';
import { selectAllowAnalytics } from 'redux/selectors/app';
import {
selectDaemonSettings,
selectFfmpegStatus,
selectFindingFFmpeg,
selectLanguage,
} from 'redux/selectors/settings';
import { selectUserVerifiedEmail } from 'redux/selectors/user';
import SettingSystem from './view';
2021-08-06 10:25:37 +02:00
const select = (state) => ({
daemonSettings: selectDaemonSettings(state),
2021-08-07 15:35:11 +02:00
ffmpegStatus: selectFfmpegStatus(state),
findingFFmpeg: selectFindingFFmpeg(state),
walletEncrypted: selectWalletIsEncrypted(state),
isAuthenticated: selectUserVerifiedEmail(state),
allowAnalytics: selectAllowAnalytics(state),
language: selectLanguage(state),
2021-08-06 10:25:37 +02:00
});
const perform = (dispatch) => ({
2021-08-06 10:25:37 +02:00
setDaemonSetting: (key, value) => dispatch(doSetDaemonSetting(key, value)),
2021-08-07 15:35:11 +02:00
clearDaemonSetting: (key) => dispatch(doClearDaemonSetting(key)),
clearCache: () => dispatch(doClearCache()),
2021-08-07 15:35:11 +02:00
findFFmpeg: () => dispatch(doFindFFmpeg()),
encryptWallet: () => dispatch(doNotifyEncryptWallet()),
decryptWallet: () => dispatch(doNotifyDecryptWallet()),
updateWalletStatus: () => dispatch(doWalletStatus()),
confirmForgetPassword: (modalProps) => dispatch(doNotifyForgetPassword(modalProps)),
toggle3PAnalytics: (allow) => dispatch(doToggle3PAnalytics(allow)),
});
export default connect(select, perform)(SettingSystem);