1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00

remove recovery phrase reminder

This commit is contained in:
Matthias Kretschmann 2023-04-05 04:00:03 +01:00
parent ac6f81d8da
commit 8ebc9fc4f8
Signed by: m
GPG Key ID: 606EEEF3C479A91F
14 changed files with 2 additions and 271 deletions

View File

@ -144,26 +144,6 @@ export default class AppStateController extends EventEmitter {
});
}
/**
* Record that the user has been shown the recovery phrase reminder.
*/
setRecoveryPhraseReminderHasBeenShown() {
this.store.updateState({
recoveryPhraseReminderHasBeenShown: true,
});
}
/**
* Record the timestamp of the last time the user has seen the recovery phrase reminder
*
* @param {number} lastShown - timestamp when user was last shown the reminder.
*/
setRecoveryPhraseReminderLastShown(lastShown) {
this.store.updateState({
recoveryPhraseReminderLastShown: lastShown,
});
}
/**
* Record the timestamp of the last time the user has seen the outdated browser warning
*

View File

@ -1983,14 +1983,6 @@ export default class MetamaskController extends EventEmitter {
appStateController.setConnectedStatusPopoverHasBeenShown.bind(
appStateController,
),
setRecoveryPhraseReminderHasBeenShown:
appStateController.setRecoveryPhraseReminderHasBeenShown.bind(
appStateController,
),
setRecoveryPhraseReminderLastShown:
appStateController.setRecoveryPhraseReminderLastShown.bind(
appStateController,
),
setOutdatedBrowserWarningLastShown:
appStateController.setOutdatedBrowserWarningLastShown.bind(
appStateController,

View File

@ -658,8 +658,6 @@
"ui/components/app/qr-hardware-popover/qr-hardware-sign-request/reader.js",
"ui/components/app/qr-hardware-popover/qr-hardware-wallet-importer/index.js",
"ui/components/app/qr-hardware-popover/qr-hardware-wallet-importer/qr-hardware-wallet-importer.component.js",
"ui/components/app/recovery-phrase-reminder/index.js",
"ui/components/app/recovery-phrase-reminder/recovery-phrase-reminder.js",
"ui/components/app/selected-account/index.js",
"ui/components/app/selected-account/selected-account-component.test.js",
"ui/components/app/selected-account/selected-account.component.js",

View File

@ -60,7 +60,6 @@
@import 'permissions-connect-header/index';
@import 'permissions-connect-permission-list/index';
@import 'permission-cell/index';
@import 'recovery-phrase-reminder/index';
@import 'set-approval-for-all-warning/index';
@import 'step-progress-bar/index.scss';
@import 'selected-account/index';

View File

@ -1,4 +1,4 @@
import React, { useContext, useState } from 'react';
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { useSelector } from 'react-redux';
import ImportTokenLink from '../import-token-link';
@ -23,11 +23,6 @@ import {
TEXT_ALIGN,
} from '../../../helpers/constants/design-system';
import { useI18nContext } from '../../../hooks/useI18nContext';
import { MetaMetricsContext } from '../../../contexts/metametrics';
import {
MetaMetricsEventCategory,
MetaMetricsEventName,
} from '../../../../shared/constants/metametrics';
import DetectedToken from '../detected-token/detected-token';
import {
DetectedTokensBanner,
@ -45,7 +40,6 @@ const AssetList = ({ onClickAsset }) => {
const selectedAccountBalance = useSelector(getSelectedAccountCachedBalance);
const nativeCurrency = useSelector(getNativeCurrency);
const showFiat = useSelector(getShouldShowFiat);
const trackEvent = useContext(MetaMetricsContext);
const balance = useSelector(getSelectedAccountCachedBalance);
const balanceIsLoading = !balance;
@ -112,14 +106,6 @@ const AssetList = ({ onClickAsset }) => {
<TokenList
onTokenClick={(tokenAddress) => {
onClickAsset(tokenAddress);
trackEvent({
event: MetaMetricsEventName.TokenScreenOpened,
category: MetaMetricsEventCategory.Navigation,
properties: {
token_symbol: primaryCurrencyProperties.suffix,
location: 'Home',
},
});
}}
/>
{detectedTokens.length > 0 &&

View File

@ -1 +0,0 @@
export { default } from './recovery-phrase-reminder';

View File

@ -1,10 +0,0 @@
.recovery-phrase-reminder {
&__list {
list-style: disc;
padding-left: 20px;
li {
margin-bottom: 5px;
}
}
}

View File

@ -1,96 +0,0 @@
import React from 'react';
import PropTypes from 'prop-types';
import { useHistory } from 'react-router-dom';
import { useI18nContext } from '../../../hooks/useI18nContext';
// Components
import Box from '../../ui/box';
import Button from '../../ui/button';
import Popover from '../../ui/popover';
import Typography from '../../ui/typography';
// Helpers
import {
DISPLAY,
TEXT_ALIGN,
TypographyVariant,
BLOCK_SIZES,
FONT_WEIGHT,
JustifyContent,
TextColor,
} from '../../../helpers/constants/design-system';
import { ONBOARDING_UNLOCK_ROUTE } from '../../../helpers/constants/routes';
export default function RecoveryPhraseReminder({ onConfirm, hasBackedUp }) {
const t = useI18nContext();
const history = useHistory();
const handleBackUp = () => {
history.push(ONBOARDING_UNLOCK_ROUTE);
};
return (
<Popover centerTitle title={t('recoveryPhraseReminderTitle')}>
<Box
paddingRight={4}
paddingBottom={6}
paddingLeft={4}
className="recovery-phrase-reminder"
>
<Typography
color={TextColor.textDefault}
align={TEXT_ALIGN.CENTER}
variant={TypographyVariant.paragraph}
boxProps={{ marginTop: 0, marginBottom: 4 }}
>
{t('recoveryPhraseReminderSubText')}
</Typography>
<Box marginTop={4} marginBottom={8}>
<ul className="recovery-phrase-reminder__list">
<li>
<Typography
as="span"
color={TextColor.textDefault}
fontWeight={FONT_WEIGHT.BOLD}
>
{t('recoveryPhraseReminderItemOne')}
</Typography>
</li>
<li>{t('recoveryPhraseReminderItemTwo')}</li>
<li>
{hasBackedUp ? (
t('recoveryPhraseReminderHasBackedUp')
) : (
<>
{t('recoveryPhraseReminderHasNotBackedUp')}
<Box display={DISPLAY.INLINE_BLOCK} marginLeft={1}>
<Button
type="link"
onClick={handleBackUp}
style={{
fontSize: 'inherit',
padding: 0,
}}
>
{t('recoveryPhraseReminderBackupStart')}
</Button>
</Box>
</>
)}
</li>
</ul>
</Box>
<Box justifyContent={JustifyContent.center}>
<Box width={BLOCK_SIZES.TWO_FIFTHS}>
<Button type="primary" onClick={onConfirm}>
{t('recoveryPhraseReminderConfirm')}
</Button>
</Box>
</Box>
</Box>
</Popover>
);
}
RecoveryPhraseReminder.propTypes = {
hasBackedUp: PropTypes.bool.isRequired,
onConfirm: PropTypes.func.isRequired,
};

View File

@ -15,7 +15,6 @@ import ConnectedAccounts from '../connected-accounts';
import { Tabs, Tab } from '../../components/ui/tabs';
import { EthOverview } from '../../components/app/wallet-overview';
import WhatsNewPopup from '../../components/app/whats-new-popup';
import RecoveryPhraseReminder from '../../components/app/recovery-phrase-reminder';
import ActionableMessage from '../../components/ui/actionable-message/actionable-message';
import {
FONT_WEIGHT,
@ -44,7 +43,6 @@ import {
VIEW_QUOTE_ROUTE,
CONFIRMATION_V_NEXT_ROUTE,
ADD_NFT_ROUTE,
ONBOARDING_SECURE_YOUR_WALLET_ROUTE,
} from '../../helpers/constants/routes';
import ZENDESK_URLS from '../../helpers/constants/zendesk-url';
@ -71,7 +69,6 @@ export default class Home extends PureComponent {
forgottenPassword: PropTypes.bool,
suggestedAssets: PropTypes.array,
unconfirmedTransactionsCount: PropTypes.number,
shouldShowSeedPhraseReminder: PropTypes.bool.isRequired,
isPopup: PropTypes.bool,
isNotification: PropTypes.bool.isRequired,
firstPermissionsRequestId: PropTypes.string,
@ -101,21 +98,8 @@ export default class Home extends PureComponent {
shouldShowErrors: PropTypes.bool.isRequired,
removeSnapError: PropTypes.func.isRequired,
///: END:ONLY_INCLUDE_IN
showRecoveryPhraseReminder: PropTypes.bool.isRequired,
setRecoveryPhraseReminderHasBeenShown: PropTypes.func.isRequired,
setRecoveryPhraseReminderLastShown: PropTypes.func.isRequired,
showOutdatedBrowserWarning: PropTypes.bool.isRequired,
setOutdatedBrowserWarningLastShown: PropTypes.func.isRequired,
seedPhraseBackedUp: (props) => {
if (
props.seedPhraseBackedUp !== null &&
typeof props.seedPhraseBackedUp !== 'boolean'
) {
throw new Error(
`seedPhraseBackedUp is required to be null or boolean. Received ${props.seedPhraseBackedUp}`,
);
}
},
newNetworkAddedName: PropTypes.string,
// This prop is used in the `shouldCloseNotificationPopup` function
// eslint-disable-next-line react/no-unused-prop-types
@ -218,15 +202,6 @@ export default class Home extends PureComponent {
}
}
onRecoveryPhraseReminderClose = () => {
const {
setRecoveryPhraseReminderHasBeenShown,
setRecoveryPhraseReminderLastShown,
} = this.props;
setRecoveryPhraseReminderHasBeenShown(true);
setRecoveryPhraseReminderLastShown(new Date().getTime());
};
onOutdatedBrowserWarningClose = () => {
const { setOutdatedBrowserWarningLastShown } = this.props;
setOutdatedBrowserWarningLastShown(new Date().getTime());
@ -236,9 +211,6 @@ export default class Home extends PureComponent {
const { t } = this.context;
const {
history,
shouldShowSeedPhraseReminder,
isPopup,
shouldShowWeb3ShimUsageNotification,
setWeb3ShimUsageAlertDismissed,
originOfCurrentTab,
@ -433,22 +405,6 @@ export default class Home extends PureComponent {
key="home-web3ShimUsageNotification"
/>
) : null}
{shouldShowSeedPhraseReminder ? (
<HomeNotification
descriptionText={t('backupApprovalNotice')}
acceptText={t('backupNow')}
onAccept={() => {
const backUpSRPRoute = `${ONBOARDING_SECURE_YOUR_WALLET_ROUTE}/?isFromReminder=true`;
if (isPopup) {
global.platform.openExtensionInBrowser(backUpSRPRoute);
} else {
history.push(backUpSRPRoute);
}
}}
infoText={t('backupApprovalInfo')}
key="home-backupApprovalNotice"
/>
) : null}
{infuraBlocked && this.state.canShowBlockageNotification ? (
<HomeNotification
descriptionText={t('infuraBlockedNotification', [
@ -584,8 +540,6 @@ export default class Home extends PureComponent {
announcementsToShow,
showWhatsNewPopup,
hideWhatsNewPopup,
seedPhraseBackedUp,
showRecoveryPhraseReminder,
firstTimeFlowType,
completedOnboarding,
onboardedInThisUISession,
@ -615,12 +569,6 @@ export default class Home extends PureComponent {
/>
<div className="home__container">
{showWhatsNew ? <WhatsNewPopup onClose={hideWhatsNewPopup} /> : null}
{!showWhatsNew && showRecoveryPhraseReminder ? (
<RecoveryPhraseReminder
hasBackedUp={seedPhraseBackedUp}
onConfirm={this.onRecoveryPhraseReminderClose}
/>
) : null}
{isPopup && !connectedStatusPopoverHasBeenShown
? this.renderPopover()
: null}

View File

@ -16,14 +16,12 @@ import {
getInfuraBlocked,
getShowWhatsNewPopup,
getSortedAnnouncementsToShow,
getShowRecoveryPhraseReminder,
getShowOutdatedBrowserWarning,
getNewNetworkAdded,
hasUnsignedQRHardwareTransaction,
hasUnsignedQRHardwareMessage,
getNewNftAddedMessage,
getNewTokensImported,
getShouldShowSeedPhraseReminder,
getRemoveNftMessage,
} from '../../selectors';
@ -33,8 +31,6 @@ import {
setDefaultHomeActiveTabName,
setWeb3ShimUsageAlertDismissed,
setAlertEnabledness,
setRecoveryPhraseReminderHasBeenShown,
setRecoveryPhraseReminderLastShown,
setOutdatedBrowserWarningLastShown,
setNewNetworkAdded,
setNewNftAddedMessage,
@ -111,7 +107,6 @@ const mapStateToProps = (state) => {
suggestedAssets,
swapsEnabled,
unconfirmedTransactionsCount: unconfirmedTransactionsCountSelector(state),
shouldShowSeedPhraseReminder: getShouldShowSeedPhraseReminder(state),
isPopup,
isNotification,
selectedAddress,
@ -135,7 +130,6 @@ const mapStateToProps = (state) => {
shouldShowErrors: Object.entries(metamask.snapErrors || []).length > 0,
///: END:ONLY_INCLUDE_IN
showWhatsNewPopup: getShowWhatsNewPopup(state),
showRecoveryPhraseReminder: getShowRecoveryPhraseReminder(state),
showOutdatedBrowserWarning:
getIsBrowserDeprecated() && getShowOutdatedBrowserWarning(state),
seedPhraseBackedUp,
@ -162,10 +156,6 @@ const mapDispatchToProps = (dispatch) => ({
disableWeb3ShimUsageAlert: () =>
setAlertEnabledness(AlertTypes.web3ShimUsage, false),
hideWhatsNewPopup: () => dispatch(hideWhatsNewPopup()),
setRecoveryPhraseReminderHasBeenShown: () =>
dispatch(setRecoveryPhraseReminderHasBeenShown()),
setRecoveryPhraseReminderLastShown: (lastShown) =>
dispatch(setRecoveryPhraseReminderLastShown(lastShown)),
setOutdatedBrowserWarningLastShown: (lastShown) => {
dispatch(setOutdatedBrowserWarningLastShown(lastShown));
},

View File

@ -122,7 +122,6 @@ export default class Routes extends Component {
allAccountsOnNetworkAreEmpty: PropTypes.bool,
isTestNet: PropTypes.bool,
currentChainId: PropTypes.string,
shouldShowSeedPhraseReminder: PropTypes.bool,
forgottenPassword: PropTypes.bool,
isCurrentProviderCustom: PropTypes.bool,
completedOnboarding: PropTypes.bool,
@ -431,7 +430,6 @@ export default class Routes extends Component {
allAccountsOnNetworkAreEmpty,
isTestNet,
currentChainId,
shouldShowSeedPhraseReminder,
isCurrentProviderCustom,
completedOnboarding,
isAccountMenuOpen,
@ -454,9 +452,7 @@ export default class Routes extends Component {
const windowType = getEnvironmentType();
const shouldShowNetworkDeprecationWarning =
windowType !== ENVIRONMENT_TYPE_NOTIFICATION &&
isUnlocked &&
!shouldShowSeedPhraseReminder;
windowType !== ENVIRONMENT_TYPE_NOTIFICATION && isUnlocked;
return (
<div

View File

@ -10,7 +10,6 @@ import {
getTheme,
getIsTestnet,
getCurrentChainId,
getShouldShowSeedPhraseReminder,
isCurrentProviderCustom,
} from '../../selectors';
import {
@ -52,7 +51,6 @@ function mapStateToProps(state) {
allAccountsOnNetworkAreEmpty: getAllAccountsOnNetworkAreEmpty(state),
isTestNet: getIsTestnet(state),
currentChainId: getCurrentChainId(state),
shouldShowSeedPhraseReminder: getShouldShowSeedPhraseReminder(state),
forgottenPassword: state.metamask.forgottenPassword,
isCurrentProviderCustom: isCurrentProviderCustom(state),
completedOnboarding,

View File

@ -992,18 +992,6 @@ export function getSortedAnnouncementsToShow(state) {
return announcementsSortedByDate;
}
export function getShowRecoveryPhraseReminder(state) {
const {
recoveryPhraseReminderLastShown,
recoveryPhraseReminderHasBeenShown,
} = state.metamask;
const currentTime = new Date().getTime();
const frequency = recoveryPhraseReminderHasBeenShown ? DAY * 90 : DAY * 2;
return currentTime - recoveryPhraseReminderLastShown >= frequency;
}
export function getShowOutdatedBrowserWarning(state) {
const { outdatedBrowserWarningLastShown } = state.metamask;
if (!outdatedBrowserWarningLastShown) {
@ -1385,17 +1373,6 @@ export function getAllAccountsOnNetworkAreEmpty(state) {
return hasNoNativeFundsOnAnyAccounts && hasNoTokens;
}
export function getShouldShowSeedPhraseReminder(state) {
const { tokens, seedPhraseBackedUp, dismissSeedBackUpReminder } =
state.metamask;
const accountBalance = getCurrentEthBalance(state) ?? 0;
return (
seedPhraseBackedUp === false &&
(parseInt(accountBalance, 16) > 0 || tokens.length > 0) &&
dismissSeedBackUpReminder === false
);
}
export function getCustomTokenAmount(state) {
return state.appState.customTokenAmount;
}

View File

@ -3948,32 +3948,6 @@ export function setConnectedStatusPopoverHasBeenShown(): ThunkAction<
};
}
export function setRecoveryPhraseReminderHasBeenShown() {
return () => {
callBackgroundMethod('setRecoveryPhraseReminderHasBeenShown', [], (err) => {
if (isErrorWithMessage(err)) {
throw new Error(err.message);
}
});
};
}
export function setRecoveryPhraseReminderLastShown(
lastShown: number,
): ThunkAction<void, MetaMaskReduxState, unknown, AnyAction> {
return () => {
callBackgroundMethod(
'setRecoveryPhraseReminderLastShown',
[lastShown],
(err) => {
if (isErrorWithMessage(err)) {
throw new Error(err.message);
}
},
);
};
}
export function setOutdatedBrowserWarningLastShown(lastShown: number) {
return async () => {
await submitRequestToBackground('setOutdatedBrowserWarningLastShown', [