From 8ebc9fc4f8eddcda98f06a032602c6b6715674df Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 5 Apr 2023 04:00:03 +0100 Subject: [PATCH] remove recovery phrase reminder --- app/scripts/controllers/app-state.js | 20 ---- app/scripts/metamask-controller.js | 8 -- .../files-to-convert.json | 2 - ui/components/app/app-components.scss | 1 - ui/components/app/asset-list/asset-list.js | 16 +--- .../app/recovery-phrase-reminder/index.js | 1 - .../app/recovery-phrase-reminder/index.scss | 10 -- .../recovery-phrase-reminder.js | 96 ------------------- ui/pages/home/home.component.js | 52 ---------- ui/pages/home/home.container.js | 10 -- ui/pages/routes/routes.component.js | 6 +- ui/pages/routes/routes.container.js | 2 - ui/selectors/selectors.js | 23 ----- ui/store/actions.ts | 26 ----- 14 files changed, 2 insertions(+), 271 deletions(-) delete mode 100644 ui/components/app/recovery-phrase-reminder/index.js delete mode 100644 ui/components/app/recovery-phrase-reminder/index.scss delete mode 100644 ui/components/app/recovery-phrase-reminder/recovery-phrase-reminder.js diff --git a/app/scripts/controllers/app-state.js b/app/scripts/controllers/app-state.js index f7669e055..85a3f557b 100644 --- a/app/scripts/controllers/app-state.js +++ b/app/scripts/controllers/app-state.js @@ -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 * diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index c1b050b3b..9d1bb65f4 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -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, diff --git a/development/ts-migration-dashboard/files-to-convert.json b/development/ts-migration-dashboard/files-to-convert.json index 254019f80..9dabcb169 100644 --- a/development/ts-migration-dashboard/files-to-convert.json +++ b/development/ts-migration-dashboard/files-to-convert.json @@ -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", diff --git a/ui/components/app/app-components.scss b/ui/components/app/app-components.scss index 196ab6c90..aa0e9af93 100644 --- a/ui/components/app/app-components.scss +++ b/ui/components/app/app-components.scss @@ -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'; diff --git a/ui/components/app/asset-list/asset-list.js b/ui/components/app/asset-list/asset-list.js index 5e305dcf9..a8f8f8c38 100644 --- a/ui/components/app/asset-list/asset-list.js +++ b/ui/components/app/asset-list/asset-list.js @@ -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 }) => { { onClickAsset(tokenAddress); - trackEvent({ - event: MetaMetricsEventName.TokenScreenOpened, - category: MetaMetricsEventCategory.Navigation, - properties: { - token_symbol: primaryCurrencyProperties.suffix, - location: 'Home', - }, - }); }} /> {detectedTokens.length > 0 && diff --git a/ui/components/app/recovery-phrase-reminder/index.js b/ui/components/app/recovery-phrase-reminder/index.js deleted file mode 100644 index 35b8d2da3..000000000 --- a/ui/components/app/recovery-phrase-reminder/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './recovery-phrase-reminder'; diff --git a/ui/components/app/recovery-phrase-reminder/index.scss b/ui/components/app/recovery-phrase-reminder/index.scss deleted file mode 100644 index 2f50b8da6..000000000 --- a/ui/components/app/recovery-phrase-reminder/index.scss +++ /dev/null @@ -1,10 +0,0 @@ -.recovery-phrase-reminder { - &__list { - list-style: disc; - padding-left: 20px; - - li { - margin-bottom: 5px; - } - } -} diff --git a/ui/components/app/recovery-phrase-reminder/recovery-phrase-reminder.js b/ui/components/app/recovery-phrase-reminder/recovery-phrase-reminder.js deleted file mode 100644 index 0448be40c..000000000 --- a/ui/components/app/recovery-phrase-reminder/recovery-phrase-reminder.js +++ /dev/null @@ -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 ( - - - - {t('recoveryPhraseReminderSubText')} - - -
    -
  • - - {t('recoveryPhraseReminderItemOne')} - -
  • -
  • {t('recoveryPhraseReminderItemTwo')}
  • -
  • - {hasBackedUp ? ( - t('recoveryPhraseReminderHasBackedUp') - ) : ( - <> - {t('recoveryPhraseReminderHasNotBackedUp')} - - - - - )} -
  • -
-
- - - - - -
-
- ); -} - -RecoveryPhraseReminder.propTypes = { - hasBackedUp: PropTypes.bool.isRequired, - onConfirm: PropTypes.func.isRequired, -}; diff --git a/ui/pages/home/home.component.js b/ui/pages/home/home.component.js index 35f17e9a0..aaaf9d805 100644 --- a/ui/pages/home/home.component.js +++ b/ui/pages/home/home.component.js @@ -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 ? ( - { - 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 ? (
{showWhatsNew ? : null} - {!showWhatsNew && showRecoveryPhraseReminder ? ( - - ) : null} {isPopup && !connectedStatusPopoverHasBeenShown ? this.renderPopover() : null} diff --git a/ui/pages/home/home.container.js b/ui/pages/home/home.container.js index be0ef90c3..5b67618c7 100644 --- a/ui/pages/home/home.container.js +++ b/ui/pages/home/home.container.js @@ -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)); }, diff --git a/ui/pages/routes/routes.component.js b/ui/pages/routes/routes.component.js index 268e762e3..5d61d43b9 100644 --- a/ui/pages/routes/routes.component.js +++ b/ui/pages/routes/routes.component.js @@ -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 (
= 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; } diff --git a/ui/store/actions.ts b/ui/store/actions.ts index 97be01ad5..711ceeb1b 100644 --- a/ui/store/actions.ts +++ b/ui/store/actions.ts @@ -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 { - return () => { - callBackgroundMethod( - 'setRecoveryPhraseReminderLastShown', - [lastShown], - (err) => { - if (isErrorWithMessage(err)) { - throw new Error(err.message); - } - }, - ); - }; -} - export function setOutdatedBrowserWarningLastShown(lastShown: number) { return async () => { await submitRequestToBackground('setOutdatedBrowserWarningLastShown', [