Skip to content

Commit d3868d6

Browse files
committed
Merge branch 'main' into fix/account-connect-origin-spoof
2 parents da780f3 + bb4de90 commit d3868d6

File tree

180 files changed

+6299
-1838
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+6299
-1838
lines changed

.android.env.example

-12
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,3 @@ export MM_FOX_CODE="EXAMPLE_FOX_CODE"
22
export MM_BRANCH_KEY_TEST=
33
export MM_BRANCH_KEY_LIVE=
44
export METAMASK_BUILD_TYPE=
5-
# Firebase
6-
export FCM_CONFIG_API_KEY=
7-
export FCM_CONFIG_AUTH_DOMAIN=
8-
export FCM_CONFIG_PROJECT_ID=
9-
export FCM_CONFIG_STORAGE_BUCKET=
10-
export FCM_CONFIG_MESSAGING_SENDER_ID=
11-
export FCM_CONFIG_APP_ID=
12-
export GOOGLE_SERVICES_B64_ANDROID=
13-
#Notifications Feature Announcements
14-
export FEATURES_ANNOUNCEMENTS_ACCESS_TOKEN=
15-
export FEATURES_ANNOUNCEMENTS_SPACE_ID=
16-

.ios.env.example

-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
11
MM_FOX_CODE = EXAMPLE_FOX_CODE
22
MM_BRANCH_KEY_TEST =
33
MM_BRANCH_KEY_LIVE =
4-
# Firebase
5-
FCM_CONFIG_API_KEY=
6-
FCM_CONFIG_AUTH_DOMAIN=
7-
FCM_CONFIG_PROJECT_ID=
8-
FCM_CONFIG_STORAGE_BUCKET=
9-
FCM_CONFIG_MESSAGING_SENDER_ID=
10-
FCM_CONFIG_APP_ID=
11-
GOOGLE_SERVICES_B64_IOS=
12-
#Notifications Feature Announcements
13-
FEATURES_ANNOUNCEMENTS_ACCESS_TOKEN=
14-
FEATURES_ANNOUNCEMENTS_SPACE_ID=

.js.env.example

+4-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ export MM_FOX_CODE="EXAMPLE_FOX_CODE"
1818

1919
export MM_INFURA_PROJECT_ID="null"
2020
export IGNORE_BOXLOGS_DEVELOPMENT="false"
21+
22+
# Sentry.init dsn value
2123
export MM_SENTRY_DSN=""
24+
# Sentry.init debug option is set to true in dev environments by default. Set this to "false" to turn it off
25+
export SENTRY_DEBUG_DEV="false"
2226
# Determines if Sentry will auto upload source maps and debug files. Disabled by default
2327
export SENTRY_DISABLE_AUTO_UPLOAD="true"
2428

@@ -79,12 +83,6 @@ export PORTFOLIO_VIEW="true"
7983
# Temporary mechanism to enable security alerts API prior to release.
8084
export MM_SECURITY_ALERTS_API_ENABLED="true"
8185
# Firebase
82-
export FCM_CONFIG_API_KEY=""
83-
export FCM_CONFIG_AUTH_DOMAIN=""
84-
export FCM_CONFIG_PROJECT_ID=""
85-
export FCM_CONFIG_STORAGE_BUCKET=""
86-
export FCM_CONFIG_MESSAGING_SENDER_ID=""
87-
export FCM_CONFIG_APP_ID=""
8886
export GOOGLE_SERVICES_B64_ANDROID=""
8987
export GOOGLE_SERVICES_B64_IOS=""
9088
# Notifications Feature Announcements

app/actions/notification/helpers/index.ts

+6-7
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ import { getErrorMessage } from '@metamask/utils';
22

33
import { notificationsErrors } from '../constants';
44
import Engine from '../../../core/Engine';
5-
import {
6-
Notification,
7-
mmStorage,
8-
getAllUUIDs,
9-
} from '../../../util/notifications';
10-
import type { UserStorage } from '@metamask/notification-services-controller/notification-services';
5+
import { mmStorage, getAllUUIDs } from '../../../util/notifications';
6+
import type {
7+
UserStorage,
8+
INotification,
9+
} from '@metamask/notification-services-controller/notification-services';
1110

1211
export type MarkAsReadNotificationsParam = Pick<
13-
Notification,
12+
INotification,
1413
'id' | 'type' | 'isRead'
1514
>[];
1615

