Skip to content

Commit d812c3f

Browse files
authored
Merge branch 'main' into wsun/ota-update-exp-workflow
2 parents 3c8031a + b60cba2 commit d812c3f

File tree

282 files changed

+14822
-11390
lines changed

Some content is hidden

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

282 files changed

+14822
-11390
lines changed

.github/actions/smart-e2e-selection/action.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ runs:
4646
- name: Fetch base branch for comparison
4747
shell: bash
4848
run: |
49-
# Fetch base branch with enough depth to compute merge base for git diff
50-
git fetch origin main --depth=100 2>/dev/null || git fetch origin master --depth=100 2>/dev/null || true
49+
# Unshallow the repository first (if it's shallow)
50+
git fetch --unshallow 2>/dev/null || true
51+
# Then fetch base branch to ensure merge-base exists
52+
git fetch origin main 2>/dev/null || true
5153
5254
- name: Setup Node.js
5355
uses: actions/setup-node@v4

.github/workflows/create-release-pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,15 @@ jobs:
7979
create-release-pr:
8080
needs: [resolve-bases, resolve-previous-ref, generate-build-version]
8181
name: Create Release Pull Request using Github Tools
82-
uses: MetaMask/github-tools/.github/workflows/create-release-pr.yml@749c097218590d5cd36d28d07967e12ba830b146
82+
uses: MetaMask/github-tools/.github/workflows/create-release-pr.yml@6a04e4d0c8c25680a7543cfcd2e2fb7125b6759c
8383
with:
8484
platform: mobile
8585
checkout-base-branch: ${{ needs.resolve-bases.outputs.checkout_base }}
8686
release-pr-base-branch: ${{ needs.resolve-bases.outputs.release_base }}
8787
semver-version: ${{ inputs.semver-version }}
8888
previous-version-ref: ${{ needs.resolve-previous-ref.outputs.previous_ref }}
8989
mobile-build-version: ${{ needs.generate-build-version.outputs.build-version }}
90-
github-tools-version: 749c097218590d5cd36d28d07967e12ba830b146
90+
github-tools-version: 6a04e4d0c8c25680a7543cfcd2e2fb7125b6759c
9191
secrets:
9292
# This token needs write permissions to metamask-mobile & read permissions to metamask-planning
9393
# If called from auto-create-release-pr use the PR_TOKEN passed in as an input, if called manually use github secret token values

.github/workflows/run-e2e-smoke-tests-android.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ jobs:
141141
fail-fast: false
142142
uses: ./.github/workflows/run-e2e-workflow.yml
143143
with:
144-
test-suite-name: prediction_market_android_smoke-${{ matrix.split }}
144+
test-suite-name: prediction-market-android-smoke-${{ matrix.split }}
145145
platform: android
146146
test_suite_tag: 'SmokePredictions'
147147
split_number: ${{ matrix.split }}

.github/workflows/run-e2e-smoke-tests-ios.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ jobs:
141141
fail-fast: false
142142
uses: ./.github/workflows/run-e2e-workflow.yml
143143
with:
144-
test-suite-name: prediction_market_ios_smoke-${{ matrix.split }}
144+
test-suite-name: prediction-market-ios-smoke-${{ matrix.split }}
145145
platform: ios
146146
test_suite_tag: 'SmokePredictions'
147147
split_number: ${{ matrix.split }}

