1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Update pr based on review feedback

This commit is contained in:
Zachary Belford 2022-06-07 12:17:03 -07:00
parent 0f7bb16b9b
commit 93ee67eb01
No known key found for this signature in database
GPG Key ID: CC6C9E5B7B8D6059
6 changed files with 17 additions and 13 deletions

View File

@ -27,7 +27,7 @@ export default class OnboardingController {
onboardingTabs: {}, onboardingTabs: {},
}; };
const initState = { const initState = {
seedPhraseBackedUp: false, seedPhraseBackedUp: null,
firstTimeFlowType: null, firstTimeFlowType: null,
completedOnboarding: false, completedOnboarding: false,
...opts.initState, ...opts.initState,

View File

@ -4,8 +4,6 @@ import PropTypes from 'prop-types';
import { I18nContext } from '../../../contexts/i18n'; import { I18nContext } from '../../../contexts/i18n';
import { Menu, MenuItem } from '../../../components/ui/menu'; import { Menu, MenuItem } from '../../../components/ui/menu';
const noop = () => {};
const AssetOptions = ({ const AssetOptions = ({
onRemove, onRemove,
onClickBlockExplorer, onClickBlockExplorer,
@ -93,17 +91,17 @@ AssetOptions.propTypes = {
onClickBlockExplorer: PropTypes.func.isRequired, onClickBlockExplorer: PropTypes.func.isRequired,
onViewAccountDetails: PropTypes.func.isRequired, onViewAccountDetails: PropTypes.func.isRequired,
onRemove: (props, propName, componentName) => { onRemove: (props, propName, componentName) => {
if (props.isNativeAsset === false && typeof(onRemove) !== "function") { if (props.isNativeAsset === false && typeof(props.onRemove) !== "function") {
throw new Error("When isNativeAsset is true, onRemove is a required prop"); throw new Error("When isNativeAsset is true, onRemove is a required prop");
} }
}, },
onViewTokenDetails: (props, propName, componentName) => { onViewTokenDetails: (props, propName, componentName) => {
if (props.isNativeAsset === false && typeof(onViewTokenDetails) !== "function") { if (props.isNativeAsset === false && typeof(props.onViewTokenDetails) !== "function") {
throw new Error("When isNativeAsset is true, onViewTokenDetails is a required prop"); throw new Error("When isNativeAsset is true, onViewTokenDetails is a required prop");
} }
}, },
tokenSymbol: (props, propName, componentName) => { tokenSymbol: (props, propName, componentName) => {
if (props.isNativeAsset === false && typeof(tokenSymbol) !== "string") { if (props.isNativeAsset === false && typeof(props.tokenSymbol) !== "string") {
throw new Error("When isNativeAsset is true, tokenSymbol is a required prop"); throw new Error("When isNativeAsset is true, tokenSymbol is a required prop");
} }
} }

View File

@ -34,7 +34,7 @@ export default class FirstTimeFlowSwitch extends PureComponent {
return <Redirect to={{ pathname: DEFAULT_ROUTE }} />; return <Redirect to={{ pathname: DEFAULT_ROUTE }} />;
} }
if (seedPhraseBackedUp) { if (seedPhraseBackedUp !== null) {
return <Redirect to={{ pathname: INITIALIZE_END_OF_FLOW_ROUTE }} />; return <Redirect to={{ pathname: INITIALIZE_END_OF_FLOW_ROUTE }} />;
} }

View File

@ -15,7 +15,7 @@ describe('FirstTimeFlowSwitch', () => {
completedOnboarding: null, completedOnboarding: null,
isInitialized: null, isInitialized: null,
isUnlocked: null, isUnlocked: null,
seedPhraseBackedUp: false, seedPhraseBackedUp: null,
}; };
const wrapper = mountWithRouter( const wrapper = mountWithRouter(
<FirstTimeFlowSwitch.WrappedComponent {...props} />, <FirstTimeFlowSwitch.WrappedComponent {...props} />,
@ -76,7 +76,7 @@ describe('FirstTimeFlowSwitch', () => {
const props = { const props = {
completedOnboarding: false, completedOnboarding: false,
isUnlocked: true, isUnlocked: true,
seedPhraseBackedUp: false, seedPhraseBackedUp: null,
}; };
const wrapper = mountWithRouter( const wrapper = mountWithRouter(
@ -93,7 +93,7 @@ describe('FirstTimeFlowSwitch', () => {
completedOnboarding: false, completedOnboarding: false,
isUnlocked: false, isUnlocked: false,
isInitialized: false, isInitialized: false,
seedPhraseBackedUp: false, seedPhraseBackedUp: null,
}; };
const wrapper = mountWithRouter( const wrapper = mountWithRouter(
@ -112,7 +112,7 @@ describe('FirstTimeFlowSwitch', () => {
completedOnboarding: false, completedOnboarding: false,
isUnlocked: false, isUnlocked: false,
isInitialized: true, isInitialized: true,
seedPhraseBackedUp: false, seedPhraseBackedUp: null,
}; };
const wrapper = mountWithRouter( const wrapper = mountWithRouter(

View File

@ -123,7 +123,13 @@ export default class Home extends PureComponent {
showRecoveryPhraseReminder: PropTypes.bool.isRequired, showRecoveryPhraseReminder: PropTypes.bool.isRequired,
setRecoveryPhraseReminderHasBeenShown: PropTypes.func.isRequired, setRecoveryPhraseReminderHasBeenShown: PropTypes.func.isRequired,
setRecoveryPhraseReminderLastShown: PropTypes.func.isRequired, setRecoveryPhraseReminderLastShown: PropTypes.func.isRequired,
seedPhraseBackedUp: PropTypes.bool.isRequired, seedPhraseBackedUp: (props, propName, componentName) => {
if (props.seedPhraseBackedUp !== null && typeof(props.seedPhraseBackedUp) !== "boolean") {
throw new Error(
`seedPhraseBackedUp is required to be null or boolean. Received ${props.seedPhraseBackedUp}`
);
}
},
newNetworkAdded: PropTypes.string, newNetworkAdded: PropTypes.string,
setNewNetworkAdded: PropTypes.func.isRequired, setNewNetworkAdded: PropTypes.func.isRequired,
// This prop is used in the `shouldCloseNotificationPopup` function // This prop is used in the `shouldCloseNotificationPopup` function

View File

@ -31,7 +31,7 @@ export default function OnboardingFlowSwitch() {
return <Redirect to={{ pathname: DEFAULT_ROUTE }} />; return <Redirect to={{ pathname: DEFAULT_ROUTE }} />;
} }
if (seedPhraseBackedUp) { if (seedPhraseBackedUp !== null) {
return <Redirect to={{ pathname: ONBOARDING_COMPLETION_ROUTE }} />; return <Redirect to={{ pathname: ONBOARDING_COMPLETION_ROUTE }} />;
} }