Skip to content

Commit dfba519

Browse files
committed
Move the metrics-opt in screen to immediately after the welcome screen
1 parent 31f0ffc commit dfba519

File tree

5 files changed

+32
-14
lines changed

5 files changed

+32
-14
lines changed

ui/pages/first-time-flow/metametrics-opt-in/metametrics-opt-in.component.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import PropTypes from 'prop-types';
33
import MetaFoxLogo from '../../../components/ui/metafox-logo';
44
import PageContainerFooter from '../../../components/ui/page-container/page-container-footer';
55
import { EVENT } from '../../../../shared/constants/metametrics';
6+
import { INITIALIZE_SELECT_ACTION_ROUTE } from '../../../helpers/constants/routes';
67

78
export default class MetaMetricsOptIn extends Component {
89
static propTypes = {
910
history: PropTypes.object,
1011
setParticipateInMetaMetrics: PropTypes.func,
11-
nextRoute: PropTypes.string,
1212
firstTimeSelectionMetaMetricsName: PropTypes.string,
1313
participateInMetaMetrics: PropTypes.bool,
1414
};
@@ -21,7 +21,6 @@ export default class MetaMetricsOptIn extends Component {
2121
render() {
2222
const { trackEvent, t } = this.context;
2323
const {
24-
nextRoute,
2524
history,
2625
setParticipateInMetaMetrics,
2726
firstTimeSelectionMetaMetricsName,
@@ -105,7 +104,7 @@ export default class MetaMetricsOptIn extends Component {
105104
onCancel={async () => {
106105
await setParticipateInMetaMetrics(false);
107106

108-
history.push(nextRoute);
107+
history.push(INITIALIZE_SELECT_ACTION_ROUTE);
109108
}}
110109
cancelText={t('noThanks')}
111110
hideCancel={false}
@@ -155,7 +154,7 @@ export default class MetaMetricsOptIn extends Component {
155154
);
156155
await Promise.all(metrics);
157156
} finally {
158-
history.push(nextRoute);
157+
history.push(INITIALIZE_SELECT_ACTION_ROUTE);
159158
}
160159
}}
161160
submitText={t('affirmAgree')}

ui/pages/first-time-flow/metametrics-opt-in/metametrics-opt-in.container.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { connect } from 'react-redux';
22
import { setParticipateInMetaMetrics } from '../../../store/actions';
3-
import { getFirstTimeFlowTypeRoute } from '../../../selectors';
43
import MetaMetricsOptIn from './metametrics-opt-in.component';
54

65
const firstTimeFlowTypeNameMap = {
@@ -12,7 +11,6 @@ const mapStateToProps = (state) => {
1211
const { firstTimeFlowType, participateInMetaMetrics } = state.metamask;
1312

1413
return {
15-
nextRoute: getFirstTimeFlowTypeRoute(state),
1614
firstTimeSelectionMetaMetricsName:
1715
firstTimeFlowTypeNameMap[firstTimeFlowType],
1816
participateInMetaMetrics,

ui/pages/first-time-flow/select-action/select-action.component.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import React, { PureComponent } from 'react';
22
import PropTypes from 'prop-types';
33
import Button from '../../../components/ui/button';
44
import MetaFoxLogo from '../../../components/ui/metafox-logo';
5-
import { INITIALIZE_METAMETRICS_OPT_IN_ROUTE } from '../../../helpers/constants/routes';
5+
import {
6+
INITIALIZE_CREATE_PASSWORD_ROUTE,
7+
INITIALIZE_IMPORT_WITH_SEED_PHRASE_ROUTE,
8+
} from '../../../helpers/constants/routes';
69

710
export default class SelectAction extends PureComponent {
811
static propTypes = {
@@ -26,12 +29,12 @@ export default class SelectAction extends PureComponent {
2629

2730
handleCreate = () => {
2831
this.props.setFirstTimeFlowType('create');
29-
this.props.history.push(INITIALIZE_METAMETRICS_OPT_IN_ROUTE);
32+
this.props.history.push(INITIALIZE_CREATE_PASSWORD_ROUTE);
3033
};
3134

3235
handleImport = () => {
3336
this.props.setFirstTimeFlowType('import');
34-
this.props.history.push(INITIALIZE_METAMETRICS_OPT_IN_ROUTE);
37+
this.props.history.push(INITIALIZE_IMPORT_WITH_SEED_PHRASE_ROUTE);
3538
};
3639

3740
render() {

ui/pages/first-time-flow/welcome/welcome.component.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Button from '../../../components/ui/button';
66
import {
77
INITIALIZE_CREATE_PASSWORD_ROUTE,
88
INITIALIZE_SELECT_ACTION_ROUTE,
9+
INITIALIZE_METAMETRICS_OPT_IN_ROUTE,
910
} from '../../../helpers/constants/routes';
1011
import { isBeta } from '../../../helpers/utils/build-types';
1112
import WelcomeFooter from './welcome-footer.component';
@@ -16,6 +17,7 @@ export default class Welcome extends PureComponent {
1617
history: PropTypes.object,
1718
participateInMetaMetrics: PropTypes.bool,
1819
welcomeScreenSeen: PropTypes.bool,
20+
isInitialized: PropTypes.bool,
1921
};
2022

2123
static contextTypes = {
@@ -29,17 +31,28 @@ export default class Welcome extends PureComponent {
2931
}
3032

3133
componentDidMount() {
32-
const { history, participateInMetaMetrics, welcomeScreenSeen } = this.props;
34+
const {
35+
history,
36+
participateInMetaMetrics,
37+
welcomeScreenSeen,
38+
isInitialized,
39+
} = this.props;
3340

34-
if (welcomeScreenSeen && participateInMetaMetrics !== null) {
41+
if (
42+
welcomeScreenSeen &&
43+
isInitialized &&
44+
participateInMetaMetrics !== null
45+
) {
3546
history.push(INITIALIZE_CREATE_PASSWORD_ROUTE);
36-
} else if (welcomeScreenSeen) {
47+
} else if (welcomeScreenSeen && participateInMetaMetrics !== null) {
3748
history.push(INITIALIZE_SELECT_ACTION_ROUTE);
49+
} else if (welcomeScreenSeen) {
50+
history.push(INITIALIZE_METAMETRICS_OPT_IN_ROUTE);
3851
}
3952
}
4053

4154
handleContinue = () => {
42-
this.props.history.push(INITIALIZE_SELECT_ACTION_ROUTE);
55+
this.props.history.push(INITIALIZE_METAMETRICS_OPT_IN_ROUTE);
4356
};
4457

4558
render() {

ui/pages/first-time-flow/welcome/welcome.container.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@ import { closeWelcomeScreen } from '../../../store/actions';
55
import Welcome from './welcome.component';
66

77
const mapStateToProps = ({ metamask }) => {
8-
const { welcomeScreenSeen, participateInMetaMetrics } = metamask;
8+
const {
9+
welcomeScreenSeen,
10+
participateInMetaMetrics,
11+
isInitialized,
12+
} = metamask;
913

1014
return {
1115
welcomeScreenSeen,
1216
participateInMetaMetrics,
17+
isInitialized,
1318
};
1419
};
1520

0 commit comments

Comments
 (0)