app/component-library/components-temp/Price/AggregatedPercentage/AggregatedPercentage.stories.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import React from 'react';
22
import { Provider } from 'react-redux';
3-
import AggregatedPercentage, {
4-
AggregatedPercentageProps,
5-
} from './AggregatedPercentage';
3+
import AggregatedPercentage from './AggregatedPercentage';
64
import { createStore } from 'redux';
75
import initialBackgroundState from '../../../../util/test/initial-background-state.json';
8-
6+
import { AggregatedPercentageProps } from './AggregatedPercentage.types';
97
const mockInitialState = {
108
wizard: {
119
step: 1,

app/component-library/components-temp/Price/AggregatedPercentage/AggregatedPercentage.tsx

+2-14
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,7 @@ import {
1515
FORMATTED_PERCENTAGE_TEST_ID,
1616
} from './AggregatedPercentage.constants';
1717
import { DECIMALS_TO_SHOW } from '../../../../components/UI/Tokens/constants';
18-
19-
export interface AggregatedPercentageProps {
20-
ethFiat: number;
21-
tokenFiat: number;
22-
tokenFiat1dAgo: number;
23-
ethFiat1dAgo: number;
24-
}
18+
import { AggregatedPercentageProps } from './AggregatedPercentage.types';
2519

2620
const isValidAmount = (amount: number | null | undefined): boolean =>
2721
amount !== null && amount !== undefined && !Number.isNaN(amount);
@@ -32,13 +26,7 @@ const AggregatedPercentage = ({
3226
tokenFiat1dAgo,
3327
ethFiat1dAgo,
3428
privacyMode = false,
35-
}: {
36-
ethFiat: number;
37-
tokenFiat: number;
38-
tokenFiat1dAgo: number;
39-
ethFiat1dAgo: number;
40-
privacyMode?: boolean;
41-
}) => {
29+
}: AggregatedPercentageProps) => {
4230
const { styles } = useStyles(styleSheet, {});
4331

4432
const currentCurrency = useSelector(selectCurrentCurrency);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export interface AggregatedPercentageProps {
2+
ethFiat: number;
3+
tokenFiat: number;
4+
tokenFiat1dAgo: number;
5+
ethFiat1dAgo: number;
6+
privacyMode?: boolean;
7+
}

app/component-library/components-temp/Price/AggregatedPercentage/AggregatedPercentageCrossChains.tsx

+2-17
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,7 @@ import {
1717
TokensWithBalances,
1818
} from '../../../../components/hooks/useGetFormattedTokensPerChain';
1919
import { getFormattedAmountChange, getPercentageTextColor } from './utils';
20-
21-
export interface AggregatedPercentageProps {
22-
ethFiat: number;
23-
tokenFiat: number;
24-
tokenFiat1dAgo: number;
25-
ethFiat1dAgo: number;
26-
}
20+
import { AggregatedPercentageCrossChainsProps } from './AggregatedPercentageCrossChains.types';
2721

2822
export const getCalculatedTokenAmount1dAgo = (
2923
tokenFiatBalance: number,
@@ -40,16 +34,7 @@ const AggregatedPercentageCrossChains = ({
4034
privacyMode = false,
4135
totalFiatCrossChains,
4236
tokenFiatBalancesCrossChains,
43-
}: {
44-
privacyMode?: boolean;
45-
totalFiatCrossChains: number;
46-
tokenFiatBalancesCrossChains: {
47-
chainId: string;
48-
nativeFiatValue: number;
49-
tokenFiatBalances: number[];
50-
tokensWithBalances: TokensWithBalances[];
51-
}[];
52-
}) => {
37+
}: AggregatedPercentageCrossChainsProps) => {
5338
const crossChainMarketData: MarketDataMapping = useSelector(
5439
selectTokenMarketData,
5540
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { TokensWithBalances } from '../../../../components/hooks/useGetFormattedTokensPerChain';
2+
3+
export interface AggregatedPercentageCrossChainsProps {
4+
privacyMode?: boolean;
5+
totalFiatCrossChains: number;
6+
tokenFiatBalancesCrossChains: {
7+
chainId: string;
8+
nativeFiatValue: number;
9+
tokenFiatBalances: number[];
10+
tokensWithBalances: TokensWithBalances[];
11+
}[];
12+
}

app/components/Approvals/TransactionApproval/TransactionApproval.test.tsx

+48-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@ import {
77
TransactionApproval,
88
TransactionModalType,
99
} from './TransactionApproval';
10-
10+
import { useConfirmationRedesignEnabled } from '../../Views/confirmations/hooks/useConfirmationRedesignEnabled';
11+
import renderWithProvider from '../../../util/test/renderWithProvider';
12+
13+
jest.mock(
14+
'../../Views/confirmations/hooks/useConfirmationRedesignEnabled',
15+
() => ({
16+
useConfirmationRedesignEnabled: jest.fn(),
17+
}),
18+
);
1119
jest.mock('../../Views/confirmations/hooks/useApprovalRequest');
1220

1321
jest.mock('../../UI/QRHardware/withQRHardwareAwareness', () =>
@@ -30,6 +38,13 @@ const mockApprovalRequest = (approvalRequest?: ApprovalRequest<any>) => {
3038
describe('TransactionApproval', () => {
3139
beforeEach(() => {
3240
jest.resetAllMocks();
41+
(
42+
useConfirmationRedesignEnabled as jest.MockedFn<
43+
typeof useConfirmationRedesignEnabled
44+
>
45+
).mockReturnValue({
46+
isRedesignedEnabled: false,
47+
});
3348
});
3449

3550
it('renders approval component if transaction type is dapp', () => {
@@ -79,9 +94,9 @@ describe('TransactionApproval', () => {
7994
it('returns null if no approval request', () => {
8095
mockApprovalRequest(undefined);
8196

82-
const wrapper = shallow(<TransactionApproval />);
97+
const { toJSON } = renderWithProvider(<TransactionApproval />, {});
8398

84-
expect(wrapper).toMatchSnapshot();
99+
expect(toJSON()).toMatchInlineSnapshot(`null`);
85100
});
86101

87102
it('returns null if incorrect approval request type', () => {
@@ -91,9 +106,9 @@ describe('TransactionApproval', () => {
91106
// eslint-disable-next-line @typescript-eslint/no-explicit-any
92107
} as any);
93108

94-
const wrapper = shallow(<TransactionApproval />);
109+
const { toJSON } = renderWithProvider(<TransactionApproval />, {});
95110

96-
expect(wrapper).toMatchSnapshot();
111+
expect(toJSON()).toMatchInlineSnapshot(`null`);
97112
});
98113

99114
it('returns null if incorrect transaction type', () => {
@@ -103,8 +118,34 @@ describe('TransactionApproval', () => {
103118
// eslint-disable-next-line @typescript-eslint/no-explicit-any
104119
} as any);
105120

106-
const wrapper = shallow(<TransactionApproval transactionType="invalid" />);
121+
const { toJSON } = renderWithProvider(
122+
<TransactionApproval transactionType="invalid" />,
123+
{},
124+
);
107125

108-
expect(wrapper).toMatchSnapshot();
126+
expect(toJSON()).toMatchInlineSnapshot(`null`);
127+
});
128+
129+
it('returns null if redesign is enabled', () => {
130+
mockApprovalRequest({
131+
type: ApprovalTypes.TRANSACTION,
132+
// TODO: Replace "any" with type
133+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
134+
} as any);
135+
136+
(
137+
useConfirmationRedesignEnabled as jest.MockedFn<
138+
typeof useConfirmationRedesignEnabled
139+
>
140+
).mockReturnValue({
141+
isRedesignedEnabled: true,
142+
});
143+
144+
const { toJSON } = renderWithProvider(
145+
<TransactionApproval transactionType={TransactionModalType.Dapp} />,
146+
{},
147+
);
148+
149+
expect(toJSON()).toMatchInlineSnapshot(`null`);
109150
});
110151
});

app/components/Approvals/TransactionApproval/TransactionApproval.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Approve from '../../Views/confirmations/ApproveView/Approve';
66
import QRSigningModal from '../../UI/QRHardware/QRSigningModal';
77
import withQRHardwareAwareness from '../../UI/QRHardware/withQRHardwareAwareness';
88
import { IQRState } from '../../UI/QRHardware/types';
9+
import { useConfirmationRedesignEnabled } from '../../Views/confirmations/hooks/useConfirmationRedesignEnabled';
910

1011
export enum TransactionModalType {
1112
Transaction = 'transaction',
@@ -24,6 +25,7 @@ export interface TransactionApprovalProps {
2425

2526
const TransactionApprovalInternal = (props: TransactionApprovalProps) => {
2627
const { approvalRequest } = useApprovalRequest();
28+
const { isRedesignedEnabled } = useConfirmationRedesignEnabled();
2729
const [modalVisible, setModalVisible] = useState(false);
2830
const { onComplete: propsOnComplete } = props;
2931

@@ -32,7 +34,10 @@ const TransactionApprovalInternal = (props: TransactionApprovalProps) => {
3234
propsOnComplete();
3335
}, [propsOnComplete]);
3436

35-
if (approvalRequest?.type !== ApprovalTypes.TRANSACTION && !modalVisible) {
37+
if (
38+
(approvalRequest?.type !== ApprovalTypes.TRANSACTION && !modalVisible) ||
39+
isRedesignedEnabled
40+
) {
3641
return null;
3742
}
3843

app/components/Approvals/TransactionApproval/__snapshots__/TransactionApproval.test.tsx.snap

-6
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,3 @@ exports[`TransactionApproval renders approve component if transaction type is tr
2727
modalVisible={true}
2828
/>
2929
`;
30-
31-
exports[`TransactionApproval returns null if incorrect approval request type 1`] = `""`;
32-
33-
exports[`TransactionApproval returns null if incorrect transaction type 1`] = `""`;
34-
35-
exports[`TransactionApproval returns null if no approval request 1`] = `""`;

0 commit comments

Comments
 (0)