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