From f11f359b9ef3f242ff5d1a69c8bb6bb250604e79 Mon Sep 17 00:00:00 2001 From: Nico MASSART Date: Tue, 27 Feb 2024 17:27:40 +0100 Subject: [PATCH 1/7] fix: fix metrics trackEvent compatibility with legacy events (#8678) Add handling of legacy events that have properties inside the event Realted to https://github.com/MetaMask/mobile-planning/issues/1129 --- app/core/Analytics/MetaMetrics.test.ts | 57 ++++++++++++++++++++++++++ app/core/Analytics/MetaMetrics.ts | 5 ++- 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/app/core/Analytics/MetaMetrics.test.ts b/app/core/Analytics/MetaMetrics.test.ts index e1d18d007d3..0fa4a479629 100644 --- a/app/core/Analytics/MetaMetrics.test.ts +++ b/app/core/Analytics/MetaMetrics.test.ts @@ -237,6 +237,63 @@ describe('MetaMetrics', () => { }); expect(metaMetrics.isDataRecorded()).toBeFalsy(); }); + + describe('Legacy events', () => { + it('tracks legacy properties', async () => { + const metaMetrics = TestMetaMetrics.getInstance(); + expect(await metaMetrics.configure()).toBeTruthy(); + await metaMetrics.enable(); + const event: IMetaMetricsEvent = { + category: 'event1', + properties: { action: 'action1', name: 'description1' }, + }; + + metaMetrics.trackEvent(event); + + const { segmentMockClient } = global as any; + expect(segmentMockClient.track).toHaveBeenCalledWith(event.category, { + anonymous: false, + ...event.properties, + }); + }); + + it('overrides legacy properties', async () => { + const metaMetrics = TestMetaMetrics.getInstance(); + expect(await metaMetrics.configure()).toBeTruthy(); + await metaMetrics.enable(); + const event: IMetaMetricsEvent = { + category: 'event1', + properties: { action: 'action1', name: 'description1' }, + }; + const properties = { action: 'action2', name: 'description2' }; + + metaMetrics.trackEvent(event, properties); + + const { segmentMockClient } = global as any; + expect(segmentMockClient.track).toHaveBeenCalledWith(event.category, { + anonymous: false, + ...properties, + }); + }); + + it('does not break on JS legacy call', async () => { + const metaMetrics = TestMetaMetrics.getInstance(); + expect(await metaMetrics.configure()).toBeTruthy(); + await metaMetrics.enable(); + + const event = undefined; + + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-expect-error: Testing untyped legacy JS call with undefined event + metaMetrics.trackEvent(event); + + const { segmentMockClient } = global as any; + expect(segmentMockClient.track).toHaveBeenCalledWith(undefined, { + anonymous: false, + undefined, + }); + }); + }); }); describe('Grouping', () => { diff --git a/app/core/Analytics/MetaMetrics.ts b/app/core/Analytics/MetaMetrics.ts index 44856228981..a2b0e36d17f 100644 --- a/app/core/Analytics/MetaMetrics.ts +++ b/app/core/Analytics/MetaMetrics.ts @@ -600,8 +600,9 @@ class MetaMetrics implements IMetaMetrics { ): void => { if (this.enabled) { this.#trackEvent( - event.category, - { anonymous: false, ...properties }, + // NOTE: we use optional event to avoid undefined error in case of legacy untyped call form JS + event?.category, + { anonymous: false, ...event?.properties, ...properties }, saveDataRecording, ); } From 5fe71b897ff8693ef39be46ce191e430015a550b Mon Sep 17 00:00:00 2001 From: salimtb Date: Tue, 27 Feb 2024 20:28:22 +0100 Subject: [PATCH 2/7] fix: fix infura key displayed (#8744) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** We are exposing our network API keys in the network verification details. Exposing API keys should be avoided due to their significant security risks. To reproduce: Go to networks view Proceed to add any infura supported network from the popular network list. Polygon is a good example. Notice in the network approval modal the Infura API key is exposed in the Network URL field. ## **Related issues** Fixes: [#1574](https://github.com/MetaMask/mobile-planning/issues/1574) ## **Manual testing steps** 1. Go to the add network page 2. Choose polygon and click on add 3. A modal will be displayed, scroll down to see the RPC Url 4. Infura url should not display the api key ## **Screenshots/Recordings** ### **Before** ![before](https://github.com/MetaMask/metamask-mobile/assets/26223211/1faf9b53-9a2c-4a73-96c4-8273ac899b59) ### **After** Screenshot 2024-02-27 at 13 18 42 ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've clearly explained what problem this PR is solving and how it is solved. - [x] I've linked related issues - [x] I've included manual testing steps - [x] I've included screenshots/recordings if applicable - [x] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. - [x] I’ve properly set the pull request status: - [ ] In case it's not yet "ready for review", I've set it to "draft". - [x] In case it's "ready for review", I've changed it from "draft" to "non-draft". ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --- .../__snapshots__/index.test.tsx.snap | 27 +++++++++++-------- .../NetworkVerificationInfo.tsx | 24 ++++++++++++++--- .../NetworkVerificationInfo.test.tsx.snap | 27 +++++++++++-------- .../NetworkSwitcher.test.tsx.snap | 27 +++++++++++-------- app/core/RPCMethods/networkChecker.test.ts | 26 ++++++++++++++++++ app/core/RPCMethods/networkChecker.util.ts | 10 ++++++- 6 files changed, 103 insertions(+), 38 deletions(-) diff --git a/app/components/UI/NetworkModal/__snapshots__/index.test.tsx.snap b/app/components/UI/NetworkModal/__snapshots__/index.test.tsx.snap index 84e5c22fe23..648a484d48f 100644 --- a/app/components/UI/NetworkModal/__snapshots__/index.test.tsx.snap +++ b/app/components/UI/NetworkModal/__snapshots__/index.test.tsx.snap @@ -234,27 +234,32 @@ exports[`NetworkDetails renders correctly 1`] = ` - + > + T + - https://localhost:8545 + https:/ setAlerts(alertsFromProps), [alertsFromProps]); + const networkImageSource = useMemo( + () => + //@ts-expect-error - The utils/network file is still JS and this function expects a networkType, and should be optional + getNetworkImageSource({ + chainId: customNetworkInformation.chainId, + }), + [customNetworkInformation], + ); + const renderNetworkInfo = () => ( {strings('add_custom_network.network_url')} - {customNetworkInformation.rpcUrl} + + {hideKeyFromUrl(customNetworkInformation.rpcUrl)} + { if (!safeChainsListValidationEnabled) return null; if (!alerts.length) return null; + return alerts.map( ( networkAlert: { @@ -229,7 +245,7 @@ const NetworkVerificationInfo = ({ - + > + T + - http://test.com + http:/ - + > + C + - https://evm.cronos.org + https:/ { ]); }); + it('should not return an error if the rpcUrl is not matched but its infura', async () => { + mockedAxios.get.mockImplementation(() => + Promise.resolve({ + data: [ + { + chainId: '137', + rpc: ['http://localhost:8545'], + name: 'Test', + nativeCurrency: { + symbol: 'MATIC', + decimals: 18, + }, + }, + ], + }), + ); + + const alerts = await checkSafeNetwork( + '137', + 'https://polygon-mainnet.infura.io/v3/test', + 'Test', + 'MATIC', + ); + expect(alerts).toEqual([]); + }); + it('should return a warning if the decimals is not matched', async () => { mockedAxios.get.mockImplementation(() => Promise.resolve({ diff --git a/app/core/RPCMethods/networkChecker.util.ts b/app/core/RPCMethods/networkChecker.util.ts index 17129a1cb91..8342d0d210a 100644 --- a/app/core/RPCMethods/networkChecker.util.ts +++ b/app/core/RPCMethods/networkChecker.util.ts @@ -1,6 +1,13 @@ import axios from 'axios'; import { BannerAlertSeverity } from '../../component-library/components/Banners/Banner'; import { strings } from '../../../locales/i18n'; +import PopularList from '../../util/networks/customNetworks'; + +const findPopularNetwork = (rpcUrl: string) => + PopularList.some((network) => { + const { origin } = new URL(network.rpcUrl); + return origin === rpcUrl; + }); const checkSafeNetwork = async ( chainIdDecimal: string, @@ -23,7 +30,8 @@ const checkSafeNetwork = async ( if ( !matchedChain.rpc ?.map((rpc: string) => new URL(rpc).origin) - .includes(origin) + .includes(origin) && + !findPopularNetwork(origin) ) { alerts.push({ alertError: strings('add_custom_network.invalid_rpc_url'), From b536b9648b3a2b7dff2fab2bf7dae48b68f2d8e7 Mon Sep 17 00:00:00 2001 From: Brian August Nguyen Date: Tue, 27 Feb 2024 12:51:17 -0800 Subject: [PATCH 3/7] fix: Fixed underline issue with ButtonLink's pressed state (#8752) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** - Currently when the ButtonLink is pressed, the underline style is added but it also affected the Button's alignment. This PR fixes that issue ## **Related issues** Fixes: #8596 ## **Manual testing steps** 1. Go to any page with a ButtonLink 2. Press on it 3. ## **Screenshots/Recordings** ### **Before** https://github.com/MetaMask/metamask-mobile/assets/14355083/3ff116eb-9a21-448f-babd-abf0bd4017b2 ### **After** https://github.com/MetaMask/metamask-mobile/assets/14355083/7dce6a7b-1f00-4d76-b854-5b8930874391 ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've clearly explained what problem this PR is solving and how it is solved. - [x] I've linked related issues - [x] I've included manual testing steps - [x] I've included screenshots/recordings if applicable - [ ] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. - [x] I’ve properly set the pull request status: - [ ] In case it's not yet "ready for review", I've set it to "draft". - [ ] In case it's "ready for review", I've changed it from "draft" to "non-draft". ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --- .../Button/variants/ButtonLink/ButtonLink.styles.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/component-library/components/Buttons/Button/variants/ButtonLink/ButtonLink.styles.ts b/app/component-library/components/Buttons/Button/variants/ButtonLink/ButtonLink.styles.ts index 51da3251ede..061617555b0 100644 --- a/app/component-library/components/Buttons/Button/variants/ButtonLink/ButtonLink.styles.ts +++ b/app/component-library/components/Buttons/Button/variants/ButtonLink/ButtonLink.styles.ts @@ -1,5 +1,5 @@ // Third party dependencies. -import { StyleSheet, TextStyle, ViewStyle } from 'react-native'; +import { StyleSheet, ViewStyle } from 'react-native'; // External dependencies. import { colors } from '../../../../../../styles/common'; @@ -24,10 +24,7 @@ const styleSheet = (params: { vars: ButtonLinkStyleSheetVars }) => { { backgroundColor: colors.transparent }, style, ) as ViewStyle, - pressedText: Object.assign( - { textDecorationLine: 'underline' } as TextStyle, - style, - ) as TextStyle, + pressedText: { textDecorationLine: 'underline' }, }); }; From 7ef00e199e592a045ab84edd4936adb44e807246 Mon Sep 17 00:00:00 2001 From: Owen Craston Date: Tue, 27 Feb 2024 15:13:59 -0800 Subject: [PATCH 4/7] refactor: consolidate accounts references to a single source of truth (#8664) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** 1. What is the reason for the change? The accounts team is working towards the integration of the new [accounts controller](https://github.com/MetaMask/core/tree/main/packages/accounts-controller). This controller will become the source of truth for all things accounts (name address, methods KeyringType etc). In order to make this integration easier we must first centralize the source of truth for accounts. 3. What is the improvement/solution? - Currently account information is being derived from the preferences controller. In this PR I removed direct use of `state.engine.backgroundState.PreferencesController` in favour of the respective redux selectors. I also migrated the Wallet screen to use the `useAccounts` hook which achieves the same result as before but without custom logic. There should be no visible or functional changes to the app. ## **Related issues** Fixes: https://github.com/MetaMask/metamask-mobile/issues/8482 ## **Notes for code reviewers** - 🔴 No use of `backgroundState.PreferencesController` `selectedAddress` and `identities` - 🟢 Instead they should all be using the `selectIdentities` and the `selectSelectedAddress` selectors ## **Manual testing steps** There should be no visible changes after this PR 1. create/import a wallet 2. click the 3 dots on the the account selector 3. change the account name 4. add an account 5. open the browser 6. navigate to a dapp: https://uniswap.org/ 7. connect the dapp 8. ensure that the account names are the same as the ones you input previously ## **Screenshots/Recordings** ### **Before** ### **After** Creation flow https://github.com/MetaMask/metamask-mobile/assets/22918444/2afefbfa-55d5-446e-b00a-216b8daa2ec8 Import flow https://github.com/MetaMask/metamask-mobile/assets/22918444/f9989e24-439a-4986-acd2-87c8229551a0 ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've clearly explained what problem this PR is solving and how it is solved. - [ ] I've linked related issues - [ ] I've included manual testing steps - [ ] I've included screenshots/recordings if applicable - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. - [ ] I’ve properly set the pull request status: - [ ] In case it's not yet "ready for review", I've set it to "draft". - [ ] In case it's "ready for review", I've changed it from "draft" to "non-draft". ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --- .../UI/WalletAccount/WalletAccount.test.tsx | 85 +++++++++++++++---- .../UI/WalletAccount/WalletAccount.tsx | 54 ++---------- .../UI/WalletAccount/WalletAccount.types.ts | 3 + .../__snapshots__/WalletAccount.test.tsx.snap | 6 +- app/components/Views/ChoosePassword/index.js | 4 +- app/components/Views/Wallet/index.test.tsx | 9 ++ app/components/Views/Wallet/index.tsx | 56 +++++++++--- .../components/SignatureRequest/index.js | 4 +- .../hooks/useAccounts/useAccounts.ts | 4 +- 9 files changed, 139 insertions(+), 86 deletions(-) diff --git a/app/components/UI/WalletAccount/WalletAccount.test.tsx b/app/components/UI/WalletAccount/WalletAccount.test.tsx index 7cda83eb387..909c8d8dc94 100644 --- a/app/components/UI/WalletAccount/WalletAccount.test.tsx +++ b/app/components/UI/WalletAccount/WalletAccount.test.tsx @@ -10,6 +10,8 @@ import { createAccountSelectorNavDetails } from '../../../components/Views/Accou // Internal dependencies import WalletAccount from './WalletAccount'; import initialBackgroundState from '../../../util/test/initial-background-state.json'; +import { Account } from '../../hooks/useAccounts'; +import { KeyringTypes } from '@metamask/keyring-controller'; jest.mock('../../../core/Engine', () => ({ context: { @@ -25,6 +27,14 @@ jest.mock('../../../core/Engine', () => ({ }, })); +const mockAccount: Account = { + name: 'Test account 1', + address: '0xC4955C0d639D99699Bfd7Ec54d9FaFEe40e4D272', + type: KeyringTypes.hd, + yOffset: 0, + isSelected: true, +}; + const mockInitialState = { settings: { useBlockieIcon: false, @@ -32,12 +42,6 @@ const mockInitialState = { engine: { backgroundState: { ...initialBackgroundState, - PreferencesController: { - selectedAddress: '0xC4955C0d639D99699Bfd7Ec54d9FaFEe40e4D272', - identities: { - '0xC4955C0d639D99699Bfd7Ec54d9FaFEe40e4D272': { name: 'Account 1' }, - }, - }, }, }, }; @@ -69,36 +73,81 @@ jest.mock('react-redux', () => ({ describe('WalletAccount', () => { it('renders correctly', () => { - const { toJSON } = renderWithProvider(, { - state: mockInitialState, - }); + const { toJSON } = renderWithProvider( + , + { + state: mockInitialState, + }, + ); expect(toJSON()).toMatchSnapshot(); }); it('shows the account address', () => { - const { getByTestId } = renderWithProvider(, { - state: mockInitialState, - }); + const { getByTestId } = renderWithProvider( + , + { + state: mockInitialState, + }, + ); expect(getByTestId('wallet-account-address')).toBeDefined(); }); it('copies the account address to the clipboard when the copy button is pressed', async () => { - const { getByTestId } = renderWithProvider(, { - state: mockInitialState, - }); + const { getByTestId } = renderWithProvider( + , + { + state: mockInitialState, + }, + ); fireEvent.press(getByTestId('wallet-account-copy-button')); expect(ClipboardManager.setString).toHaveBeenCalledTimes(1); }); it('should navigate to the account selector screen on account press', () => { - const { getByTestId } = renderWithProvider(, { - state: mockInitialState, - }); + const { getByTestId } = renderWithProvider( + , + { + state: mockInitialState, + }, + ); fireEvent.press(getByTestId('account-picker')); expect(mockNavigate).toHaveBeenCalledWith( ...createAccountSelectorNavDetails({}), ); }); + it('displays the correct account name', () => { + const { getByText } = renderWithProvider( + , + { + state: mockInitialState, + }, + ); + expect(getByText(mockAccount.name)).toBeDefined(); + }); + it('displays custom account name when ENS is defined but account name is not the default', () => { + const ensName = 'test.eth'; + const { getByText } = renderWithProvider( + , + { + state: mockInitialState, + }, + ); + expect(getByText(mockAccount.name)).toBeDefined(); + }); + it('displays ENS name when defined and account name is the default', () => { + const ensName = 'test.eth'; + const mockAccountWithDefaultName: Account = { + ...mockAccount, + name: 'Account 1', + }; + const { getByText } = renderWithProvider( + , + { + state: mockInitialState, + }, + ); + expect(getByText(ensName)).toBeDefined(); + }); }); diff --git a/app/components/UI/WalletAccount/WalletAccount.tsx b/app/components/UI/WalletAccount/WalletAccount.tsx index 3a28a4cd27f..22e438ef866 100644 --- a/app/components/UI/WalletAccount/WalletAccount.tsx +++ b/app/components/UI/WalletAccount/WalletAccount.tsx @@ -1,12 +1,5 @@ // Third parties dependencies -import React, { - forwardRef, - useCallback, - useEffect, - useImperativeHandle, - useRef, - useState, -} from 'react'; +import React, { forwardRef, useImperativeHandle, useRef } from 'react'; import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; import { Platform, View } from 'react-native'; @@ -18,15 +11,7 @@ import { createAccountSelectorNavDetails } from '../../../components/Views/Accou import { useStyles } from '../../../component-library/hooks'; import generateTestId from '../../../../wdio/utils/generateTestId'; import AddressCopy from '../AddressCopy'; -import { - doENSReverseLookup, - isDefaultAccountName, -} from '../../../util/ENSUtils'; -import { selectChainId } from '../../../selectors/networkController'; -import { - selectIdentities, - selectSelectedAddress, -} from '../../../selectors/preferencesController'; +import { isDefaultAccountName } from '../../../util/ENSUtils'; import ButtonIcon from '../../../component-library/components/Buttons/ButtonIcon/ButtonIcon'; import { ButtonIconSizes } from '../../../component-library/components/Buttons/ButtonIcon'; import Routes from '../../../constants/navigation/Routes'; @@ -40,12 +25,13 @@ import { } from '../../../../wdio/screen-objects/testIDs/Screens/WalletView.testIds'; import { getLabelTextByAddress } from '../../../util/address'; -const WalletAccount = ({ style }: WalletAccountProps, ref: React.Ref) => { +const WalletAccount = ( + { style, account, ens }: WalletAccountProps, + ref: React.Ref, +) => { const { styles } = useStyles(styleSheet, { style }); const { navigate } = useNavigation(); - const [ens, setEns] = useState(); - const yourAccountRef = useRef(null); const accountActionsRef = useRef(null); @@ -53,40 +39,12 @@ const WalletAccount = ({ style }: WalletAccountProps, ref: React.Ref) => { yourAccountRef, accountActionsRef, })); - /** - * A string that represents the selected address - */ - const selectedAddress = useSelector(selectSelectedAddress); - - /** - * An object containing each identity in the format address => account - */ - const identities = useSelector(selectIdentities); - - const chainId = useSelector(selectChainId); const accountAvatarType = useSelector((state: any) => state.settings.useBlockieIcon ? AvatarAccountType.Blockies : AvatarAccountType.JazzIcon, ); - const account = { - ...identities[selectedAddress], - address: selectedAddress, - }; - - const lookupEns = useCallback(async () => { - try { - const accountEns = await doENSReverseLookup(account.address, chainId); - - setEns(accountEns); - // eslint-disable-next-line no-empty - } catch {} - }, [account.address, chainId]); - - useEffect(() => { - lookupEns(); - }, [lookupEns]); const onNavigateToAccountActions = () => { navigate(Routes.MODAL.ROOT_MODAL_FLOW, { diff --git a/app/components/UI/WalletAccount/WalletAccount.types.ts b/app/components/UI/WalletAccount/WalletAccount.types.ts index 99f03f59845..22a09fe9ad9 100644 --- a/app/components/UI/WalletAccount/WalletAccount.types.ts +++ b/app/components/UI/WalletAccount/WalletAccount.types.ts @@ -1,7 +1,10 @@ import { ViewStyle } from 'react-native'; +import { Account } from '../../hooks/useAccounts'; export interface WalletAccountProps { style?: ViewStyle; + account: Account; + ens?: string; } /** diff --git a/app/components/UI/WalletAccount/__snapshots__/WalletAccount.test.tsx.snap b/app/components/UI/WalletAccount/__snapshots__/WalletAccount.test.tsx.snap index fbceeb4339a..9ce7f36026f 100644 --- a/app/components/UI/WalletAccount/__snapshots__/WalletAccount.test.tsx.snap +++ b/app/components/UI/WalletAccount/__snapshots__/WalletAccount.test.tsx.snap @@ -177,7 +177,7 @@ exports[`WalletAccount renders correctly 1`] = ` } testID="account-label" > - Account 1 + Test account 1 @@ -278,9 +278,7 @@ exports[`WalletAccount renders correctly 1`] = ` } } testID="wallet-account-address" - > - 0xC495...D272 - + /> StyleSheet.create({ @@ -789,8 +790,7 @@ class ChoosePassword extends PureComponent { ChoosePassword.contextType = ThemeContext; const mapStateToProps = (state) => ({ - selectedAddress: - state.engine.backgroundState.PreferencesController?.selectedAddress, + selectedAddress: selectSelectedAddress(state), }); const mapDispatchToProps = (dispatch) => ({ diff --git a/app/components/Views/Wallet/index.test.tsx b/app/components/Views/Wallet/index.test.tsx index e870de2c6fa..a7e471d1527 100644 --- a/app/components/Views/Wallet/index.test.tsx +++ b/app/components/Views/Wallet/index.test.tsx @@ -38,6 +38,15 @@ jest.mock('../../../core/Engine', () => ({ AccountTrackerController: { refresh: jest.fn(), }, + KeyringController: { + state: { + keyrings: [ + { + accounts: ['0xC4955C0d639D99699Bfd7Ec54d9FaFEe40e4D272'], + }, + ], + }, + }, }, })); diff --git a/app/components/Views/Wallet/index.tsx b/app/components/Views/Wallet/index.tsx index 2fe135ac1aa..3321ff0eb88 100644 --- a/app/components/Views/Wallet/index.tsx +++ b/app/components/Views/Wallet/index.tsx @@ -44,6 +44,7 @@ import { import { selectAccountsByChainId } from '../../../selectors/accountTrackerController'; import { selectSelectedAddress } from '../../../selectors/preferencesController'; import { useMetrics } from '../../../components/hooks/useMetrics'; +import { useAccounts } from '../../hooks/useAccounts'; const createStyles = ({ colors, typography }: Theme) => StyleSheet.create({ @@ -124,6 +125,32 @@ const Wallet = ({ navigation }: any) => { */ const providerConfig = useSelector(selectProviderConfig); + /** + * A list of all the user accounts and a mapping of ENS name to account address if they exist + */ + const { accounts, ensByAccountAddress } = useAccounts(); + + /** + * An object representing the currently selected account. + */ + const selectedAccount = useMemo(() => { + if (accounts.length > 0) { + return accounts.find((account) => account.isSelected); + } + return undefined; + }, [accounts]); + + /** + * ENS name for the currently selected account. + * This value may be undefined if there is no corresponding ENS name for the account. + */ + const ensForSelectedAccount = useMemo(() => { + if (ensByAccountAddress && selectedAccount) { + return ensByAccountAddress[selectedAccount.address]; + } + return undefined; + }, [ensByAccountAddress, selectedAccount]); + const networkName = useMemo( () => getNetworkNameFromProviderConfig(providerConfig), [providerConfig], @@ -274,8 +301,14 @@ const Wallet = ({ navigation }: any) => { } return ( - - + {selectedAccount ? ( + + ) : null} { ); }, [ + tokens, + accountsByChainId, + providerConfig.chainId, + selectedAddress, + styles.wrapper, + styles.walletAccount, + selectedAccount, + ensForSelectedAccount, renderTabBar, - conversionRate, - currentCurrency, - navigation, onChangeTab, - selectedAddress, + navigation, ticker, - tokens, - styles, - providerConfig.chainId, - accountsByChainId, + conversionRate, + currentCurrency, ]); const renderLoader = useCallback( () => ( diff --git a/app/components/Views/confirmations/components/SignatureRequest/index.js b/app/components/Views/confirmations/components/SignatureRequest/index.js index a52c26d179b..1bfccc8e6d1 100644 --- a/app/components/Views/confirmations/components/SignatureRequest/index.js +++ b/app/components/Views/confirmations/components/SignatureRequest/index.js @@ -23,6 +23,7 @@ import withQRHardwareAwareness from '../../../../UI/QRHardware/withQRHardwareAwa import WebsiteIcon from '../../../../UI/WebsiteIcon'; import { ResultType } from '../BlockaidBanner/BlockaidBanner.types'; import { withMetricsAwareness } from '../../../../../components/hooks/useMetrics'; +import { selectSelectedAddress } from '../../../../../selectors/preferencesController'; const createStyles = (colors) => StyleSheet.create({ @@ -417,8 +418,7 @@ class SignatureRequest extends PureComponent { } const mapStateToProps = (state) => ({ - selectedAddress: - state.engine.backgroundState.PreferencesController.selectedAddress, + selectedAddress: selectSelectedAddress(state), networkType: selectProviderType(state), securityAlertResponse: state.signatureRequest.securityAlertResponse, }); diff --git a/app/components/hooks/useAccounts/useAccounts.ts b/app/components/hooks/useAccounts/useAccounts.ts index 7d0988f1d6c..d0f04583608 100644 --- a/app/components/hooks/useAccounts/useAccounts.ts +++ b/app/components/hooks/useAccounts/useAccounts.ts @@ -36,7 +36,7 @@ import { /** * Hook that returns both wallet accounts and ens name information. * - * @returns Object that contins both wallet accounts and ens name information. + * @returns Object that contains both wallet accounts and ens name information. */ const useAccounts = ({ checkBalanceError, @@ -93,7 +93,7 @@ const useAccounts = ({ }; } } catch (e) { - // ENS either doesn't exists or failed to fetch. + // ENS either doesn't exist or failed to fetch. } }; From 1abf63ebd997a14cba20c2b4765e7b637133d311 Mon Sep 17 00:00:00 2001 From: tommasini <46944231+tommasini@users.noreply.github.com> Date: Tue, 27 Feb 2024 23:21:26 +0000 Subject: [PATCH 5/7] fix: ethQuery is not defined when refresh is called (#8625) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** We were experiencing `undefined is not an object (evaluating 'inputBn.toString')` this warning multiple times when opening the app, because `this.ethQuery` it was not defined yet at the `AccountTrackerController` when . It was added a condition to only update the balance if it was possible to get balance from chain. Core PR: https://github.com/MetaMask/core/pull/3933 ## **Related issues** Fixes: ## **Manual testing steps** 1. Open the app 2. Shouldn't have the warning `undefined is not an object (evaluating 'inputBn.toString')` 3. ## **Screenshots/Recordings** ### **Before** ### **After** e Smoke E2E test builds: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/a075edf7-676e-4d24-8b0d-014890863b6d Regression E2E test builds: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/30f56c4e-3811-432c-83f0-139ea5b16ff5 ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've clearly explained what problem this PR is solving and how it is solved. - [ ] I've linked related issues - [x] I've included manual testing steps - [ ] I've included screenshots/recordings if applicable - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. - [ ] I’ve properly set the pull request status: - [ ] In case it's not yet "ready for review", I've set it to "draft". - [ ] In case it's "ready for review", I've changed it from "draft" to "non-draft". ## **Pre-merge reviewer checklist** - [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --- .../@metamask+assets-controllers+9.2.0.patch | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/patches/@metamask+assets-controllers+9.2.0.patch b/patches/@metamask+assets-controllers+9.2.0.patch index 376767578ed..5c86c564a4a 100644 --- a/patches/@metamask+assets-controllers+9.2.0.patch +++ b/patches/@metamask+assets-controllers+9.2.0.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/@metamask/assets-controllers/dist/AccountTrackerController.d.ts b/node_modules/@metamask/assets-controllers/dist/AccountTrackerController.d.ts -index ad327da..56a1ae3 100644 +index ad327da..8df74ba 100644 --- a/node_modules/@metamask/assets-controllers/dist/AccountTrackerController.d.ts +++ b/node_modules/@metamask/assets-controllers/dist/AccountTrackerController.d.ts @@ -1,6 +1,7 @@ @@ -47,7 +47,7 @@ index ad327da..56a1ae3 100644 /** * Sets a new provider. diff --git a/node_modules/@metamask/assets-controllers/dist/AccountTrackerController.js b/node_modules/@metamask/assets-controllers/dist/AccountTrackerController.js -index 18802c9..002f27c 100644 +index 18802c9..4b0d158 100644 --- a/node_modules/@metamask/assets-controllers/dist/AccountTrackerController.js +++ b/node_modules/@metamask/assets-controllers/dist/AccountTrackerController.js @@ -18,6 +18,7 @@ const async_mutex_1 = require("async-mutex"); @@ -71,7 +71,7 @@ index 18802c9..002f27c 100644 super(config, state); this.mutex = new async_mutex_1.Mutex(); /** -@@ -46,23 +48,36 @@ class AccountTrackerController extends base_controller_1.BaseController { +@@ -46,23 +48,38 @@ class AccountTrackerController extends base_controller_1.BaseController { * If multi-account is enabled, updates balances for all accounts. */ this.refresh = () => __awaiter(this, void 0, void 0, function* () { @@ -86,12 +86,16 @@ index 18802c9..002f27c 100644 ? Object.keys(accounts) : [this.getSelectedAddress()]; for (const address of accountsToUpdate) { -+ const hexBalance = yield this.getBalanceFromChain(address); - accounts[address] = { +- accounts[address] = { - balance: (0, controller_utils_1.BNToHex)(yield this.getBalanceFromChain(address)), -+ balance: (0, controller_utils_1.BNToHex)(hexBalance), - }; -+ accountsForChain[address] = { balance: (0, controller_utils_1.BNToHex)(hexBalance) }; +- }; ++ const hexBalance = yield this.getBalanceFromChain(address); ++ if(hexBalance){ ++ accounts[address] = { ++ balance: (0, controller_utils_1.BNToHex)(hexBalance), ++ }; ++ accountsForChain[address] = { balance: (0, controller_utils_1.BNToHex)(hexBalance) }; ++ } } - this.update({ accounts }); + this.update({ @@ -112,7 +116,7 @@ index 18802c9..002f27c 100644 this.initialize(); this.getIdentities = getIdentities; this.getSelectedAddress = getSelectedAddress; -@@ -70,21 +85,41 @@ class AccountTrackerController extends base_controller_1.BaseController { +@@ -70,21 +87,41 @@ class AccountTrackerController extends base_controller_1.BaseController { onPreferencesStateChange(() => { this.refresh(); }); From 7f214af6e8bfde7d6ca10189d66dea416ae68ce2 Mon Sep 17 00:00:00 2001 From: Jyoti Puri Date: Wed, 28 Feb 2024 05:31:47 +0530 Subject: [PATCH 6/7] fix: change in blockaid alert message (#8725) --- .../confirmations/components/BlockaidBanner/BlockaidBanner.tsx | 2 +- locales/languages/de.json | 1 - locales/languages/el.json | 1 - locales/languages/en.json | 2 +- locales/languages/es.json | 1 - locales/languages/fr.json | 1 - locales/languages/hi.json | 1 - locales/languages/id.json | 1 - locales/languages/ja.json | 1 - locales/languages/ko.json | 1 - locales/languages/pt.json | 1 - locales/languages/ru.json | 1 - locales/languages/tl.json | 1 - locales/languages/tr.json | 1 - locales/languages/vi.json | 1 - locales/languages/zh.json | 1 - 16 files changed, 2 insertions(+), 16 deletions(-) diff --git a/app/components/Views/confirmations/components/BlockaidBanner/BlockaidBanner.tsx b/app/components/Views/confirmations/components/BlockaidBanner/BlockaidBanner.tsx index 67335fc2422..a8f4252c150 100644 --- a/app/components/Views/confirmations/components/BlockaidBanner/BlockaidBanner.tsx +++ b/app/components/Views/confirmations/components/BlockaidBanner/BlockaidBanner.tsx @@ -166,7 +166,7 @@ const BlockaidBanner = (bannerProps: BlockaidBannerProps) => { return ( - + {strings('blockaid_banner.loading_complete_title')} diff --git a/locales/languages/de.json b/locales/languages/de.json index 5cb8299f503..b94431d4d23 100644 --- a/locales/languages/de.json +++ b/locales/languages/de.json @@ -8,7 +8,6 @@ "failed_title": "Anfrage ist möglicherweise nicht sicher", "failed_description": "Aufgrund eines Fehlers wurde diese Anfrage vom Sicherheitsanbieter nicht überprüft. Gehen Sie mit Bedacht vor.", "loading_title": "Suche nach Sicherheitsbenachrichtigungen ...", - "loading_complete_title": "Keine Benachrichtigungen nempfangen", "malicious_domain_description": "Sie haben es mit einer bösartigen Domain zu tun. Wenn Sie diese Anfrage genehmigen, könnten Sie Ihre Assets verlieren.", "other_description": "Wenn Sie diese Anfrage genehmigen, könnten Sie Ihre Assets verlieren.", "raw_signature_farming_description": "Wenn Sie diese Anfrage genehmigen, könnten Sie Ihre Assets verlieren.", diff --git a/locales/languages/el.json b/locales/languages/el.json index 5de5f63bbfd..0b7526b0a5e 100644 --- a/locales/languages/el.json +++ b/locales/languages/el.json @@ -8,7 +8,6 @@ "failed_title": "Το αίτημα μπορεί να μην είναι ασφαλές", "failed_description": "Λόγω σφάλματος, αυτό το αίτημα δεν επαληθεύτηκε από τον πάροχο ασφαλείας. Προχωρήστε με προσοχή.", "loading_title": "Έλεγχος για ειδοποιήσεις ασφαλείας...", - "loading_complete_title": "Δεν έχετε ειδοποιήσεις", "malicious_domain_description": "Αλληλεπιδράτε με έναν κακόβουλο τομέα. Εάν εγκρίνετε αυτό το αίτημα, ενδέχεται να χάσετε τα περιουσιακά σας στοιχεία.", "other_description": "Εάν εγκρίνετε αυτό το αίτημα, ενδέχεται να χάσετε τα περιουσιακά σας στοιχεία.", "raw_signature_farming_description": "Εάν εγκρίνετε αυτό το αίτημα, ενδέχεται να χάσετε τα περιουσιακά σας στοιχεία.", diff --git a/locales/languages/en.json b/locales/languages/en.json index c0e9e8c8519..fbf44a60407 100644 --- a/locales/languages/en.json +++ b/locales/languages/en.json @@ -8,7 +8,7 @@ "failed_title": "Request may not be safe", "failed_description": "Because of an error, this request was not verified by the security provider. Proceed with caution.", "loading_title": "Checking for security alerts...", - "loading_complete_title": "No alerts received", + "loading_complete_title": "No alerts received. Always do your own due diligence before approving requests.", "malicious_domain_description": "You're interacting with a malicious domain. If you approve this request, you might lose your assets.", "other_description": "If you approve this request, you might lose your assets.", "raw_signature_farming_description": "If you approve this request, you might lose your assets.", diff --git a/locales/languages/es.json b/locales/languages/es.json index 910760b58a3..4f0cb909a2f 100644 --- a/locales/languages/es.json +++ b/locales/languages/es.json @@ -8,7 +8,6 @@ "failed_title": "Es posible que la solicitud no sea segura", "failed_description": "Debido a un error, el proveedor de seguridad no verificó esta solicitud. Proceda con precaución.", "loading_title": "Comprobando alertas de seguridad...", - "loading_complete_title": "No se recibieron alertas", "malicious_domain_description": "Está interactuando con un dominio malicioso. Si aprueba esta solicitud, podría perder sus activos.", "other_description": "Si aprueba esta solicitud, podría perder sus activos.", "raw_signature_farming_description": "Si aprueba esta solicitud, podría perder sus activos.", diff --git a/locales/languages/fr.json b/locales/languages/fr.json index 21013e03410..5709c92a1bf 100644 --- a/locales/languages/fr.json +++ b/locales/languages/fr.json @@ -8,7 +8,6 @@ "failed_title": "Cette demande peut présenter des risques", "failed_description": "À cause d’une erreur, cette demande n’a pas été vérifiée par le fournisseur de services de sécurité. Veuillez agir avec prudence.", "loading_title": "En train de vérifier s’il y a des alertes de sécurité…", - "loading_complete_title": "Aucune alerte reçue", "malicious_domain_description": "Vous interagissez avec un domaine malveillant. Si vous approuvez cette demande, vous risquez de perdre vos actifs.", "other_description": "Si vous approuvez cette demande, vous risquez de perdre vos actifs.", "raw_signature_farming_description": "Si vous approuvez cette demande, vous risquez de perdre vos actifs.", diff --git a/locales/languages/hi.json b/locales/languages/hi.json index 512e405d3a1..c261b6e110f 100644 --- a/locales/languages/hi.json +++ b/locales/languages/hi.json @@ -8,7 +8,6 @@ "failed_title": "हो सकता है कि अनुरोध सुरक्षित न हो", "failed_description": "कोई समस्या होने के कारण, इस अनुरोध को सिक्यूरिटी प्रोवाइडर द्वारा सत्यापित नहीं किया गया। सावधानी से आगे बढ़ें।", "loading_title": "सुरक्षा अलर्ट की जाँच की जा रही है...", - "loading_complete_title": "कोई एलर्ट प्राप्त नहीं हुआ", "malicious_domain_description": "आप एक बुरी नीयत वाले डोमेन से इंटरैक्ट कर रहे हैं। यदि आप इस अनुरोध को स्वीकार करते हैं, तो आप अपने सारे एसेट गंवा सकते हैं।", "other_description": "यदि आप इस अनुरोध को स्वीकार करते हैं, तो आप अपने सारे एसेट गंवा सकते हैं।", "raw_signature_farming_description": "यदि आप इस अनुरोध को स्वीकार करते हैं, तो आप अपने सारे एसेट गंवा सकते हैं।", diff --git a/locales/languages/id.json b/locales/languages/id.json index 2cbf05cde25..0f8d9262418 100644 --- a/locales/languages/id.json +++ b/locales/languages/id.json @@ -8,7 +8,6 @@ "failed_title": "Permintaan mungkin tidak aman", "failed_description": "Karena terjadi kesalahan, permintaan ini tidak diverifikasi oleh penyedia keamanan. Lanjutkan dengan hati-hati.", "loading_title": "Memeriksa peringatan keamanan...", - "loading_complete_title": "Tidak menerima peringatan apa pun", "malicious_domain_description": "Anda berinteraksi dengan domain berbahaya. Jika Anda menyetujui permintaan ini, aset Anda kemungkinan akan hilang.", "other_description": "Jika Anda menyetujui permintaan ini, aset Anda kemungkinan akan hilang.", "raw_signature_farming_description": "Jika Anda menyetujui permintaan ini, aset Anda kemungkinan akan hilang.", diff --git a/locales/languages/ja.json b/locales/languages/ja.json index d2ad047dae2..cdc497ea746 100644 --- a/locales/languages/ja.json +++ b/locales/languages/ja.json @@ -8,7 +8,6 @@ "failed_title": "リクエストが安全でない可能性があります", "failed_description": "エラーが発生したため、このリクエストはセキュリティプロバイダーにより確認されませんでした。慎重に進めてください。", "loading_title": "セキュリティアラートを確認中...", - "loading_complete_title": "アラートは受信していません", "malicious_domain_description": "悪質なドメインとやり取りしています。このリクエストを承認すると、資産を失う可能性があります。", "other_description": "このリクエストを承認すると、資産を失う可能性があります。", "raw_signature_farming_description": "このリクエストを承認すると、資産を失う可能性があります。", diff --git a/locales/languages/ko.json b/locales/languages/ko.json index e6d7c9c7655..56f8439636b 100644 --- a/locales/languages/ko.json +++ b/locales/languages/ko.json @@ -8,7 +8,6 @@ "failed_title": "안전하지 않은 요청일 수 있습니다", "failed_description": "오류로 인해 보안업체에서 이 요청을 확인하지 못했습니다. 주의하여 진행하세요.", "loading_title": "보안 경고 확인하는 중...", - "loading_complete_title": "수신한 경고가 없습니다", "malicious_domain_description": "악성 도메인과 인터렉션하고 있습니다. 이 요청을 승인하면 본인의 자산을 잃을 수도 있습니다.", "other_description": "이 요청을 승인하면, 자산을 잃을 수 있습니다.", "raw_signature_farming_description": "이 요청을 승인하면, 자산을 잃을 수 있습니다.", diff --git a/locales/languages/pt.json b/locales/languages/pt.json index 8d0db8a7ab3..0c354cef212 100644 --- a/locales/languages/pt.json +++ b/locales/languages/pt.json @@ -8,7 +8,6 @@ "failed_title": "A solicitação pode não ser segura", "failed_description": "Em razão de um erro, essa solicitação não foi confirmada pelo provedor de segurança. Prossiga com cautela.", "loading_title": "Verificando se há alertas de segurança...", - "loading_complete_title": "Nenhum alerta recebido", "malicious_domain_description": "Você está interagindo com um domínio mal-intencionado. Se você aprovar essa solicitação, poderá perder seus ativos.", "other_description": "Se você aprovar essa solicitação, poderá perder seus ativos.", "raw_signature_farming_description": "Se você aprovar essa solicitação, poderá perder seus ativos.", diff --git a/locales/languages/ru.json b/locales/languages/ru.json index 04ab1f8251a..bb9f77f843e 100644 --- a/locales/languages/ru.json +++ b/locales/languages/ru.json @@ -8,7 +8,6 @@ "failed_title": "Запрос может быть небезопасным", "failed_description": "Из-за ошибки этот запрос не был подтвержден поставщиком услуг безопасности. Действуйте осторожно.", "loading_title": "Проверка оповещений безопасности...", - "loading_complete_title": "Оповещения не получены", "malicious_domain_description": "Вы взаимодействуете с вредоносным доменом. Если вы одобрите этот запрос, вы можете потерять свои активы.", "other_description": "Если вы одобрите этот запрос, вы можете потерять свои активы.", "raw_signature_farming_description": "Если вы одобрите этот запрос, вы можете потерять свои активы.", diff --git a/locales/languages/tl.json b/locales/languages/tl.json index 120dbad7e4e..498887013d9 100644 --- a/locales/languages/tl.json +++ b/locales/languages/tl.json @@ -8,7 +8,6 @@ "failed_title": "Baka hindi ligtas ang kahilingan", "failed_description": "Dahil sa pagkakamali, ang kahilingang ito ay hindi na-verify ng tagapaglaan ng seguridad. Magpatuloy nang may pag-iingat.", "loading_title": "Sinusuri ang mga alertong pangseguridad...", - "loading_complete_title": "Walang alertong natanggap", "malicious_domain_description": "Nakikipag-ugnayan ka sa isang mapaminsalang domain. Kung aaprubahan mo ang kahilingang ito, posibleng mawala sa iyo ang mga asset mo.", "other_description": "Kung aaprubahan mo ang kahilingang ito, posibleng mawala sa iyo ang mga asset mo.", "raw_signature_farming_description": "Kung aaprubahan mo ang kahilingang ito, posibleng mawala sa iyo ang mga asset mo.", diff --git a/locales/languages/tr.json b/locales/languages/tr.json index 6997d51f795..41f4660a8d6 100644 --- a/locales/languages/tr.json +++ b/locales/languages/tr.json @@ -8,7 +8,6 @@ "failed_title": "Talep güvenli olmayabilir", "failed_description": "Bu talep bir hatadan dolayı güvenlik sağlayıcısı tarafından doğrulanmadı. Dikkatli bir şekilde ilerleyin.", "loading_title": "Güvenlik uyarıları kontrol ediliyor...", - "loading_complete_title": "Hiçbir uyarı alınmadı", "malicious_domain_description": "Kötü niyetli bir alanla etkileşimde bulunuyorsunuz. Bu talebi onaylarsanız varlıklarınızı kaybedebilirsiniz.", "other_description": "Bu talebi onaylarsanız varlıklarınızı kaybedebilirsiniz.", "raw_signature_farming_description": "Bu talebi onaylarsanız varlıklarınızı kaybedebilirsiniz.", diff --git a/locales/languages/vi.json b/locales/languages/vi.json index ce093653ac4..622e9249de8 100644 --- a/locales/languages/vi.json +++ b/locales/languages/vi.json @@ -8,7 +8,6 @@ "failed_title": "Yêu cầu có thể không an toàn", "failed_description": "Do có lỗi, yêu cầu này đã không được nhà cung cấp dịch vụ bảo mật xác minh. Hãy thực hiện cẩn thận.", "loading_title": "Đang kiểm tra cảnh báo bảo mật...", - "loading_complete_title": "Không nhận được cảnh báo nào", "malicious_domain_description": "Bạn đang tương tác với một tên miền độc hại. Nếu bạn chấp thuận yêu cầu này, bạn có thể mất tài sản của mình.", "other_description": "Nếu bạn chấp thuận yêu cầu này, bạn có thể mất tài sản của mình.", "raw_signature_farming_description": "Nếu bạn chấp thuận yêu cầu này, bạn có thể mất tài sản của mình.", diff --git a/locales/languages/zh.json b/locales/languages/zh.json index f05760eeae5..fe2050d12ca 100644 --- a/locales/languages/zh.json +++ b/locales/languages/zh.json @@ -8,7 +8,6 @@ "failed_title": "此请求可能不安全", "failed_description": "由于出现错误,安全服务提供商未验证此请求。请谨慎操作。", "loading_title": "正在检查安全提醒......", - "loading_complete_title": "未收到提醒", "malicious_domain_description": "您正在与恶意网域交互。如果您批准此请求,可能会遭受资产损失。", "other_description": "如果您批准此请求,可能会遭受资产损失。", "raw_signature_farming_description": "如果您批准此请求,可能会有资产损失。", From 70eff9c1c4a0aceebe87353e70f90d115062261b Mon Sep 17 00:00:00 2001 From: Brian August Nguyen Date: Tue, 27 Feb 2024 16:32:05 -0800 Subject: [PATCH 7/7] fix: Updated accessibility role for buttons (#8753) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** - Updated accessibility role for buttons and text inside buttons - Enabled 'Text' to accept accessibilityRole ## **Related issues** Fixes: #8630 ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've clearly explained what problem this PR is solving and how it is solved. - [x] I've linked related issues - [ ] I've included manual testing steps - [ ] I've included screenshots/recordings if applicable - [ ] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. - [x] I’ve properly set the pull request status: - [ ] In case it's not yet "ready for review", I've set it to "draft". - [ ] In case it's "ready for review", I've changed it from "draft" to "non-draft". ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --- .../CustomSpendCap.test.tsx.snap | 6 +++-- .../Banner/__snapshots__/Banner.test.tsx.snap | 4 ++++ .../__snapshots__/BannerAlert.test.tsx.snap | 3 ++- .../__snapshots__/BannerTip.test.tsx.snap | 3 ++- .../BottomSheetFooter.test.tsx.snap | 4 ++++ .../foundation/ButtonBase/ButtonBase.tsx | 3 +++ .../__snapshots__/ButtonBase.test.tsx.snap | 6 +++++ .../Button/variants/ButtonLink/ButtonLink.tsx | 1 + .../__snapshots__/ButtonLink.test.tsx.snap | 1 + .../components/Texts/Text/Text.tsx | 2 +- .../CollectibleModal.test.tsx.snap | 2 ++ .../__snapshots__/index.test.tsx.snap | 4 ++++ .../NetworkVerificationInfo.test.tsx.snap | 4 ++++ .../NetworkSwitcher.test.tsx.snap | 4 ++++ .../Tokens/__snapshots__/index.test.tsx.snap | 6 +++++ .../EditAccountName.test.tsx.snap | 4 ++++ .../NetworkSelector.test.tsx.snap | 2 ++ .../__snapshots__/index.test.tsx.snap | 5 +++- .../BlockaidIndicator.test.tsx.snap | 12 ++++++++++ .../SecuritySettings.test.tsx.snap | 24 +++++++++++++++++-- .../ShowDisplayNFTMediaSheet.test.tsx.snap | 4 ++++ .../ShowIpfsGatewaySheet.test.tsx.snap | 4 ++++ .../ApprovalResult.test.tsx.snap | 4 ++++ 23 files changed, 104 insertions(+), 8 deletions(-) diff --git a/app/component-library/components-temp/CustomSpendCap/__snapshots__/CustomSpendCap.test.tsx.snap b/app/component-library/components-temp/CustomSpendCap/__snapshots__/CustomSpendCap.test.tsx.snap index 070f6a317e0..c59cb885be7 100644 --- a/app/component-library/components-temp/CustomSpendCap/__snapshots__/CustomSpendCap.test.tsx.snap +++ b/app/component-library/components-temp/CustomSpendCap/__snapshots__/CustomSpendCap.test.tsx.snap @@ -89,7 +89,8 @@ exports[`CustomSpendCap should match snapshot 1`] = ` {startIconName && ( @@ -59,6 +61,7 @@ const ButtonBase = ({ {label} diff --git a/app/component-library/components/Buttons/Button/foundation/ButtonBase/__snapshots__/ButtonBase.test.tsx.snap b/app/component-library/components/Buttons/Button/foundation/ButtonBase/__snapshots__/ButtonBase.test.tsx.snap index 08320150ea7..3532252e95d 100644 --- a/app/component-library/components/Buttons/Button/foundation/ButtonBase/__snapshots__/ButtonBase.test.tsx.snap +++ b/app/component-library/components/Buttons/Button/foundation/ButtonBase/__snapshots__/ButtonBase.test.tsx.snap @@ -2,6 +2,8 @@ exports[`ButtonBase should render correctly 1`] = ` = ({ onPressIn={triggerOnPressedIn} onPressOut={triggerOnPressedOut} accessibilityRole="link" + accessible {...props} > {renderLabel()} diff --git a/app/component-library/components/Buttons/Button/variants/ButtonLink/__snapshots__/ButtonLink.test.tsx.snap b/app/component-library/components/Buttons/Button/variants/ButtonLink/__snapshots__/ButtonLink.test.tsx.snap index e61087c330c..e010f07fb29 100644 --- a/app/component-library/components/Buttons/Button/variants/ButtonLink/__snapshots__/ButtonLink.test.tsx.snap +++ b/app/component-library/components/Buttons/Button/variants/ButtonLink/__snapshots__/ButtonLink.test.tsx.snap @@ -4,6 +4,7 @@ exports[`Link should render correctly 1`] = ` = ({ }) => { const { styles } = useStyles(styleSheet, { variant, style, color }); return ( - + {children} ); diff --git a/app/components/UI/CollectibleModal/__snapshots__/CollectibleModal.test.tsx.snap b/app/components/UI/CollectibleModal/__snapshots__/CollectibleModal.test.tsx.snap index d2fca929ba7..cec47e30a5b 100644 --- a/app/components/UI/CollectibleModal/__snapshots__/CollectibleModal.test.tsx.snap +++ b/app/components/UI/CollectibleModal/__snapshots__/CollectibleModal.test.tsx.snap @@ -192,6 +192,8 @@ exports[`CollectibleModal should render correctly 1`] = ` } >