Skip to content

Commit

Permalink
Merge branch 'main' into MMS-1593-increast-swaps-quote-timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
bfullam committed Nov 27, 2024
2 parents 15c3565 + eabb61a commit d24f88e
Show file tree
Hide file tree
Showing 334 changed files with 12,086 additions and 16,442 deletions.
68 changes: 35 additions & 33 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -7,54 +7,57 @@
app/component-library/ @MetaMask/design-system-engineers

# Platform Team
.github/CODEOWNERS @MetaMask/mobile-platform
patches/ @MetaMask/mobile-platform
app/core/Engine.ts @MetaMask/mobile-platform
app/core/Engine.test.js @MetaMask/mobile-platform
app/core/Engine/Engine.ts @MetaMask/mobile-platform
app/core/Engine/Engine.test.ts @MetaMask/mobile-platform
app/core/Engine/index.ts @MetaMask/mobile-platform
app/core/Engine/types.ts @MetaMask/mobile-platform
app/core/Analytics/ @MetaMask/mobile-platform
app/util/metrics/ @MetaMask/mobile-platform
app/components/hooks/useMetrics/ @MetaMask/mobile-platform

# Supply Chain Team
bitrise.yml @MetaMask/supply-chain @MetaMask/mobile-platform
yarn.lock @MetaMask/supply-chain @MetaMask/mobile-platform
ios/Podfile.lock @MetaMask/supply-chain @MetaMask/mobile-platform
app/store/migrations/ @MetaMask/mobile-platform
bitrise.yml @MetaMask/mobile-platform
yarn.lock @MetaMask/mobile-platform
ios/Podfile.lock @MetaMask/mobile-platform

# Ramps Team
app/components/UI/Ramp/ @MetaMask/ramp @MetaMask/mobile-platform
app/reducers/fiatOrders/ @MetaMask/ramp @MetaMask/mobile-platform
app/components/UI/Ramp/ @MetaMask/ramp
app/reducers/fiatOrders/ @MetaMask/ramp

# Confirmation Team
app/components/Views/confirmations @MetaMask/confirmations @MetaMask/mobile-platform
ppom @MetaMask/confirmations @MetaMask/mobile-platform
app/components/Views/confirmations @MetaMask/confirmations
ppom @MetaMask/confirmations

# All below files are maintained by the SDK team because they contain SDK related code, WalletConnect integrations, or critical SDK flows.
app/actions/sdk @MetaMask/sdk-devs @MetaMask/mobile-platform
app/components/Approvals/WalletConnectApproval @MetaMask/sdk-devs @MetaMask/mobile-platform
app/components/Views/SDK @MetaMask/sdk-devs @MetaMask/mobile-platform
app/components/Views/WalletConnectSessions @MetaMask/sdk-devs @MetaMask/mobile-platform
app/core/BackgroundBridge/WalletConnectPort.ts @MetaMask/sdk-devs @MetaMask/mobile-platform
app/core/DeeplinkManager @MetaMask/sdk-devs @MetaMask/mobile-platform
app/core/RPCMethods/RPCMethodMiddleware.ts @MetaMask/sdk-devs @MetaMask/mobile-platform
app/core/SDKConnect @MetaMask/sdk-devs @MetaMask/mobile-platform
app/core/WalletConnect @MetaMask/sdk-devs @MetaMask/mobile-platform
app/reducers/sdk @MetaMask/sdk-devs @MetaMask/mobile-platform
app/util/walletconnect.js @MetaMask/sdk-devs @MetaMask/mobile-platform
app/actions/sdk @MetaMask/sdk-devs
app/components/Approvals/WalletConnectApproval @MetaMask/sdk-devs
app/components/Views/SDK @MetaMask/sdk-devs
app/components/Views/WalletConnectSessions @MetaMask/sdk-devs
app/core/BackgroundBridge/WalletConnectPort.ts @MetaMask/sdk-devs
app/core/DeeplinkManager @MetaMask/sdk-devs
app/core/RPCMethods/RPCMethodMiddleware.ts @MetaMask/sdk-devs
app/core/SDKConnect @MetaMask/sdk-devs
app/core/WalletConnect @MetaMask/sdk-devs
app/reducers/sdk @MetaMask/sdk-devs
app/util/walletconnect.js @MetaMask/sdk-devs

