diff --git a/package.json b/package.json index e8328939b..18a71f95b 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "@babel/register": "^7.0.0", "@exponent/electron-cookies": "^2.0.0", "@hot-loader/react-dom": "^16.8", - "@lbry/components": "^3.0.11", + "@lbry/components": "^3.0.12", "@reach/menu-button": "^0.1.18", "@reach/rect": "^0.2.1", "@reach/tabs": "^0.1.5", diff --git a/static/app-strings.json b/static/app-strings.json index 8b7819070..2bc3a4d5e 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -988,5 +988,7 @@ "Sign In to lbry.tv to Earn Rewards From Inviting Your Friends": "Sign In to lbry.tv to Earn Rewards From Inviting Your Friends", "Email %help_link% or join our %chat_link% if you encounter any trouble verifying.": "Email %help_link% or join our %chat_link% if you encounter any trouble verifying.", "You are signed into lbry.tv which automatically shares data with LBRY inc. %signout_button%": "You are signed into lbry.tv which automatically shares data with LBRY inc. %signout_button%", - "You are signed into lbry.tv which automatically shares data with LBRY inc. %signout_button%.": "You are signed into lbry.tv which automatically shares data with LBRY inc. %signout_button%." + "You are signed into lbry.tv which automatically shares data with LBRY inc. %signout_button%.": "You are signed into lbry.tv which automatically shares data with LBRY inc. %signout_button%.", + "Share usage data with LBRY inc.": "Share usage data with LBRY inc.", + "Required": "Required" } \ No newline at end of file diff --git a/ui/component/userEmailNew/index.js b/ui/component/userEmailNew/index.js index aef725484..6c0e9c33c 100644 --- a/ui/component/userEmailNew/index.js +++ b/ui/component/userEmailNew/index.js @@ -1,19 +1,23 @@ import * as SETTINGS from 'constants/settings'; import { connect } from 'react-redux'; import { selectEmailNewIsPending, selectEmailNewErrorMessage, doUserEmailNew } from 'lbryinc'; -import { doSetClientSetting } from 'redux/actions/settings'; -import { makeSelectClientSetting } from 'redux/selectors/settings'; +import { DAEMON_SETTINGS } from 'lbry-redux'; +import { doSetClientSetting, doSetDaemonSetting } from 'redux/actions/settings'; +import { makeSelectClientSetting, selectDaemonSettings } from 'redux/selectors/settings'; import UserEmailNew from './view'; const select = state => ({ isPending: selectEmailNewIsPending(state), errorMessage: selectEmailNewErrorMessage(state), syncEnabled: makeSelectClientSetting(SETTINGS.ENABLE_SYNC)(state), + daemonSettings: selectDaemonSettings(state), }); const perform = dispatch => ({ addUserEmail: email => dispatch(doUserEmailNew(email)), setSync: value => dispatch(doSetClientSetting(SETTINGS.ENABLE_SYNC, value)), + setShareDiagnosticData: shouldShareData => + dispatch(doSetDaemonSetting(DAEMON_SETTINGS.SHARE_USAGE_DATA, shouldShareData)), }); export default connect( diff --git a/ui/component/userEmailNew/view.jsx b/ui/component/userEmailNew/view.jsx index adfdac379..0a3884f47 100644 --- a/ui/component/userEmailNew/view.jsx +++ b/ui/component/userEmailNew/view.jsx @@ -4,7 +4,6 @@ import { FormField, Form } from 'component/common/form'; import Button from 'component/button'; import analytics from 'analytics'; import { EMAIL_REGEX } from 'constants/email'; -import I18nMessage from 'component/i18nMessage'; type Props = { errorMessage: ?string, @@ -13,17 +12,26 @@ type Props = { syncEnabled: boolean, setSync: boolean => void, balance: number, + daemonSettings: { share_usage_data: boolean }, + setShareDiagnosticData: boolean => void, }; function UserEmailNew(props: Props) { - const { errorMessage, isPending, addUserEmail, setSync } = props; + const { errorMessage, isPending, addUserEmail, setSync, daemonSettings, setShareDiagnosticData } = props; + const { share_usage_data: shareUsageData } = daemonSettings; const [newEmail, setEmail] = useState(''); + const [localShareUsageData, setLocalShareUsageData] = React.useState(false); const [formSyncEnabled, setFormSyncEnabled] = useState(true); const valid = newEmail.match(EMAIL_REGEX); + function handleUsageDataChange() { + setLocalShareUsageData(!shareUsageData); + } + function handleSubmit() { setSync(formSyncEnabled); addUserEmail(newEmail); + setShareDiagnosticData(true); analytics.emailProvidedEvent(); } @@ -64,27 +72,30 @@ function UserEmailNew(props: Props) { onChange={() => setFormSyncEnabled(!formSyncEnabled)} /> )} + + {!shareUsageData && ( + + {__('Share usage data with LBRY inc.')}{' '} +