Skip to content

Commit

Permalink
temp+fix: fiat estimates disabled in send flow (#13359)
Browse files Browse the repository at this point in the history
## **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.
  • Loading branch information
runway-github[bot] authored Feb 5, 2025
1 parent af94ad0 commit 056b0da
Show file tree
Hide file tree
Showing 148 changed files with 1,852 additions and 12,375 deletions.
10 changes: 6 additions & 4 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ app/components/UI/Swaps @MetaMask/swaps-engineers
# Notifications Team
app/components/Views/Notifications @MetaMask/notifications
app/components/Views/Settings/NotificationsSettings @MetaMask/notifications
**/Notifications/** @MetaMask/notifications
**/Notification/** @MetaMask/notifications
**/notifications/** @MetaMask/notifications
**/notification/** @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

# Identity Team
app/actions/identity @MetaMask/identity
Expand Down
35 changes: 0 additions & 35 deletions .github/workflows/create-release-pr-v2.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,3 @@ android/app/src/main/assets/modules.json
.expo
dist/
web-build/

# CICD
github-tools/
5 changes: 0 additions & 5 deletions .js.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,3 @@ export MM_PERMISSIONS_SETTINGS_V1_ENABLED=""

# Feature flag for Stablecoin Lending UI
export MM_STABLECOIN_LENDING_UI_ENABLED="true"

# Activates remote feature flag override mode.
# Remote feature flag values won't be updated,
# and selectors should return their fallback values
export OVERRIDE_REMOTE_FEATURE_FLAGS="false"
1,159 changes: 458 additions & 701 deletions CHANGELOG.md

Large diffs are not rendered by default.

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.38.1"
versionCode 1533
versionName "7.40.0"
versionCode 1547
testBuildType System.getProperty('testBuildType', 'debug')
missingDimensionStrategy 'react-native-camera', 'general'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
12 changes: 11 additions & 1 deletion app/components/Nav/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ import SDKSessionModal from '../../Views/SDK/SDKSessionModal/SDKSessionModal';
import ExperienceEnhancerModal from '../../../../app/components/Views/ExperienceEnhancerModal';
import { MetaMetrics } from '../../../core/Analytics';
import trackErrorAsAnalytics from '../../../util/metrics/TrackError/trackErrorAsAnalytics';
import generateDeviceAnalyticsMetaData from '../../../util/metrics/DeviceAnalyticsMetaData/generateDeviceAnalyticsMetaData';
import generateUserSettingsAnalyticsMetaData from '../../../util/metrics/UserSettingsAnalyticsMetaData/generateUserProfileAnalyticsMetaData';
import LedgerSelectAccount from '../../Views/LedgerSelectAccount';
import OnboardingSuccess from '../../Views/OnboardingSuccess';
import DefaultSettings from '../../Views/OnboardingSuccess/DefaultSettings';
Expand Down Expand Up @@ -743,7 +745,15 @@ const App = (props) => {

useEffect(() => {
const initMetrics = async () => {
await MetaMetrics.getInstance().configure();
const metrics = MetaMetrics.getInstance();
await metrics.configure();
// identify user with the latest traits
// run only after the MetaMetrics is configured
const consolidatedTraits = {
...generateDeviceAnalyticsMetaData(),
...generateUserSettingsAnalyticsMetaData(),
};
await metrics.addTraitsToUser(consolidatedTraits);
};

initMetrics().catch((err) => {
Expand Down
4 changes: 4 additions & 0 deletions app/components/Nav/App/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ describe('App', () => {
);
await waitFor(() => {
expect(mockMetrics.configure).toHaveBeenCalledTimes(1);
expect(mockMetrics.addTraitsToUser).toHaveBeenNthCalledWith(1, {
deviceProp: 'Device value',
userProp: 'User value',
});
});
});
});
13 changes: 4 additions & 9 deletions app/components/UI/AssetOverview/Balance/Balance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ import { useStyles } from '../../../../component-library/hooks';
import styleSheet from './Balance.styles';
import AssetElement from '../../AssetElement';
import { useSelector } from 'react-redux';
import {
selectChainId,
selectNetworkConfigurationByChainId,
} from '../../../../selectors/networkController';
import { selectNetworkName } from '../../../../selectors/networkInfos';
import { selectChainId } from '../../../../selectors/networkController';
import {
getTestNetImageByChainId,
getDefaultNetworkByChainId,
Expand Down Expand Up @@ -37,7 +35,6 @@ import {
UnpopularNetworkList,
CustomNetworkImgMapping,
} from '../../../../util/networks/customNetworks';
import { RootState } from '../../../../reducers';

interface BalanceProps {
asset: TokenI;
Expand Down Expand Up @@ -94,9 +91,7 @@ export const NetworkBadgeSource = (chainId: Hex, ticker: string) => {
const Balance = ({ asset, mainBalance, secondaryBalance }: BalanceProps) => {
const { styles } = useStyles(styleSheet, {});
const navigation = useNavigation();
const networkConfigurationByChainId = useSelector((state: RootState) =>
selectNetworkConfigurationByChainId(state, asset.chainId as Hex),
);
const networkName = useSelector(selectNetworkName);
const chainId = useSelector(selectChainId);

const tokenChainId = isPortfolioViewEnabled() ? asset.chainId : chainId;
Expand Down Expand Up @@ -161,7 +156,7 @@ const Balance = ({ asset, mainBalance, secondaryBalance }: BalanceProps) => {
<Badge
variant={BadgeVariant.Network}
imageSource={NetworkBadgeSource(tokenChainId as Hex, ticker)}
name={networkConfigurationByChainId?.name}
name={networkName || ''}
/>
}
>
Expand Down
46 changes: 27 additions & 19 deletions app/components/UI/OptinMetrics/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ import Routes from '../../../constants/navigation/Routes';
import generateDeviceAnalyticsMetaData, {
UserSettingsAnalyticsMetaData as generateUserSettingsAnalyticsMetaData,
} from '../../../util/metrics';
import {
UserProfileProperty
} from '../../../util/metrics/UserSettingsAnalyticsMetaData/UserProfileAnalyticsMetaData.types';

const createStyles = ({ colors }) =>
StyleSheet.create({
Expand Down Expand Up @@ -341,33 +338,44 @@ class OptinMetrics extends PureComponent {
setDataCollectionForMarketing,
} = this.props;

await metrics.enable();
// Set marketing consent trait based on user selection
const dataCollectionForMarketingTraits = {
has_marketing_consent: Boolean(
this.props.isDataCollectionForMarketingEnabled,
),
};

// Handle null case for marketing consent
if (
isDataCollectionForMarketingEnabled === null &&
setDataCollectionForMarketing
) {
setDataCollectionForMarketing(false);
}
await metrics.enable();

// Track the analytics preference event first
metrics.trackEvent(
metrics
.createEventBuilder(MetaMetricsEvents.ANALYTICS_PREFERENCE_SELECTED)
.addProperties({
[UserProfileProperty.HAS_MARKETING_CONSENT]: Boolean( isDataCollectionForMarketingEnabled ),
is_metrics_opted_in: true,
location: 'onboarding_metametrics',
updated_after_onboarding: false,
...dataCollectionForMarketingTraits,
is_metrics_opted_in: true,
location: 'onboarding_metametrics',
updated_after_onboarding: false,
})
.build(),
);

await metrics.addTraitsToUser({
...generateDeviceAnalyticsMetaData(),
...generateUserSettingsAnalyticsMetaData(),
});
// Handle null case for marketing consent
if (
isDataCollectionForMarketingEnabled === null &&
setDataCollectionForMarketing
) {
setDataCollectionForMarketing(false);
}

// consolidate device and user settings traits
const consolidatedTraits = {
...dataCollectionForMarketingTraits,
is_metrics_opted_in: true,
...generateDeviceAnalyticsMetaData(),
...generateUserSettingsAnalyticsMetaData(),
};
await metrics.addTraitsToUser(consolidatedTraits);

// track onboarding events that were stored before user opted in
// only if the user eventually opts in.
Expand Down
4 changes: 4 additions & 0 deletions app/components/UI/OptinMetrics/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ describe('OptinMetrics', () => {
expect(mockMetrics.addTraitsToUser).toHaveBeenNthCalledWith(1, {
deviceProp: 'Device value',
userProp: 'User value',
is_metrics_opted_in: true,
has_marketing_consent: false,
});
});
});
Expand Down Expand Up @@ -104,6 +106,8 @@ describe('OptinMetrics', () => {
expect(mockMetrics.addTraitsToUser).toHaveBeenNthCalledWith(1, {
deviceProp: 'Device value',
userProp: 'User value',
is_metrics_opted_in: true,
has_marketing_consent: true,
});
});
});
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 056b0da

Please sign in to comment.