Skip to content

Commit f659a33

Browse files
committed
Merge branch 'main' into fix/duplicate-key-error-privacy-settings-chainId
2 parents eea6882 + cee6f4a commit f659a33

File tree

11 files changed

+107
-34
lines changed

11 files changed

+107
-34
lines changed

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
57afe4ca921d85a51a923470239ca977fccbd1ae
33
# Standardize prettier configuration https://github.com/MetaMask/metamask-mobile/pull/4182
44
bdb7f37c90e4fc923881a07fca38d4e77c73a579
5+
# Fix mixed tabs and spaces https://github.com/MetaMask/metamask-mobile/pull/1379
6+
9f9a1121c6899e06d4aeef29017bb479df142adb

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Current Main Branch
44

5-
## 7.32.0 - Sep 19, 2024
5+
## 7.32.0 - Oct 7, 2024
66

77
### Added
88

@@ -91,6 +91,9 @@
9191
- [#11193](https://github.com/MetaMask/metamask-mobile/pull/11193): fix: ItemMenu crash using dayjs (#11193)
9292
- [#11098](https://github.com/MetaMask/metamask-mobile/pull/11098): fix: badge count and ui polishing (#11098)
9393

94+
## 7.31.1 - Oct 4, 2024
95+
### Fixed
96+
- [#11631](https://github.com/MetaMask/metamask-mobile/pull/11631): fix: Fixes UI issue in token details (#11631)
9497

9598
## 7.31.0 - Sep 6, 2024
9699
### Added

android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ android {
173173
applicationId "io.metamask"
174174
minSdkVersion rootProject.ext.minSdkVersion
175175
targetSdkVersion rootProject.ext.targetSdkVersion
176-
versionCode 1444
176+
versionCode 1450
177177
versionName "7.32.0"
178178
testBuildType System.getProperty('testBuildType', 'debug')
179179
missingDimensionStrategy 'react-native-camera', 'general'

app/components/Nav/Main/index.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,6 @@ const Main = (props) => {
113113
useEnableAutomaticSecurityChecks();
114114
useMinimumVersions();
115115

116-
117-
118-
119116
useEffect(() => {
120117
if (DEPRECATED_NETWORKS.includes(props.chainId)) {
121118
setShowDeprecatedAlert(true);
@@ -268,7 +265,6 @@ const Main = (props) => {
268265
initForceReload();
269266
return;
270267
}
271-
272268
});
273269

274270
// Remove all notifications that aren't visible
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import { renderHook } from '@testing-library/react-hooks';
2+
import { useSelector } from 'react-redux';
3+
import { useNavigation } from '@react-navigation/native';
4+
import { getBuildNumber } from 'react-native-device-info';
5+
import useMinimumVersions from './useMinimumVersions';
6+
7+
jest.mock('react-redux', () => ({
8+
useSelector: jest.fn(),
9+
}));
10+
11+
jest.mock('@react-navigation/native', () => ({
12+
useNavigation: jest.fn(),
13+
}));
14+
15+
jest.mock('react-native-device-info', () => ({
16+
getBuildNumber: jest.fn(),
17+
}));
18+
19+
jest.mock('react-native', () => ({
20+
InteractionManager: {
21+
runAfterInteractions: jest.fn((callback) => callback()),
22+
},
23+
}));
24+
25+
jest.mock('../../UI/UpdateNeeded/UpdateNeeded', () => ({
26+
createUpdateNeededNavDetails: jest.fn(),
27+
}));
28+
29+
describe('useMinimumVersions', () => {
30+
const mockNavigation = {
31+
navigate: jest.fn(),
32+
};
33+
34+
beforeEach(() => {
35+
jest.clearAllMocks();
36+
(useNavigation as jest.Mock).mockReturnValue(mockNavigation);
37+
});
38+
39+
it('requires update only if automaticSecurityChecksEnabled', () => {
40+
(useSelector as jest.Mock).mockImplementation(() => ({
41+
security: { automaticSecurityChecksEnabled: false },
42+
featureFlags: {
43+
featureFlags: { mobileMinimumVersions: { appMinimumBuild: 100 } },
44+
},
45+
}));
46+
47+
(getBuildNumber as jest.Mock).mockReturnValue('101');
48+
49+
renderHook(() => useMinimumVersions());
50+
51+
expect(mockNavigation.navigate).not.toHaveBeenCalled();
52+
});
53+
54+
it('requires update only if currentBuildNumber is lower than appMinimumBuild', () => {
55+
(useSelector as jest.Mock).mockImplementation(() => ({
56+
security: { automaticSecurityChecksEnabled: true },
57+
featureFlags: {
58+
featureFlags: { mobileMinimumVersions: { appMinimumBuild: 100 } },
59+
},
60+
}));
61+
62+
(getBuildNumber as jest.Mock).mockReturnValue('101');
63+
64+
renderHook(() => useMinimumVersions());
65+
66+
expect(mockNavigation.navigate).not.toHaveBeenCalled();
67+
});
68+
});

app/components/hooks/MinimumVersions/useMinimumVersions.tsx

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,25 @@
1-
import { useEffect, useMemo } from 'react';
1+
import { useEffect } from 'react';
22
import { getBuildNumber } from 'react-native-device-info';
3-
import { useAppConfig } from '../AppConfig';
43
import { createUpdateNeededNavDetails } from '../../UI/UpdateNeeded/UpdateNeeded';
54
import { useSelector } from 'react-redux';
65
import { useNavigation } from '@react-navigation/native';
76
import { InteractionManager } from 'react-native';
7+
import { FeatureFlagsState } from '../../../core/redux/slices/featureFlags';
8+
import { SecurityState } from '../../../../app/reducers/security';
9+
import { RootState } from '../../../../app/reducers';
810

911
const useMinimumVersions = () => {
10-
const allowAutomaticSecurityChecks = useSelector(
11-
// TODO: Replace "any" with type
12-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
13-
(state: any) => state.security.automaticSecurityChecksEnabled,
12+
const { automaticSecurityChecksEnabled }: SecurityState = useSelector(
13+
(state: RootState) => state.security,
14+
);
15+
const { featureFlags }: FeatureFlagsState = useSelector(
16+
(state: RootState) => state.featureFlags,
1417
);
15-
const minimumValues = useAppConfig(allowAutomaticSecurityChecks);
1618
const currentBuildNumber = Number(getBuildNumber());
1719
const navigation = useNavigation();
18-
const shouldTriggerUpdateFlow = useMemo(
19-
() =>
20-
!!(
21-
allowAutomaticSecurityChecks &&
22-
minimumValues.data &&
23-
minimumValues.data.security.minimumVersions.appMinimumBuild >
24-
currentBuildNumber
25-
),
26-
[allowAutomaticSecurityChecks, currentBuildNumber, minimumValues.data],
27-
);
20+
const shouldTriggerUpdateFlow =
21+
automaticSecurityChecksEnabled &&
22+
featureFlags?.mobileMinimumVersions?.appMinimumBuild > currentBuildNumber;
2823

2924
useEffect(() => {
3025
if (shouldTriggerUpdateFlow) {

app/core/AppConstants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export default {
212212
'config-api.metamask.io/featureFlags',
213213
],
214214
FEATURE_FLAGS_API: {
215-
BASE_URL: 'https://client-config.api.cx.metamask.io/',
215+
BASE_URL: 'https://client-config.api.cx.metamask.io',
216216
VERSION: 'v1',
217217
},
218218
} as const;

app/reducers/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import infuraAvailabilityReducer from './infuraAvailability';
2121
import collectiblesReducer from './collectibles';
2222
import navigationReducer from './navigation';
2323
import networkOnboardReducer from './networkSelector';
24-
import securityReducer from './security';
24+
import securityReducer, { SecurityState } from './security';
2525
import { combineReducers, Reducer } from 'redux';
2626
import experimentalSettingsReducer from './experimentalSettings';
2727
import { EngineState } from '../core/Engine';
@@ -106,7 +106,7 @@ export interface RootState {
106106
// TODO: Replace "any" with type
107107
// eslint-disable-next-line @typescript-eslint/no-explicit-any
108108
networkOnboarded: any;
109-
security: StateFromReducer<typeof securityReducer>;
109+
security: SecurityState;
110110
sdk: StateFromReducer<typeof sdkReducer>;
111111
// The experimentalSettings reducer is TypeScript but not yet a valid reducer
112112
// TODO: Replace "any" with type

app/reducers/security/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
import { ActionType, Action } from '../../actions/security';
33
import { SecuritySettingsState } from '../../actions/security/state';
44

5+
export interface SecurityState {
6+
allowLoginWithRememberMe: boolean;
7+
automaticSecurityChecksEnabled: boolean;
8+
hasUserSelectedAutomaticSecurityCheckOption: boolean;
9+
isAutomaticSecurityChecksModalOpen: boolean;
10+
dataCollectionForMarketing: boolean | null;
11+
isNFTAutoDetectionModalViewed: boolean;
12+
}
13+
514
export const initialState: Readonly<SecuritySettingsState> = {
615
allowLoginWithRememberMe: false,
716
automaticSecurityChecksEnabled: false,

bitrise.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,13 +1500,13 @@ app:
15001500
VERSION_NAME: 7.32.0
15011501
- opts:
15021502
is_expand: false
1503-
VERSION_NUMBER: 1444
1503+
VERSION_NUMBER: 1450
15041504
- opts:
15051505
is_expand: false
15061506
FLASK_VERSION_NAME: 7.32.0
15071507
- opts:
15081508
is_expand: false
1509-
FLASK_VERSION_NUMBER: 1444
1509+
FLASK_VERSION_NUMBER: 1450
15101510
- opts:
15111511
is_expand: false
15121512
ANDROID_APK_LINK: ''

0 commit comments

Comments
 (0)