Skip to content

Commit 056b0da

Browse files
temp+fix: fiat estimates disabled in send flow (#13359)
## **Description** Use global chain in send amount page as no transaction state available. ## **Related issues** Fixes: #13287 ## **Manual testing steps** ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
1 parent af94ad0 commit 056b0da

File tree

148 files changed

+1852
-12375
lines changed

Some content is hidden

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

148 files changed

+1852
-12375
lines changed

.github/CODEOWNERS

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,12 @@ app/components/UI/Swaps @MetaMask/swaps-engineers
5656
# Notifications Team
5757
app/components/Views/Notifications @MetaMask/notifications
5858
app/components/Views/Settings/NotificationsSettings @MetaMask/notifications
59-
**/Notifications/** @MetaMask/notifications
60-
**/Notification/** @MetaMask/notifications
61-
**/notifications/** @MetaMask/notifications
62-
**/notification/** @MetaMask/notifications
59+
app/components/UI/Notifications @MetaMask/notifications
60+
app/reducers/notification @MetaMask/notifications
61+
app/actions/notification @MetaMask/notifications
62+
app/selectors/notification @MetaMask/notifications
63+
app/util/notifications @MetaMask/notifications
64+
app/store/util/notifications @MetaMask/notifications
6365

6466
# Identity Team
6567
app/actions/identity @MetaMask/identity

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

Lines changed: 0 additions & 35 deletions
This file was deleted.

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,3 @@ android/app/src/main/assets/modules.json
136136
.expo
137137
dist/
138138
web-build/
139-
140-
# CICD
141-
github-tools/

.js.env.example

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,3 @@ export MM_PERMISSIONS_SETTINGS_V1_ENABLED=""
113113

114114
# Feature flag for Stablecoin Lending UI
115115
export MM_STABLECOIN_LENDING_UI_ENABLED="true"
116-
117-
# Activates remote feature flag override mode.
118-
# Remote feature flag values won't be updated,
119-
# and selectors should return their fallback values
120-
export OVERRIDE_REMOTE_FEATURE_FLAGS="false"

CHANGELOG.md

Lines changed: 458 additions & 701 deletions
Large diffs are not rendered by default.

android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ android {
178178
applicationId "io.metamask"
179179
minSdkVersion rootProject.ext.minSdkVersion
180180
targetSdkVersion rootProject.ext.targetSdkVersion
181-
versionName "7.38.1"
182-
versionCode 1533
181+
versionName "7.40.0"
182+
versionCode 1547
183183
testBuildType System.getProperty('testBuildType', 'debug')
184184
missingDimensionStrategy 'react-native-camera', 'general'
185185
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

app/components/Nav/App/index.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ import SDKSessionModal from '../../Views/SDK/SDKSessionModal/SDKSessionModal';
109109
import ExperienceEnhancerModal from '../../../../app/components/Views/ExperienceEnhancerModal';
110110
import { MetaMetrics } from '../../../core/Analytics';
111111
import trackErrorAsAnalytics from '../../../util/metrics/TrackError/trackErrorAsAnalytics';
112+
import generateDeviceAnalyticsMetaData from '../../../util/metrics/DeviceAnalyticsMetaData/generateDeviceAnalyticsMetaData';
113+
import generateUserSettingsAnalyticsMetaData from '../../../util/metrics/UserSettingsAnalyticsMetaData/generateUserProfileAnalyticsMetaData';
112114
import LedgerSelectAccount from '../../Views/LedgerSelectAccount';
113115
import OnboardingSuccess from '../../Views/OnboardingSuccess';
114116
import DefaultSettings from '../../Views/OnboardingSuccess/DefaultSettings';
@@ -743,7 +745,15 @@ const App = (props) => {
743745

744746
useEffect(() => {
745747
const initMetrics = async () => {
746-
await MetaMetrics.getInstance().configure();
748+
const metrics = MetaMetrics.getInstance();
749+
await metrics.configure();
750+
// identify user with the latest traits
751+
// run only after the MetaMetrics is configured
752+
const consolidatedTraits = {
753+
...generateDeviceAnalyticsMetaData(),
754+
...generateUserSettingsAnalyticsMetaData(),
755+
};
756+
await metrics.addTraitsToUser(consolidatedTraits);
747757
};
748758

749759
initMetrics().catch((err) => {

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ describe('App', () => {
6161
);
6262
await waitFor(() => {
6363
expect(mockMetrics.configure).toHaveBeenCalledTimes(1);
64+
expect(mockMetrics.addTraitsToUser).toHaveBeenNthCalledWith(1, {
65+
deviceProp: 'Device value',
66+
userProp: 'User value',
67+
});
6468
});
6569
});
6670
});

app/components/UI/AssetOverview/Balance/Balance.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ import { useStyles } from '../../../../component-library/hooks';
66
import styleSheet from './Balance.styles';
77
import AssetElement from '../../AssetElement';
88
import { useSelector } from 'react-redux';
9-
import {
10-
selectChainId,
11-
selectNetworkConfigurationByChainId,
12-
} from '../../../../selectors/networkController';
9+
import { selectNetworkName } from '../../../../selectors/networkInfos';
10+
import { selectChainId } from '../../../../selectors/networkController';
1311
import {
1412
getTestNetImageByChainId,
1513
getDefaultNetworkByChainId,
@@ -37,7 +35,6 @@ import {
3735
UnpopularNetworkList,
3836
CustomNetworkImgMapping,
3937
} from '../../../../util/networks/customNetworks';
40-
import { RootState } from '../../../../reducers';
4138

4239
interface BalanceProps {
4340
asset: TokenI;
@@ -94,9 +91,7 @@ export const NetworkBadgeSource = (chainId: Hex, ticker: string) => {
9491
const Balance = ({ asset, mainBalance, secondaryBalance }: BalanceProps) => {
9592
const { styles } = useStyles(styleSheet, {});
9693
const navigation = useNavigation();
97-
const networkConfigurationByChainId = useSelector((state: RootState) =>
98-
selectNetworkConfigurationByChainId(state, asset.chainId as Hex),
99-
);
94+
const networkName = useSelector(selectNetworkName);
10095
const chainId = useSelector(selectChainId);
10196

10297
const tokenChainId = isPortfolioViewEnabled() ? asset.chainId : chainId;
@@ -161,7 +156,7 @@ const Balance = ({ asset, mainBalance, secondaryBalance }: BalanceProps) => {
161156
<Badge
162157
variant={BadgeVariant.Network}
163158
imageSource={NetworkBadgeSource(tokenChainId as Hex, ticker)}
164-
name={networkConfigurationByChainId?.name}
159+
name={networkName || ''}
165160
/>
166161
}
167162
>

app/components/UI/OptinMetrics/index.js

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ import Routes from '../../../constants/navigation/Routes';
4040
import generateDeviceAnalyticsMetaData, {
4141
UserSettingsAnalyticsMetaData as generateUserSettingsAnalyticsMetaData,
4242
} from '../../../util/metrics';
43-
import {
44-
UserProfileProperty
45-
} from '../../../util/metrics/UserSettingsAnalyticsMetaData/UserProfileAnalyticsMetaData.types';
4643

4744
const createStyles = ({ colors }) =>
4845
StyleSheet.create({
@@ -341,33 +338,44 @@ class OptinMetrics extends PureComponent {
341338
setDataCollectionForMarketing,
342339
} = this.props;
343340

344-
await metrics.enable();
341+
// Set marketing consent trait based on user selection
342+
const dataCollectionForMarketingTraits = {
343+
has_marketing_consent: Boolean(
344+
this.props.isDataCollectionForMarketingEnabled,
345+
),
346+
};
345347

346-
// Handle null case for marketing consent
347-
if (
348-
isDataCollectionForMarketingEnabled === null &&
349-
setDataCollectionForMarketing
350-
) {
351-
setDataCollectionForMarketing(false);
352-
}
348+
await metrics.enable();
353349

354350
// Track the analytics preference event first
355351
metrics.trackEvent(
356352
metrics
357353
.createEventBuilder(MetaMetricsEvents.ANALYTICS_PREFERENCE_SELECTED)
358354
.addProperties({
359-
[UserProfileProperty.HAS_MARKETING_CONSENT]: Boolean( isDataCollectionForMarketingEnabled ),
360-
is_metrics_opted_in: true,
361-
location: 'onboarding_metametrics',
362-
updated_after_onboarding: false,
355+
...dataCollectionForMarketingTraits,
356+
is_metrics_opted_in: true,
357+
location: 'onboarding_metametrics',
358+
updated_after_onboarding: false,
363359
})
364360
.build(),
365361
);
366362

367-
await metrics.addTraitsToUser({
368-
...generateDeviceAnalyticsMetaData(),
369-
...generateUserSettingsAnalyticsMetaData(),
370-
});
363+
// Handle null case for marketing consent
364+
if (
365+
isDataCollectionForMarketingEnabled === null &&
366+
setDataCollectionForMarketing
367+
) {
368+
setDataCollectionForMarketing(false);
369+
}
370+
371+
// consolidate device and user settings traits
372+
const consolidatedTraits = {
373+
...dataCollectionForMarketingTraits,
374+
is_metrics_opted_in: true,
375+
...generateDeviceAnalyticsMetaData(),
376+
...generateUserSettingsAnalyticsMetaData(),
377+
};
378+
await metrics.addTraitsToUser(consolidatedTraits);
371379

372380
// track onboarding events that were stored before user opted in
373381
// only if the user eventually opts in.

app/components/UI/OptinMetrics/index.test.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ describe('OptinMetrics', () => {
7575
expect(mockMetrics.addTraitsToUser).toHaveBeenNthCalledWith(1, {
7676
deviceProp: 'Device value',
7777
userProp: 'User value',
78+
is_metrics_opted_in: true,
79+
has_marketing_consent: false,
7880
});
7981
});
8082
});
@@ -104,6 +106,8 @@ describe('OptinMetrics', () => {
104106
expect(mockMetrics.addTraitsToUser).toHaveBeenNthCalledWith(1, {
105107
deviceProp: 'Device value',
106108
userProp: 'User value',
109+
is_metrics_opted_in: true,
110+
has_marketing_consent: true,
107111
});
108112
});
109113
});

app/components/UI/Stake/Views/StakeEarningsHistoryView/StakeEarningsHistoryView.styles.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

app/components/UI/Stake/Views/StakeEarningsHistoryView/StakeEarningsHistoryView.test.tsx

Lines changed: 0 additions & 107 deletions
This file was deleted.

0 commit comments

Comments
 (0)