# Accounts Team
app/core/Encryptor/ @MetaMask/accounts-engineers
app/core/Encryptor/ @MetaMask/accounts-engineers
app/core/Engine/controllers/accounts @MetaMask/accounts-engineers

# Swaps Team
app/components/UI/Swaps @MetaMask/swaps-engineers @MetaMask/mobile-platform
app/components/UI/Swaps @MetaMask/swaps-engineers

# Notifications Team
app/components/Views/Notifications @MetaMask/notifications @MetaMask/mobile-platform
app/components/Views/Settings/NotificationsSettings @MetaMask/notifications @MetaMask/mobile-platform
app/components/UI/Notifications @MetaMask/notifications @MetaMask/mobile-platform
app/reducers/notification @MetaMask/notifications @MetaMask/mobile-platform
app/actions/notification @MetaMask/notifications @MetaMask/mobile-platform
app/selectors/notification @MetaMask/notifications @MetaMask/mobile-platform
app/util/notifications @MetaMask/notifications @MetaMask/mobile-platform
app/store/util/notifications @MetaMask/notifications @MetaMask/mobile-platform
app/components/Views/Notifications @MetaMask/notifications
app/components/Views/Settings/NotificationsSettings @MetaMask/notifications
app/components/UI/Notifications @MetaMask/notifications
app/reducers/notification @MetaMask/notifications
app/actions/notification @MetaMask/notifications
app/selectors/notification @MetaMask/notifications
app/util/notifications @MetaMask/notifications
app/store/util/notifications @MetaMask/notifications

# LavaMoat Team
ses.cjs @MetaMask/supply-chain
Expand Down Expand Up @@ -112,7 +115,6 @@ app/components/Views/QRAccountDisplay @MetaMask/wallet-ux
app/components/Views/QRScanner @MetaMask/wallet-ux
app/components/Views/Settings @MetaMask/wallet-ux
app/components/Views/TermsAndConditions @MetaMask/wallet-ux

app/reducers/experimentalSettings @MetaMask/wallet-ux
app/reducers/modals @MetaMask/wallet-ux
app/reducers/navigation @MetaMask/wallet-ux
Expand Down
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

## Current Main Branch

