2020-02-19 07:31:40 +01:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { doSetDaemonSetting } from 'redux/actions/settings';
|
2020-02-24 19:20:45 +01:00
|
|
|
import { doSetWelcomeVersion, doToggle3PAnalytics, doSignOut } from 'redux/actions/app';
|
2021-10-08 05:47:39 +02:00
|
|
|
import * as DAEMON_SETTINGS from 'constants/daemon_settings';
|
2020-02-19 07:31:40 +01:00
|
|
|
import { WELCOME_VERSION } from 'config.js';
|
2020-06-15 22:33:03 +02:00
|
|
|
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
2021-01-25 18:35:54 +01:00
|
|
|
import { doAuthenticate } from 'redux/actions/user';
|
|
|
|
import { version as appVersion } from 'package.json';
|
|
|
|
|
2020-02-24 19:20:45 +01:00
|
|
|
import PrivacyAgreement from './view';
|
|
|
|
|
2021-10-08 05:47:39 +02:00
|
|
|
const select = (state) => ({
|
2020-02-24 19:20:45 +01:00
|
|
|
authenticated: selectUserVerifiedEmail(state),
|
|
|
|
});
|
2020-02-19 07:31:40 +01:00
|
|
|
|
2021-10-08 05:47:39 +02:00
|
|
|
const perform = (dispatch) => ({
|
|
|
|
setWelcomeVersion: (version) => dispatch(doSetWelcomeVersion(version || WELCOME_VERSION)),
|
|
|
|
setShareDataInternal: (share) => dispatch(doSetDaemonSetting(DAEMON_SETTINGS.SHARE_USAGE_DATA, share)),
|
|
|
|
setShareDataThirdParty: (share) => dispatch(doToggle3PAnalytics(share)),
|
2020-02-24 19:20:45 +01:00
|
|
|
signOut: () => dispatch(doSignOut()),
|
2021-12-03 21:53:03 +01:00
|
|
|
authenticateIfSharingData: () => dispatch(doAuthenticate(appVersion, undefined, undefined, true)),
|
2020-02-19 07:31:40 +01:00
|
|
|
});
|
|
|
|
|
2020-06-15 22:33:03 +02:00
|
|
|
export default connect(select, perform)(PrivacyAgreement);
|