Skip to content

Commit

Permalink
Merge branch 'main' into test/core-PR-5078
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieuartu committed Jan 9, 2025
2 parents 3598015 + 8cc7e0f commit a87be44
Show file tree
Hide file tree
Showing 219 changed files with 5,428 additions and 3,012 deletions.
1 change: 1 addition & 0 deletions .depcheckrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ignores:
- '@react-native-community/slider'
- 'patch-package'
- '@lavamoat/allow-scripts'
- '@lavamoat/git-safe-dependencies'
- 'babel-plugin-inline-import'
# This is used on the patch for TokenRatesController of Assets controllers, for we to be able to use the last version of it
- cockatiel
Expand Down
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ module.exports = {
{
files: [
'app/components/UI/Name/**/*.{js,ts,tsx}',
'app/components/UI/SimulationDetails/**/*.{js,ts,tsx}',
'app/components/hooks/DisplayName/**/*.{js,ts,tsx}'
],
rules: {
Expand Down
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ app/store/migrations/ @MetaMask/mobile-pla
bitrise.yml @MetaMask/mobile-platform
yarn.lock @MetaMask/mobile-platform
ios/Podfile.lock @MetaMask/mobile-platform
app/components/Views/BrowserTab/BrowserTab.tsx @MetaMask/mobile-platform

# Ramps Team
app/components/UI/Ramp/ @MetaMask/ramp
Expand Down Expand Up @@ -76,6 +77,9 @@ patches/react-native+0.*.patch @MetaMask/supply-chain
**/snaps/** @MetaMask/snaps-devs
**/Snaps/** @MetaMask/snaps-devs

# Wallet API Platform Team
app/core/RPCMethods/ @MetaMask/wallet-api-platform-engineers

# Staking Team
app/components/UI/Stake @MetaMask/metamask-staking

Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ jobs:
echo "Duplicate dependencies detected; run 'yarn deduplicate' to remove them"
exit 1
fi
git-safe-dependencies:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: yarn
- run: yarn setup --node
- name: Run @lavamoat/git-safe-dependencies
run: yarn git-safe-dependencies
scripts:
runs-on: ubuntu-20.04
strategy:
Expand Down Expand Up @@ -323,4 +334,4 @@ jobs:
else
echo "All jobs passed step skipped. Block PR."
exit 1
fi
fi
5 changes: 4 additions & 1 deletion .js.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ export MM_ENABLE_SETTINGS_PAGE_DEV_OPTIONS="true"
# Per dapp selected network (Amon Hen) feature flag
export MM_PER_DAPP_SELECTED_NETWORK=""

export MM_CHAIN_PERMISSIONS=""
# Multichain permissions now set to true in production via the CI
# MM_MULTICHAIN_V1_ENABLED is the UI, and MM_CHAIN_PERMISSIONS is the engine
export MM_MULTICHAIN_V1_ENABLED="true"
export MM_CHAIN_PERMISSIONS="true"

# Multichain feature flag specific to UI changes
export MM_MULTICHAIN_V1_ENABLED=""
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Current Main Branch

## 7.37.1 - Dec 16, 2024
### Fixed
- [#12577](https://github.com/MetaMask/metamask-mobile/pull/12577): chore: bump {gas-fee,network,selected-network,notification-services,profile-sync,signature}-controller (#12577)
- [#12694](https://github.com/MetaMask/metamask-mobile/pull/12694): fix: small refactoring of the latest migration script + add a new migration case (#12694)
- [#12664](https://github.com/MetaMask/metamask-mobile/pull/12664): fix: mark transactions as failed for cancelled / unknown smart transactions (#12664)

## 7.37.0 - Nov 28, 2024
### Added
- [#12091](https://github.com/MetaMask/metamask-mobile/pull/12091): feat: 2020 Add a performance test for iOS in Bitrise (#12091)
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ android {
applicationId "io.metamask"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionName "7.37.0"
versionCode 1512
versionName "7.37.1"
versionCode 1520
testBuildType System.getProperty('testBuildType', 'debug')
missingDimensionStrategy 'react-native-camera', 'general'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ exports[`CustomSpendCap should match snapshot 1`] = `
style={
{
"color": "#0376c9",
"fontFamily": "EuclidCircularB-Regular",
"fontFamily": "EuclidCircularB-Medium",
"fontSize": 14,
"fontWeight": "400",
"fontWeight": "500",
"letterSpacing": 0,
"lineHeight": 22,
}
Expand Down Expand Up @@ -249,9 +249,9 @@ exports[`CustomSpendCap should match snapshot 1`] = `
style={
{
"color": "#0376c9",
"fontFamily": "EuclidCircularB-Regular",
"fontFamily": "EuclidCircularB-Medium",
"fontSize": 14,
"fontWeight": "400",
"fontWeight": "500",
"letterSpacing": 0,
"lineHeight": 22,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ exports[`Banner should render correctly with a close button 1`] = `
style={
{
"color": "#0376c9",
"fontFamily": "EuclidCircularB-Regular",
"fontFamily": "EuclidCircularB-Medium",
"fontSize": 14,
"fontWeight": "400",
"fontWeight": "500",
"letterSpacing": 0,
"lineHeight": 22,
}
Expand Down Expand Up @@ -412,9 +412,9 @@ exports[`Banner should render correctly with an action button 1`] = `
style={
{
"color": "#0376c9",
"fontFamily": "EuclidCircularB-Regular",
"fontFamily": "EuclidCircularB-Medium",
"fontSize": 14,
"fontWeight": "400",
"fontWeight": "500",
"letterSpacing": 0,
"lineHeight": 22,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ exports[`BannerAlert should render BannerAlert 1`] = `
style={
{
"color": "#0376c9",
"fontFamily": "EuclidCircularB-Regular",
"fontFamily": "EuclidCircularB-Medium",
"fontSize": 14,
"fontWeight": "400",
"fontWeight": "500",
"letterSpacing": 0,
"lineHeight": 22,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ exports[`BannerTip should render default settings correctly 1`] = `
style={
{
"color": "#0376c9",
"fontFamily": "EuclidCircularB-Regular",
"fontFamily": "EuclidCircularB-Medium",
"fontSize": 14,
"fontWeight": "400",
"fontWeight": "500",
"letterSpacing": 0,
"lineHeight": 22,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ exports[`BottomSheetFooter should render snapshot correctly 1`] = `
style={
{
"color": "#0376c9",
"fontFamily": "EuclidCircularB-Regular",
"fontFamily": "EuclidCircularB-Medium",
"fontSize": 14,
"fontWeight": "400",
"fontWeight": "500",
"letterSpacing": 0,
"lineHeight": 22,
}
Expand Down Expand Up @@ -81,9 +81,9 @@ exports[`BottomSheetFooter should render snapshot correctly 1`] = `
style={
{
"color": "#ffffff",
"fontFamily": "EuclidCircularB-Regular",
"fontFamily": "EuclidCircularB-Medium",
"fontSize": 14,
"fontWeight": "400",
"fontWeight": "500",
"letterSpacing": 0,
"lineHeight": 22,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ exports[`BottomSheetHeader should render snapshot correctly 1`] = `
<View
style={
{
"alignItems": "center",
"backgroundColor": "#ffffff",
"flexDirection": "row",
"padding": 16,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const DEFAULT_BUTTONBASE_LABEL_COLOR = TextColor.Default;
export const DEFAULT_BUTTONBASE_SIZE = ButtonSize.Md;
export const DEFAULT_BUTTONBASE_WIDTH = ButtonWidthTypes.Auto;
export const DEFAULT_BUTTONBASE_ICON_SIZE = IconSize.Sm;
export const DEFAULT_BUTTONBASE_LABEL_TEXTVARIANT = TextVariant.BodyMD;
export const DEFAULT_BUTTONBASE_LABEL_TEXTVARIANT = TextVariant.BodyMDMedium;

// Samples
export const SAMPLE_BUTTONBASE_PROPS: ButtonBaseProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ exports[`ButtonBase should render correctly 1`] = `
"color": "#141618",
}
}
variant="sBodyMD"
variant="sBodyMDMedium"
>
Click me!
</Text>
Expand Down Expand Up @@ -81,7 +81,7 @@ exports[`ButtonBase should render correctly when disabled 1`] = `
"color": "#141618",
}
}
variant="sBodyMD"
variant="sBodyMDMedium"
>
Click me!
</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ exports[`ButtonLink should render correctly 1`] = `
style={
{
"color": "#0376c9",
"fontFamily": "EuclidCircularB-Regular",
"fontFamily": "EuclidCircularB-Medium",
"fontSize": 14,
"fontWeight": "400",
"fontWeight": "500",
"letterSpacing": 0,
"lineHeight": 22,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ exports[`ButtonPrimary render matches latest snapshot 1`] = `
style={
{
"color": "#ffffff",
"fontFamily": "EuclidCircularB-Regular",
"fontFamily": "EuclidCircularB-Medium",
"fontSize": 14,
"fontWeight": "400",
"fontWeight": "500",
"letterSpacing": 0,
"lineHeight": 22,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ exports[`ButtonSecondary should render correctly 1`] = `
style={
{
"color": "#0376c9",
"fontFamily": "EuclidCircularB-Regular",
"fontFamily": "EuclidCircularB-Medium",
"fontSize": 14,
"fontWeight": "400",
"fontWeight": "500",
"letterSpacing": 0,
"lineHeight": 22,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const styleSheet = (params: {
{
backgroundColor: theme.colors.background.default,
flexDirection: 'row',
alignItems: 'center',
} as ViewStyle,
style,
) as ViewStyle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ exports[`HeaderBase should render snapshot correctly 1`] = `
<View
style={
{
"alignItems": "center",
"backgroundColor": "#ffffff",
"flexDirection": "row",
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Third party dependencies.
import { IconName } from '../../Icons/Icon';

import Device from '../../../../util/device';
// Internal dependencies.
import { IconByTabBarIconKey, TabBarIconKey } from './TabBar.types';

Expand All @@ -13,3 +13,5 @@ export const ICON_BY_TAB_BAR_ICON_KEY: IconByTabBarIconKey = {
[TabBarIconKey.Activity]: IconName.Activity,
[TabBarIconKey.Setting]: IconName.Setting,
};

export const TAB_BAR_HEIGHT = Device.isAndroid() ? 62 : 48;
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Device from '../../../../util/device';

// Internal dependencies.
import { TabBarStyleSheetVars } from './TabBar.types';

import { TAB_BAR_HEIGHT } from './TabBar.constants';
/**
* Style sheet function for TabBar component.
*
Expand Down Expand Up @@ -39,7 +39,7 @@ const styleSheet = (params: { vars: TabBarStyleSheetVars; theme: Theme }) => {
base: {
flexDirection: 'row',
alignItems: 'center',
height: Device.isAndroid() ? 62 : 48,
height: TAB_BAR_HEIGHT,
paddingHorizontal: 16,
marginBottom: bottomInset,
backgroundColor: colors.background.default,
Expand Down
3 changes: 2 additions & 1 deletion app/component-library/components/Toast/Toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
import styles from './Toast.styles';
import { ToastSelectorsIDs } from '../../../../e2e/selectors/wallet/ToastModal.selectors';
import { ButtonProps } from '../Buttons/Button/Button.types';
import { TAB_BAR_HEIGHT } from '../Navigation/TabBar/TabBar.constants';

const visibilityDuration = 2750;
const animationDuration = 250;
Expand All @@ -53,7 +54,7 @@ const Toast = forwardRef((_, ref: React.ForwardedRef<ToastRef>) => {
const { bottom: bottomNotchSpacing } = useSafeAreaInsets();
const translateYProgress = useSharedValue(screenHeight);
const animatedStyle = useAnimatedStyle(() => ({
transform: [{ translateY: translateYProgress.value }],
transform: [{ translateY: translateYProgress.value - TAB_BAR_HEIGHT }],
}));
const baseStyle: StyleProp<Animated.AnimateStyle<StyleProp<ViewStyle>>> =
useMemo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,26 @@ import { ApprovalTypes } from '../../../core/RPCMethods/RPCMethodMiddleware';
import { ApprovalRequest } from '@metamask/approval-controller';
import SwitchChainApproval from './SwitchChainApproval';
import { networkSwitched } from '../../../actions/onboardNetwork';
// eslint-disable-next-line import/no-namespace
import * as networks from '../../../util/networks';
import Engine from '../../../core/Engine';
const { PreferencesController } = Engine.context;

jest.mock('../../Views/confirmations/hooks/useApprovalRequest');
jest.mock('../../../actions/onboardNetwork');

jest.mock('../../../core/Engine', () => ({
context: {
PreferencesController: {
setTokenNetworkFilter: jest.fn(),
},
},
}));

jest.mock('react-redux', () => ({
...jest.requireActual('react-redux'),
useDispatch: () => jest.fn(),
useSelector: jest.fn(),
}));

const URL_MOCK = 'test.com';
Expand All @@ -32,6 +45,7 @@ const mockApprovalRequest = (approvalRequest?: ApprovalRequest<any>) => {
describe('SwitchChainApproval', () => {
beforeEach(() => {
jest.resetAllMocks();
jest.spyOn(networks, 'isPortfolioViewEnabled').mockReturnValue(false);
});

it('renders', () => {
Expand Down Expand Up @@ -81,4 +95,29 @@ describe('SwitchChainApproval', () => {
networkStatus: true,
});
});

it('invokes network switched on confirm when portfolio view is enabled', () => {
jest.spyOn(networks, 'isPortfolioViewEnabled').mockReturnValue(true);
const tokenNetworkFilterSpy = jest.spyOn(
PreferencesController,
'setTokenNetworkFilter',
);
mockApprovalRequest({
type: ApprovalTypes.SWITCH_ETHEREUM_CHAIN,
requestData: {
rpcUrl: URL_MOCK,
},
} as ApprovalRequest<{
rpcUrl: string;
}>);

const wrapper = shallow(<SwitchChainApproval />);
wrapper.find('SwitchCustomNetwork').simulate('confirm');
expect(tokenNetworkFilterSpy).toHaveBeenCalledTimes(1);
expect(networkSwitched).toHaveBeenCalledTimes(1);
expect(networkSwitched).toHaveBeenCalledWith({
networkUrl: URL_MOCK,
networkStatus: true,
});
});
});
Loading

0 comments on commit a87be44

Please sign in to comment.