mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
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>
This commit is contained in:
parent
efd1c4d806
commit
b69dcdf7c2
@ -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…
x
Reference in New Issue
Block a user