android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ android {
187187
applicationId "io.metamask"
188188
minSdkVersion rootProject.ext.minSdkVersion
189189
targetSdkVersion rootProject.ext.targetSdkVersion
190-
versionName "7.60.0"
190+
versionName "7.61.0"
191191
versionCode 2993
192192
testBuildType System.getProperty('testBuildType', 'debug')
193193
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

app/component-library/components/Navigation/TabBar/TabBar.test.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ interface TestDescriptors {
3030
[key: string]: TestTabDescriptor;
3131
}
3232

33-
// Force rewards feature flag to be enabled for this test file
34-
jest.mock('../../../../selectors/featureFlagController/rewards', () => ({
35-
selectRewardsEnabledFlag: () => true,
36-
}));
37-
3833
// Mock trending tokens feature flag selector
3934
jest.mock('../../../../selectors/featureFlagController/assetsTrendingTokens');
4035

app/component-library/components/Navigation/TabBar/TabBar.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,12 @@ import {
2727
LABEL_BY_TAB_BAR_ICON_KEY,
2828
} from './TabBar.constants';
2929
import { selectChainId } from '../../../../selectors/networkController';
30-
import { selectRewardsEnabledFlag } from '../../../../selectors/featureFlagController/rewards';
3130
import { selectAssetsTrendingTokensEnabled } from '../../../../selectors/featureFlagController/assetsTrendingTokens';
3231

3332
const TabBar = ({ state, descriptors, navigation }: TabBarProps) => {
3433
const { trackEvent, createEventBuilder } = useMetrics();
3534
const { bottom: bottomInset } = useSafeAreaInsets();
3635
const chainId = useSelector(selectChainId);
37-
const isRewardsEnabled = useSelector(selectRewardsEnabledFlag);
3836
const isAssetsTrendingTokensEnabled = useSelector(
3937
selectAssetsTrendingTokensEnabled,
4038
);
@@ -86,9 +84,7 @@ const TabBar = ({ state, descriptors, navigation }: TabBarProps) => {
8684
navigation.navigate(Routes.TRANSACTIONS_VIEW);
8785
break;
8886
case Routes.REWARDS_VIEW:
89-
if (isRewardsEnabled) {
90-
navigation.navigate(Routes.REWARDS_VIEW);
91-
}
87+
navigation.navigate(Routes.REWARDS_VIEW);
9288
break;
9389
case Routes.SETTINGS_VIEW:
9490
navigation.navigate(Routes.SETTINGS_VIEW, {
@@ -127,7 +123,6 @@ const TabBar = ({ state, descriptors, navigation }: TabBarProps) => {
127123
trackEvent,
128124
createEventBuilder,
129125
tw,
130-
isRewardsEnabled,
131126
isAssetsTrendingTokensEnabled,
132127
],
133128
);

app/component-library/hooks/useStyles.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,31 @@ import { Theme } from '../../util/theme/models';
77
* Hook that handles both passing style sheet variables into style sheet and memoization.
88
*
99
* @param styleSheet Return value of useStyles hook.
10-
* @param vars Variables of styleSheet function.
10+
* @param vars Variables of styleSheet function (optional).
1111
* @returns StyleSheet object.
1212
*/
13-
export const useStyles = <R, V>(
13+
// Overload: when vars is provided
14+
export function useStyles<R, V>(
1415
styleSheet: (params: { theme: Theme; vars: V }) => R,
1516
vars: V,
16-
): { styles: R; theme: Theme } => {
17+
): { styles: R; theme: Theme };
18+
19+
// Overload: when vars is not provided
20+
export function useStyles<R>(styleSheet: (params: { theme: Theme }) => R): {
21+
styles: R;
22+
theme: Theme;
23+
};
24+
25+
export function useStyles<R, V>(
26+
styleSheet:
27+
| ((params: { theme: Theme; vars: V }) => R)
28+
| ((params: { theme: Theme }) => R),
29+
vars?: V,
30+
): { styles: R; theme: Theme } {
1731
const theme = useAppThemeFromContext();
1832
const styles = useMemo(
19-
() => styleSheet({ theme, vars }),
33+
() => styleSheet({ theme, vars: vars as V }),
2034
[styleSheet, theme, vars],
2135
);
2236
return { styles, theme };
23-
};
37+
}

app/components/Nav/App/App.test.tsx

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { internalAccount1 as mockAccount } from '../../../util/test/accountsCont
3030
import { KeyringTypes } from '@metamask/keyring-controller';
3131
import { AccountDetailsIds } from '../../../../e2e/selectors/MultichainAccounts/AccountDetails.selectors';
3232
import { AvatarAccountType } from '../../../component-library/components/Avatars/Avatar';
33+
import AUTHENTICATION_TYPE from '../../../constants/userProperties';
3334
import { useOTAUpdates } from '../../hooks/useOTAUpdates';
3435

3536
const initialState: DeepPartial<RootState> = {
@@ -161,12 +162,16 @@ const mockMetrics = {
161162
addTraitsToUser: jest.fn(),
162163
};
163164

165+
const mockAuthType = AUTHENTICATION_TYPE.BIOMETRIC;
164166
// Mock Authentication module
165167
jest.mock('../../../core', () => ({
166168
Authentication: {
167169
appTriggeredAuth: jest.fn().mockResolvedValue(undefined),
168170
lockApp: jest.fn(),
169171
checkIsSeedlessPasswordOutdated: jest.fn(),
172+
getType: jest.fn().mockResolvedValue({
173+
currentAuthType: mockAuthType,
174+
}),
170175
},
171176
}));
172177

@@ -350,6 +355,46 @@ describe('App', () => {
350355
});
351356
});
352357

358+
it('navigates to login screen when authentication type is password', async () => {
359+
const mockRoutesOther = [
360+
{ name: 'SomeOtherRoute' },
361+
{ name: 'AnotherRoute' },
362+
];
363+
jest
364+
.spyOn(NavigationNative, 'useNavigationState')
365+
.mockImplementation((selector: unknown) =>
366+
(selector as (state: { routes: { name: string }[] }) => unknown)({
367+
routes: mockRoutesOther,
368+
}),
369+
);
370+
jest.spyOn(StorageWrapper, 'getItem').mockResolvedValue(true);
371+
jest.spyOn(Authentication, 'getType').mockResolvedValue({
372+
currentAuthType: AUTHENTICATION_TYPE.PASSWORD,
373+
});
374+
375+
const loggedInState = {
376+
...initialState,
377+
user: {
378+
...initialState.user,
379+
existingUser: true,
380+
userLoggedIn: true,
381+
},
382+
};
383+
384+
renderScreen(App, { name: 'App' }, { state: loggedInState });
385+
386+
await waitFor(() => {
387+
expect(mockReset).toHaveBeenCalledWith({
388+
routes: [{ name: Routes.ONBOARDING.LOGIN }],
389+
});
390+
expect(Authentication.appTriggeredAuth).not.toHaveBeenCalled();
391+
});
392+
393+
jest.spyOn(Authentication, 'getType').mockResolvedValue({
394+
currentAuthType: AUTHENTICATION_TYPE.BIOMETRIC,
395+
});
396+
});
397+
353398
it('navigates to onboarding when user does not exist', async () => {
354399
renderScreen(
355400
App,
@@ -890,7 +935,7 @@ describe('App', () => {
890935
});
891936
});
892937

893-
it('should use useNavigation.reset with correct parameters for optin metrics navigation', async () => {
938+
it('use useNavigation.reset with correct parameters for optin metrics navigation', async () => {
894939
jest.spyOn(StorageWrapper, 'getItem').mockImplementation(async (key) => {
895940
if (key === OPTIN_META_METRICS_UI_SEEN) {
896941
return false; // OptinMetrics UI has not been seen
@@ -965,7 +1010,27 @@ describe('App', () => {
9651010
const { getByTestId } = renderAppWithRouteState(routeState);
9661011

9671012
await waitFor(() => {
968-
expect(getByTestId('eligibility-failed-modal')).toBeTruthy();
1013+
expect(getByTestId('eligibility-failed-modal')).toBeOnTheScreen();
1014+
});
1015+
});
1016+
1017+
it('registers the ramp unsupported modal route', async () => {
1018+
const routeState = {
1019+
index: 0,
1020+
routes: [
1021+
{
1022+
name: Routes.MODAL.ROOT_MODAL_FLOW,
1023+
params: {
1024+
screen: Routes.SHEET.UNSUPPORTED_REGION_MODAL,
1025+
},
1026+
},
1027+
],
1028+
};
1029+
1030+
const { getByTestId } = renderAppWithRouteState(routeState);
1031+
1032+
await waitFor(() => {
1033+
expect(getByTestId('ramp-unsupported-modal')).toBeOnTheScreen();
9691034
});
9701035
});
9711036
});

0 commit comments

Comments
 (0)