2021-10-17 16:36:14 +08:00
|
|
|
import * as SETTINGS from 'constants/settings';
|
2019-10-15 17:23:51 -04:00
|
|
|
import { connect } from 'react-redux';
|
2020-06-15 16:33:03 -04:00
|
|
|
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
2020-10-02 11:03:25 -04:00
|
|
|
import { selectGetSyncErrorMessage } from 'redux/selectors/sync';
|
2022-02-26 13:18:10 +08:00
|
|
|
import { selectClientSetting } from 'redux/selectors/settings';
|
2020-09-11 14:35:50 -04:00
|
|
|
import { doSetWalletSyncPreference } from 'redux/actions/settings';
|
|
|
|
import { doOpenModal } from 'redux/actions/app';
|
2019-10-15 17:23:51 -04:00
|
|
|
import SyncToggle from './view';
|
|
|
|
|
2021-10-17 16:36:14 +08:00
|
|
|
const select = (state) => ({
|
2021-11-23 12:29:04 +08:00
|
|
|
syncEnabled: selectClientSetting(state, SETTINGS.ENABLE_SYNC),
|
2019-10-15 17:23:51 -04:00
|
|
|
verifiedEmail: selectUserVerifiedEmail(state),
|
2019-10-16 01:01:18 -04:00
|
|
|
getSyncError: selectGetSyncErrorMessage(state),
|
2019-10-15 17:23:51 -04:00
|
|
|
});
|
|
|
|
|
2021-10-17 16:36:14 +08:00
|
|
|
const perform = (dispatch) => ({
|
|
|
|
setSyncEnabled: (value) => dispatch(doSetWalletSyncPreference(value)),
|
2020-09-11 14:35:50 -04:00
|
|
|
openModal: (id, props) => dispatch(doOpenModal(id, props)),
|
2019-10-15 17:23:51 -04:00
|
|
|
});
|
|
|
|
|
2020-06-15 16:33:03 -04:00
|
|
|
export default connect(select, perform)(SyncToggle);
|