Skip to content

Commit 3fd8fe0

Browse files
author
Marcin Mazurek
committed
[DDW-1025] Update the settings screen to match latest requirements and add missing translations
1 parent ea5c94a commit 3fd8fe0

File tree

13 files changed

+109
-206
lines changed

13 files changed

+109
-206
lines changed

source/renderer/app/components/profile/analytics/AnalyticsConsentForm.messages.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,6 @@ export const messages = defineMessages({
1212
'!!!Analytic data is used for product development purposes only.',
1313
description: 'Analytics data collection description',
1414
},
15-
tocDetailsTitle: {
16-
id: 'analytics.form.tocDetailsTitle',
17-
defaultMessage:
18-
'!!!We collect data on (1) User click behavior and (2) Device information.',
19-
description: 'TOC details title',
20-
},
21-
tocDetails: {
22-
id: 'analytics.form.tocDetails',
23-
defaultMessage:
24-
'!!!1.6 Privacy. No one will use your data. Ed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto sunt explicabo. ',
25-
description: 'TOC details',
26-
},
2715
dataCollectionSwitchButton: {
2816
id: 'analytics.form.dataCollectionSwitchText',
2917
defaultMessage: '!!!Allow anonymous data collection',

source/renderer/app/components/profile/analytics/AnalyticsConsentForm.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, { FC, useCallback } from 'react';
22
import { FormattedMessage, injectIntl } from 'react-intl';
33
import { Button } from 'react-polymorph/lib/components/Button';
4-
54
import { Link } from 'react-polymorph/lib/components/Link';
65
import { ButtonSpinnerSkin } from 'react-polymorph/lib/skins/simple/ButtonSpinnerSkin';
76
import classnames from 'classnames';
@@ -14,12 +13,14 @@ interface AnalyticsConsentFormProps {
1413
intl: Intl;
1514
loading: boolean;
1615
onSubmit: (analyticsAccepted: boolean) => void;
16+
onExternalLinkClick: (url: string) => void;
1717
}
1818

1919
const AnalyticsConsentForm: FC<AnalyticsConsentFormProps> = ({
2020
intl,
2121
loading,
2222
onSubmit,
23+
onExternalLinkClick,
2324
}: AnalyticsConsentFormProps) => {
2425
const handleAllow = useCallback(() => {
2526
onSubmit(true);
@@ -31,8 +32,11 @@ const AnalyticsConsentForm: FC<AnalyticsConsentFormProps> = ({
3132
const privacyPolicyLink = (
3233
<Link
3334
className={styles.privacyPolicyLink}
34-
// TODO
35-
onClick={() => null}
35+
onClick={() =>
36+
onExternalLinkClick(
37+
'https://static.iohk.io/terms/iog-privacy-policy.pdf'
38+
)
39+
}
3640
label={intl.formatMessage(messages.privacyPolicyLink)}
3741
hasIconAfter={false}
3842
/>

source/renderer/app/components/profile/analytics/CollectedDataOverview.messages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const messages = defineMessages({
1313
description: 'Title for the user behaviour data collection',
1414
},
1515
userBehaviorText: {
16-
id: 'analytics.form.dataCollectionDetailsuserBehaviorText',
16+
id: 'analytics.form.dataCollectionDetailsUserBehaviorText',
1717
defaultMessage:
1818
'!!!Clicks, page visits, page scrolling, number of wallets, number of native assets, session duration, type of wallets (soft vs hardware wallets), geolocation (country of location), and page performance.',
1919
description: 'Description for the user behaviour data collection',

source/renderer/app/components/settings/categories/SupportSettings.messages.ts

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,21 @@ export const messages = defineMessages({
6666
defaultMessage: '!!!Analytics data collection',
6767
description: 'Analytics form title',
6868
},
69-
analyticsSectionDescription: {
70-
id: 'analytics.form.analyticsSectionDescription',
69+
analyticsAcceptedDescription: {
70+
id: 'analytics.form.analyticsAcceptedDescription',
7171
defaultMessage:
72-
'!!!Allow analytics data collection. Analytic data is used for product development purposes only.',
73-
description:
74-
'Analytics data collection description, above collapsible details',
72+
'!!!You have opted in to analytics data collection. You can {changeAnalyticsSettingsLink}.',
73+
description: 'Analytics data collection description when user opted in',
7574
},
76-
analyticsSectionPrivacyPolicy: {
77-
id: 'analytics.form.analyticsSectionPrivacyPolicy',
75+
analyticsDeclinedDescription: {
76+
id: 'analytics.form.analyticsDeclinedDescription',
7877
defaultMessage:
79-
'!!!Read more about our privacy practices in the {privacyPolicyLink}.',
80-
description:
81-
'Analytics data collection description, under collapsible details',
78+
'!!!You have opted out of analytics data collection. You can {changeAnalyticsSettingsLink}.',
79+
description: 'Analytics data collection description when user opted out ',
8280
},
83-
privacyPolicyLink: {
84-
id: 'analytics.form.privacyPolicyLink',
85-
defaultMessage: '!!!Daedalus Privacy Policy',
86-
description: 'Daedalus Privacy Policy link text',
81+
changeAnalyticsSettingsLink: {
82+
id: 'analytics.form.changeAnalyticsSettingsLink',
83+
defaultMessage: '!!!change this setting here',
84+
description: 'Change analytics settings link text',
8785
},
8886
});

source/renderer/app/components/settings/categories/SupportSettings.scss

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -69,31 +69,14 @@
6969
margin-bottom: 14px;
7070
}
7171

72-
.analyticsSectionDescriptionContainer {
73-
display: flex;
74-
}
75-
76-
.analyticsSectionDescription {
77-
flex: 1;
78-
}
79-
80-
.privacyPolicyDescription,
8172
.analyticsSectionDescription {
8273
color: var(--theme-main-body-messages-color);
8374
font-family: var(--font-light);
8475
font-size: 16px;
8576
line-height: 1.43;
8677
}
8778

88-
.privacyPolicyDescription {
89-
margin-top: 20px;
90-
}
91-
92-
.switchButton {
93-
margin: 0 0 0 20px !important;
94-
}
95-
96-
.privacyPolicyLink {
79+
.changeAnalyticsSettingsLink {
9780
font-family: var(--font-regular);
9881
// unfortunately, global overrides for link component set it to 14px with higher specificity
9982
font-size: 16px !important;

source/renderer/app/components/settings/categories/SupportSettings.tsx

Lines changed: 11 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -6,80 +6,28 @@ import { Link } from 'react-polymorph/lib/components/Link';
66
import { LinkSkin } from 'react-polymorph/lib/skins/simple/LinkSkin';
77
import styles from './SupportSettings.scss';
88
import globalMessages from '../../../i18n/global-messages';
9-
import { AnalyticsAcceptanceStatus } from '../../../analytics/types';
109
import { InjectedProps } from '../../../types/injectedPropsType';
1110
import { messages } from './SupportSettings.messages';
1211
import { Separator } from '../../widgets/separator/Separator';
13-
import { CollectedDataOverview } from '../../profile/analytics/CollectedDataOverview';
14-
import NormalSwitch from '../../widgets/forms/NormalSwitch';
15-
import { ROUTES } from '../../../routes-config';
1612

1713
interface SupportSettingsProps extends InjectedProps {
1814
intl: Intl;
1915
onExternalLinkClick: (...args: Array<any>) => any;
2016
onSupportRequestClick: (...args: Array<any>) => any;
17+
onChangeAnalyticsSettings: () => void;
2118
onDownloadLogs: (...args: Array<any>) => any;
2219
disableDownloadLogs: boolean;
23-
}
24-
25-
interface SupportSettingsState {
2620
analyticsAccepted: boolean;
27-
pageViewEventSent: boolean;
2821
}
2922

3023
@inject('stores', 'actions')
3124
@observer
32-
class SupportSettings extends Component<
33-
SupportSettingsProps,
34-
SupportSettingsState
35-
> {
25+
class SupportSettings extends Component<SupportSettingsProps> {
3626
static defaultProps = {
3727
actions: null,
3828
stores: null,
3929
};
4030

41-
state = {
42-
analyticsAccepted: false,
43-
pageViewEventSent: false,
44-
};
45-
46-
async componentDidMount() {
47-
const analyticsAcceptanceStatus = await this.props.stores.analytics.api.localStorage.getAnalyticsAcceptance();
48-
49-
this.setState({
50-
analyticsAccepted:
51-
analyticsAcceptanceStatus === AnalyticsAcceptanceStatus.ACCEPTED,
52-
});
53-
}
54-
55-
onAnalyticsAcceptanceChange = async (analyticsAccepted: boolean) => {
56-
await this.props.actions.profile.acceptAnalytics.trigger(
57-
analyticsAccepted
58-
? AnalyticsAcceptanceStatus.ACCEPTED
59-
: AnalyticsAcceptanceStatus.REJECTED
60-
);
61-
62-
let { pageViewEventSent } = this.state;
63-
64-
if (!pageViewEventSent && analyticsAccepted) {
65-
this.props.stores.analytics.analyticsClient.sendPageNavigationEvent(
66-
'Support Settings'
67-
);
68-
pageViewEventSent = true;
69-
}
70-
71-
this.setState({
72-
analyticsAccepted,
73-
pageViewEventSent,
74-
});
75-
};
76-
77-
handleTermsOfUseNavigation = () => {
78-
this.props.actions.router.goToRoute.trigger({
79-
route: ROUTES.SETTINGS.TERMS_OF_USE,
80-
});
81-
};
82-
8331
render() {
8432
const {
8533
onExternalLinkClick,
@@ -121,11 +69,11 @@ class SupportSettings extends Component<
12169
/>
12270
);
12371

124-
const privacyPolicyLink = (
72+
const changeAnalyticsSettingsLink = (
12573
<Link
126-
className={styles.privacyPolicyLink}
127-
onClick={this.handleTermsOfUseNavigation}
128-
label={intl.formatMessage(messages.privacyPolicyLink)}
74+
className={styles.changeAnalyticsSettingsLink}
75+
onClick={this.props.onChangeAnalyticsSettings}
76+
label={intl.formatMessage(messages.changeAnalyticsSettingsLink)}
12977
hasIconAfter={false}
13078
/>
13179
);
@@ -181,22 +129,13 @@ class SupportSettings extends Component<
181129
<h2 className={styles.analyticsSectionTitle}>
182130
{intl.formatMessage(messages.analyticsSectionTitle)}
183131
</h2>
184-
<div className={styles.analyticsSectionDescriptionContainer}>
185-
<p className={styles.analyticsSectionDescription}>
186-
{intl.formatMessage(messages.analyticsSectionDescription)}
187-
</p>
188-
<NormalSwitch
189-
onChange={this.onAnalyticsAcceptanceChange}
190-
checked={this.state.analyticsAccepted}
191-
className={styles.switchButton}
192-
/>
193-
</div>
194-
<CollectedDataOverview />
195-
<p className={styles.privacyPolicyDescription}>
132+
<p className={styles.analyticsSectionDescription}>
196133
<FormattedMessage
197-
{...messages.analyticsSectionPrivacyPolicy}
134+
{...(this.props.analyticsAccepted
135+
? messages.analyticsAcceptedDescription
136+
: messages.analyticsDeclinedDescription)}
198137
values={{
199-
privacyPolicyLink,
138+
changeAnalyticsSettingsLink,
200139
}}
201140
/>
202141
</p>

source/renderer/app/containers/profile/AnalyticsConsentPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { useStores } from '../../hooks/useStores';
88

99
const AnalyticsConsentPage: FC = () => {
1010
const actions = useActions();
11-
const { networkStatus, profile } = useStores();
11+
const { networkStatus, profile, app } = useStores();
1212

1313
const handleSubmit = useCallback(async (analyticsAccepted: boolean) => {
1414
await actions.profile.acceptAnalytics.trigger(
@@ -27,6 +27,7 @@ const AnalyticsConsentPage: FC = () => {
2727
<AnalyticsConsentForm
2828
loading={setAnalyticsAcceptanceRequest.isExecuting}
2929
onSubmit={handleSubmit}
30+
onExternalLinkClick={app.openExternalLink}
3031
/>
3132
</TopBarLayout>
3233
);

source/renderer/app/containers/settings/categories/SupportSettingsPage.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { defineMessages, intlShape } from 'react-intl';
44
import SupportSettings from '../../../components/settings/categories/SupportSettings';
55
import { generateSupportRequestLink } from '../../../../../common/utils/reporting';
66
import type { InjectedProps } from '../../../types/injectedPropsType';
7+
import { AnalyticsAcceptanceStatus } from '../../../analytics';
78

89
const messages = defineMessages({
910
supportRequestLinkUrl: {
@@ -20,10 +21,18 @@ class SupportSettingsPage extends Component<InjectedProps> {
2021
static contextTypes = {
2122
intl: intlShape.isRequired,
2223
};
24+
2325
static defaultProps = {
2426
actions: null,
2527
stores: null,
2628
};
29+
30+
handleChangeAnalyticsSettings = () => {
31+
this.props.actions.profile.acceptAnalytics.trigger(
32+
AnalyticsAcceptanceStatus.PENDING
33+
);
34+
};
35+
2736
handleSupportRequestClick = async (
2837
event: React.SyntheticEvent<HTMLButtonElement>
2938
) => {
@@ -42,6 +51,7 @@ class SupportSettingsPage extends Component<InjectedProps> {
4251
);
4352
this.props.stores.app.openExternalLink(supportUrl);
4453
};
54+
4555
handleDownloadLogs = () => {
4656
const { app } = this.props.actions;
4757
app.downloadLogs.trigger();
@@ -55,9 +65,11 @@ class SupportSettingsPage extends Component<InjectedProps> {
5565
onExternalLinkClick={stores.app.openExternalLink}
5666
onSupportRequestClick={this.handleSupportRequestClick}
5767
onDownloadLogs={this.handleDownloadLogs}
68+
onChangeAnalyticsSettings={this.handleChangeAnalyticsSettings}
5869
disableDownloadLogs={
5970
this.props.stores.app.isDownloadNotificationVisible
6071
}
72+
analyticsAccepted={this.props.stores.profile.areAnalyticsAccepted}
6173
/>
6274
);
6375
}

0 commit comments

Comments
 (0)