diff --git a/ui/component/privacyAgreement/index.js b/ui/component/privacyAgreement/index.js index 7a69014e9..5a1032a09 100644 --- a/ui/component/privacyAgreement/index.js +++ b/ui/component/privacyAgreement/index.js @@ -1,9 +1,13 @@ +import { DOMAIN } from 'config'; import { connect } from 'react-redux'; import { doSetDaemonSetting } from 'redux/actions/settings'; import { doSetWelcomeVersion, doToggle3PAnalytics, doSignOut } from 'redux/actions/app'; import { DAEMON_SETTINGS } from 'lbry-redux'; import { WELCOME_VERSION } from 'config.js'; import { selectUserVerifiedEmail } from 'redux/selectors/user'; +import { doAuthenticate } from 'redux/actions/user'; +import { version as appVersion } from 'package.json'; + import PrivacyAgreement from './view'; const select = state => ({ @@ -15,6 +19,8 @@ const perform = dispatch => ({ setShareDataInternal: share => dispatch(doSetDaemonSetting(DAEMON_SETTINGS.SHARE_USAGE_DATA, share)), setShareDataThirdParty: share => dispatch(doToggle3PAnalytics(share)), signOut: () => dispatch(doSignOut()), + authenticateIfSharingData: () => + dispatch(doAuthenticate(appVersion, undefined, undefined, true, undefined, undefined, DOMAIN)), }); export default connect(select, perform)(PrivacyAgreement); diff --git a/ui/component/privacyAgreement/view.jsx b/ui/component/privacyAgreement/view.jsx index ee5bc50b6..fd945660a 100644 --- a/ui/component/privacyAgreement/view.jsx +++ b/ui/component/privacyAgreement/view.jsx @@ -20,10 +20,19 @@ type Props = { setShareDataThirdParty: boolean => void, history: { replace: string => void }, authenticated: boolean, + authenticateIfSharingData: () => void, }; function PrivacyAgreement(props: Props) { - const { setWelcomeVersion, setShareDataInternal, setShareDataThirdParty, history, authenticated, signOut } = props; + const { + setWelcomeVersion, + setShareDataInternal, + setShareDataThirdParty, + history, + authenticated, + signOut, + authenticateIfSharingData, + } = props; const [share, setShare] = useState(undefined); // preload const [agree, setAgree] = useState(false); // preload @@ -38,6 +47,11 @@ function PrivacyAgreement(props: Props) { setShareDataInternal(false); setShareDataThirdParty(false); } + + if (share === FREE || share === LIMITED) { + authenticateIfSharingData(); + } + setWelcomeVersion(WELCOME_VERSION); history.replace(`/`); }