## 7.35.0 - Nov 15, 2024
## 7.35.1 - Nov 20, 2024
### Fixed
- [#12331](https://github.com/MetaMask/metamask-mobile/pull/12331): fix: tags pending approvals receiving undefined (#12331)

## 7.35.0 - Nov 4, 2024
### Added
- [#12078](https://github.com/MetaMask/metamask-mobile/pull/12078): chore(runway): cherry-pick feat: add favorites to browser menu (#12078)
- [#12159](https://github.com/MetaMask/metamask-mobile/pull/12159): feat: Add re-simulation feature (#12107) (#12159)
- [#12107](https://github.com/MetaMask/metamask-mobile/pull/12107): feat: Add re-simulation feature (#12107)
- [#11770](https://github.com/MetaMask/metamask-mobile/pull/11770): feat: enable Security Alerts API (#11770)
- [#11812](https://github.com/MetaMask/metamask-mobile/pull/11812): feat: network value component for re-designed confirmation pages (#11812)
- [#11608](https://github.com/MetaMask/metamask-mobile/pull/11608): feat: enable sentry performance reporting on local development builds (#11608)
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ android {
applicationId "io.metamask"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionName "7.35.0"
versionCode 1497
versionName "7.35.1"
versionCode 1502
testBuildType System.getProperty('testBuildType', 'debug')
missingDimensionStrategy 'react-native-camera', 'general'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
6 changes: 3 additions & 3 deletions app/actions/onboarding/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { IMetaMetricsEvent } from '../../core/Analytics';
import { ITrackingEvent } from '../../core/Analytics/MetaMetrics.types';

export const SAVE_EVENT = 'SAVE_EVENT';
export const CLEAR_EVENTS = 'CLEAR_EVENTS';

interface SaveEventAction {
type: typeof SAVE_EVENT;
event: [IMetaMetricsEvent];
event: [ITrackingEvent];
}

interface ClearEventsAction {
Expand All @@ -15,7 +15,7 @@ interface ClearEventsAction {
export type OnboardingActionTypes = SaveEventAction | ClearEventsAction;

export function saveOnboardingEvent(
eventArgs: [IMetaMetricsEvent],
eventArgs: [ITrackingEvent],
): SaveEventAction {
return {
type: SAVE_EVENT,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 18 additions & 6 deletions app/component-library/components/Navigation/TabBar/TabBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import OnboardingWizard from '../../../../components/UI/OnboardingWizard';

const TabBar = ({ state, descriptors, navigation }: TabBarProps) => {
const { colors } = useTheme();
const { trackEvent } = useMetrics();
const { trackEvent, createEventBuilder } = useMetrics();
const { bottom: bottomInset } = useSafeAreaInsets();
const { styles } = useStyles(styleSheet, { bottomInset });
const chainId = useSelector(selectChainId);
Expand Down Expand Up @@ -73,10 +73,14 @@ const TabBar = ({ state, descriptors, navigation }: TabBarProps) => {
navigation.navigate(Routes.MODAL.ROOT_MODAL_FLOW, {
screen: Routes.MODAL.WALLET_ACTIONS,
});
trackEvent(MetaMetricsEvents.ACTIONS_BUTTON_CLICKED, {
text: '',
chain_id: getDecimalChainId(chainId),
});
trackEvent(
createEventBuilder(MetaMetricsEvents.ACTIONS_BUTTON_CLICKED)
.addProperties({
text: '',
chain_id: getDecimalChainId(chainId),
})
.build(),
);
break;
case Routes.BROWSER_VIEW:
navigation.navigate(Routes.BROWSER.HOME, {
Expand Down Expand Up @@ -124,7 +128,15 @@ const TabBar = ({ state, descriptors, navigation }: TabBarProps) => {
/>
);
},
[state, descriptors, navigation, colors, chainId, trackEvent],
[
state,
descriptors,
navigation,
colors,
chainId,
trackEvent,
createEventBuilder,
],
);

const renderTabBarItems = useCallback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { MetaMetricsEvents } from '../../../core/Analytics';
import { backgroundState } from '../../../util/test/initial-root-state';
import { render } from '@testing-library/react-native';
import { useMetrics } from '../../../components/hooks/useMetrics';
import { MetricsEventBuilder } from '../../../core/Analytics/MetricsEventBuilder';

jest.mock('../../Views/confirmations/hooks/useApprovalRequest');
jest.mock('../../../components/hooks/useMetrics');
Expand Down Expand Up @@ -68,22 +69,23 @@ const mockSelectorState = (state: any) => {

const mockTrackEvent = jest.fn();

(useMetrics as jest.MockedFn<typeof useMetrics>).mockReturnValue({
trackEvent: mockTrackEvent,
createEventBuilder: MetricsEventBuilder.createEventBuilder,
enable: jest.fn(),
addTraitsToUser: jest.fn(),
createDataDeletionTask: jest.fn(),
checkDataDeleteStatus: jest.fn(),
getDeleteRegulationCreationDate: jest.fn(),
getDeleteRegulationId: jest.fn(),
isDataRecorded: jest.fn(),
isEnabled: jest.fn(),
getMetaMetricsId: jest.fn(),
});

describe('PermissionApproval', () => {
beforeEach(() => {
jest.resetAllMocks();
(useMetrics as jest.MockedFn<typeof useMetrics>).mockReturnValue({
trackEvent: mockTrackEvent,
createEventBuilder: jest.fn(),
enable: jest.fn(),
addTraitsToUser: jest.fn(),
createDataDeletionTask: jest.fn(),
checkDataDeleteStatus: jest.fn(),
getDeleteRegulationCreationDate: jest.fn(),
getDeleteRegulationId: jest.fn(),
isDataRecorded: jest.fn(),
isEnabled: jest.fn(),
getMetaMetricsId: jest.fn(),
});
jest.clearAllMocks();
});

it('navigates', async () => {
Expand Down Expand Up @@ -143,14 +145,17 @@ describe('PermissionApproval', () => {

render(<PermissionApproval navigation={navigationMock} />);

expect(mockTrackEvent).toHaveBeenCalledTimes(1);
expect(mockTrackEvent).toHaveBeenCalledWith(
const expectedEvent = MetricsEventBuilder.createEventBuilder(
MetaMetricsEvents.CONNECT_REQUEST_STARTED,
{
)
.addProperties({
number_of_accounts: 3,
source: 'PERMISSION SYSTEM',
},
);
})
.build();

expect(mockTrackEvent).toHaveBeenCalledTimes(1);
expect(mockTrackEvent).toHaveBeenCalledWith(expectedEvent);
});

it('does not navigate if no approval request', async () => {
Expand Down
22 changes: 16 additions & 6 deletions app/components/Approvals/PermissionApproval/PermissionApproval.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface PermissionApprovalProps {
}

const PermissionApproval = (props: PermissionApprovalProps) => {
const { trackEvent } = useMetrics();
const { trackEvent, createEventBuilder } = useMetrics();
const { approvalRequest } = useApprovalRequest();
const totalAccounts = useSelector(selectAccountsLength);
const isProcessing = useRef<boolean>(false);
Expand All @@ -38,18 +38,28 @@ const PermissionApproval = (props: PermissionApprovalProps) => {

isProcessing.current = true;

trackEvent(MetaMetricsEvents.CONNECT_REQUEST_STARTED, {
number_of_accounts: totalAccounts,
source: 'PERMISSION SYSTEM',
});
trackEvent(
createEventBuilder(MetaMetricsEvents.CONNECT_REQUEST_STARTED)
.addProperties({
number_of_accounts: totalAccounts,
source: 'PERMISSION SYSTEM',
})
.build(),
);

props.navigation.navigate(
...createAccountConnectNavDetails({
hostInfo: requestData,
permissionRequestId: id,
}),
);
}, [approvalRequest, totalAccounts, props.navigation, trackEvent]);
}, [
approvalRequest,
totalAccounts,
props.navigation,
trackEvent,
createEventBuilder,
]);

return null;
};
Expand Down
44 changes: 30 additions & 14 deletions app/components/Nav/Main/MainNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ const SettingsFlow = () => (
);

const HomeTabs = () => {
const { trackEvent } = useMetrics();
const { trackEvent, createEventBuilder } = useMetrics();
const drawerRef = useRef(null);
const [isKeyboardHidden, setIsKeyboardHidden] = useState(true);

Expand Down Expand Up @@ -439,10 +439,14 @@ const HomeTabs = () => {
home: {
tabBarIconKey: TabBarIconKey.Wallet,
callback: () => {
trackEvent(MetaMetricsEvents.WALLET_OPENED, {
number_of_accounts: accountsLength,
chain_id: getDecimalChainId(chainId),
});
trackEvent(
createEventBuilder(MetaMetricsEvents.WALLET_OPENED)
.addProperties({
number_of_accounts: accountsLength,
chain_id: getDecimalChainId(chainId),
})
.build(),
);
},
rootScreenName: Routes.WALLET_VIEW,
},
Expand All @@ -453,27 +457,39 @@ const HomeTabs = () => {
browser: {
tabBarIconKey: TabBarIconKey.Browser,
callback: () => {
trackEvent(MetaMetricsEvents.BROWSER_OPENED, {
number_of_accounts: accountsLength,
chain_id: getDecimalChainId(chainId),
source: 'Navigation Tab',
active_connected_dapp: activeConnectedDapp,
number_of_open_tabs: amountOfBrowserOpenTabs,
});
trackEvent(
createEventBuilder(MetaMetricsEvents.BROWSER_OPENED)
.addProperties({
number_of_accounts: accountsLength,
chain_id: getDecimalChainId(chainId),
source: 'Navigation Tab',
active_connected_dapp: activeConnectedDapp,
number_of_open_tabs: amountOfBrowserOpenTabs,
})
.build(),
);
},
rootScreenName: Routes.BROWSER_VIEW,
},
activity: {
tabBarIconKey: TabBarIconKey.Activity,
callback: () => {
trackEvent(MetaMetricsEvents.NAVIGATION_TAPS_TRANSACTION_HISTORY);
trackEvent(
createEventBuilder(
MetaMetricsEvents.NAVIGATION_TAPS_TRANSACTION_HISTORY,
).build(),
);
},
rootScreenName: Routes.TRANSACTIONS_VIEW,
},
settings: {
tabBarIconKey: TabBarIconKey.Setting,
callback: () => {
trackEvent(MetaMetricsEvents.NAVIGATION_TAPS_SETTINGS);
trackEvent(
createEventBuilder(
MetaMetricsEvents.NAVIGATION_TAPS_SETTINGS,
).build(),
);
},
rootScreenName: Routes.SETTINGS_VIEW,
unmountOnBlur: true,
Expand Down
Loading

0 comments on commit d24f88e

Please sign in to comment.