Fix: show whats new to users who created, not imported, a new wallet,… (#16042)

* Fix: show whats new to users who created, not imported, a new wallet, but not on their first session

* Fix tests

Hide `Improved token detection is here` & `Scam and security risks`  whats new

* Fix unit test

Co-authored-by: PeterYinusa <peter.yinusa@consensys.net>
feature/default_network_editable
Dan J Miller 2 years ago committed by GitHub
parent 0a0eb207e8
commit 392b08a5c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      test/e2e/fixtures/special-settings/state.json
  2. 10
      ui/ducks/app/app.js
  3. 5
      ui/pages/first-time-flow/end-of-flow/end-of-flow.component.js
  4. 3
      ui/pages/first-time-flow/end-of-flow/end-of-flow.container.js
  5. 1
      ui/pages/first-time-flow/end-of-flow/end-of-flow.test.js
  6. 6
      ui/pages/home/home.component.js
  7. 1
      ui/pages/home/home.container.js
  8. 1
      ui/store/actionConstants.js

@ -53,6 +53,12 @@
"8": { "8": {
"isShown": true "isShown": true
}, },
"10": {
"isShown": true
},
"11": {
"isShown": true
},
"12": { "12": {
"isShown": true "isShown": true
}, },

@ -62,6 +62,7 @@ export default function reduceApp(state = {}, action) {
sendInputCurrencySwitched: false, sendInputCurrencySwitched: false,
newTokensImported: '', newTokensImported: '',
newCustomNetworkAdded: {}, newCustomNetworkAdded: {},
onboardedInThisUISession: false,
...state, ...state,
}; };
@ -406,6 +407,11 @@ export default function reduceApp(state = {}, action) {
...appState, ...appState,
newCustomNetworkAdded: action.value, newCustomNetworkAdded: action.value,
}; };
case actionConstants.ONBOARDED_IN_THIS_UI_SESSION:
return {
...appState,
onboardedInThisUISession: action.value,
};
default: default:
return appState; return appState;
} }
@ -471,3 +477,7 @@ export function toggleCurrencySwitch() {
export function setNewCustomNetworkAdded(value) { export function setNewCustomNetworkAdded(value) {
return { type: actionConstants.SET_NEW_CUSTOM_NETWORK_ADDED, value }; return { type: actionConstants.SET_NEW_CUSTOM_NETWORK_ADDED, value };
} }
export function setOnBoardedInThisUISession(value) {
return { type: actionConstants.ONBOARDED_IN_THIS_UI_SESSION, value };
}

@ -17,6 +17,7 @@ export default class EndOfFlowScreen extends PureComponent {
static contextTypes = { static contextTypes = {
t: PropTypes.func, t: PropTypes.func,
trackEvent: PropTypes.func, trackEvent: PropTypes.func,
setOnBoardedInThisUISession: PropTypes.func,
}; };
static propTypes = { static propTypes = {
@ -26,6 +27,7 @@ export default class EndOfFlowScreen extends PureComponent {
location: PropTypes.string, location: PropTypes.string,
tabId: PropTypes.number, tabId: PropTypes.number,
}), }),
setOnBoardedInThisUISession: PropTypes.func,
}; };
async _beforeUnload() { async _beforeUnload() {
@ -37,7 +39,8 @@ export default class EndOfFlowScreen extends PureComponent {
} }
async _onOnboardingComplete() { async _onOnboardingComplete() {
const { setCompletedOnboarding } = this.props; const { setCompletedOnboarding, setOnBoardedInThisUISession } = this.props;
setOnBoardedInThisUISession(true);
await setCompletedOnboarding(); await setCompletedOnboarding();
} }

@ -2,6 +2,7 @@ import { connect } from 'react-redux';
import { getOnboardingInitiator } from '../../../selectors'; import { getOnboardingInitiator } from '../../../selectors';
import { setCompletedOnboarding } from '../../../store/actions'; import { setCompletedOnboarding } from '../../../store/actions';
import { setOnBoardedInThisUISession } from '../../../ducks/app/app';
import EndOfFlow from './end-of-flow.component'; import EndOfFlow from './end-of-flow.component';
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
@ -13,6 +14,8 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = (dispatch) => {
return { return {
setCompletedOnboarding: () => dispatch(setCompletedOnboarding()), setCompletedOnboarding: () => dispatch(setCompletedOnboarding()),
setOnBoardedInThisUISession: (value) =>
dispatch(setOnBoardedInThisUISession(value)),
}; };
}; };

@ -12,6 +12,7 @@ describe('End of Flow Screen', () => {
push: sinon.stub(), push: sinon.stub(),
}, },
setCompletedOnboarding: sinon.stub().resolves(), setCompletedOnboarding: sinon.stub().resolves(),
setOnBoardedInThisUISession: sinon.stub(),
}; };
beforeEach(() => { beforeEach(() => {

@ -153,6 +153,7 @@ export default class Home extends PureComponent {
newCustomNetworkAdded: PropTypes.object, newCustomNetworkAdded: PropTypes.object,
clearNewCustomNetworkAdded: PropTypes.func, clearNewCustomNetworkAdded: PropTypes.func,
setRpcTarget: PropTypes.func, setRpcTarget: PropTypes.func,
onboardedInThisUISession: PropTypes.bool,
}; };
state = { state = {
@ -613,6 +614,7 @@ export default class Home extends PureComponent {
firstTimeFlowType, firstTimeFlowType,
completedOnboarding, completedOnboarding,
shouldShowSeedPhraseReminder, shouldShowSeedPhraseReminder,
onboardedInThisUISession,
} = this.props; } = this.props;
if (forgottenPassword) { if (forgottenPassword) {
@ -622,8 +624,8 @@ export default class Home extends PureComponent {
} }
const showWhatsNew = const showWhatsNew =
((completedOnboarding && firstTimeFlowType === 'import') || completedOnboarding &&
!completedOnboarding) && (!onboardedInThisUISession || firstTimeFlowType === 'import') &&
announcementsToShow && announcementsToShow &&
showWhatsNewPopup && showWhatsNewPopup &&
!showPortfolioTooltip && !showPortfolioTooltip &&

@ -157,6 +157,7 @@ const mapStateToProps = (state) => {
newCollectibleAddedMessage: getNewCollectibleAddedMessage(state), newCollectibleAddedMessage: getNewCollectibleAddedMessage(state),
newTokensImported: getNewTokensImported(state), newTokensImported: getNewTokensImported(state),
newCustomNetworkAdded: appState.newCustomNetworkAdded, newCustomNetworkAdded: appState.newCustomNetworkAdded,
onboardedInThisUISession: appState.onboardedInThisUISession,
}; };
}; };

@ -74,6 +74,7 @@ export const UPDATE_PREFERENCES = 'UPDATE_PREFERENCES';
// Onboarding // Onboarding
export const COMPLETE_ONBOARDING = 'COMPLETE_ONBOARDING'; export const COMPLETE_ONBOARDING = 'COMPLETE_ONBOARDING';
export const ONBOARDED_IN_THIS_UI_SESSION = 'ONBOARDED_IN_THIS_UI_SESSION';
export const SET_MOUSE_USER_STATE = 'SET_MOUSE_USER_STATE'; export const SET_MOUSE_USER_STATE = 'SET_MOUSE_USER_STATE';

Loading…
Cancel
Save