Skip to content

Commit

Permalink
temp+fix: fix token list on network rpc selection (#13097)
Browse files Browse the repository at this point in the history
## **Description**

When the user adds multiple RPCs for a certain network and switch
between networks by clicking on the RPC link; the tokenList does not
update correctly

## **Related issues**

Fixes: #13091

## **Manual testing steps**

1. Click on Network filter
2. Add new RPC for a network
3. Switch back and forth between networks by clicking on the rpc link
4. You should see correct tokenList

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->
Checkout video in the linked issue 🙏 

### **After**

<!-- [screenshots/recordings] -->


https://github.com/user-attachments/assets/aff21d16-db9d-4c1e-9150-bf9176f89846


## **Pre-merge author checklist**

- [ ] 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).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] 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 Jan 22, 2025
1 parent 8dacf7b commit 8622933
Show file tree
Hide file tree
Showing 44 changed files with 246 additions and 1,505 deletions.
145 changes: 115 additions & 30 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ As an external contributor, you need to provide your own Firebase project config
export GOOGLE_SERVICES_B64_ANDROID="$(base64 -w0 -i ./android/app/google-services.json)" && echo "export GOOGLE_SERVICES_B64_ANDROID=\"$GOOGLE_SERVICES_B64_ANDROID\"" | tee -a .js.env

# Generate IOS Base64 Version of Google Services
export GOOGLE_SERVICES_B64_IOS="$(base64 -w0 -i ./ios/GoogleServices/GoogleService-Info.plist)" && echo "export GOOGLE_SERVICES_B64_IOS=\"$GOOGLE_SERVICES_B64_IOS\"" | tee -a .js.env
export GOOGLE_SERVICES_B64_IOS="$(base64 -w0 -i ./ios/GoogleServices/GoogleService-Info-example.plist)" && echo "export GOOGLE_SERVICES_B64_IOS=\"$GOOGLE_SERVICES_B64_IOS\"" | tee -a .js.env
```

[!CAUTION]
Expand Down
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.37.1"
versionCode 1520
versionName "7.39.0"
versionCode 1529
testBuildType System.getProperty('testBuildType', 'debug')
missingDimensionStrategy 'react-native-camera', 'general'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
5 changes: 1 addition & 4 deletions app/components/UI/Navbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -601,9 +601,7 @@ export function getSendFlowTitle(
canGoBack ? (
// eslint-disable-next-line react/jsx-no-bind
<TouchableOpacity onPress={leftAction} style={styles.closeButton}>
<Text style={innerStyles.headerButtonText}
testID={SendViewSelectorsIDs.SEND_BACK_BUTTON}
>
<Text style={innerStyles.headerButtonText}>
{strings('transaction.back')}
</Text>
</TouchableOpacity>
Expand Down Expand Up @@ -717,7 +715,6 @@ export function getOnboardingNavbarOptions(
source={metamask_name}
style={innerStyles.metamaskName}
resizeMethod={'auto'}

/>
</View>
),
Expand Down
55 changes: 27 additions & 28 deletions app/components/UI/OptinMetrics/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,38 +337,23 @@ class OptinMetrics extends PureComponent {
isDataCollectionForMarketingEnabled,
setDataCollectionForMarketing,
} = this.props;

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

await metrics.enable();
InteractionManager.runAfterInteractions(async () => {
// add traits to user for identification

// Track the analytics preference event first
metrics.trackEvent(
metrics
.createEventBuilder(MetaMetricsEvents.ANALYTICS_PREFERENCE_SELECTED)
.addProperties({
...dataCollectionForMarketingTraits,
is_metrics_opted_in: true,
location: 'onboarding_metametrics',
updated_after_onboarding: false,
})
.build(),
);
if (
isDataCollectionForMarketingEnabled === null &&
setDataCollectionForMarketing
) {
setDataCollectionForMarketing(false);
}

// Handle null case for marketing consent
if (
isDataCollectionForMarketingEnabled === null &&
setDataCollectionForMarketing
) {
setDataCollectionForMarketing(false);
}
// trait indicating if user opts in for data collection for marketing
let dataCollectionForMarketingTraits;
if (this.props.isDataCollectionForMarketingEnabled) {
dataCollectionForMarketingTraits = { has_marketing_consent: true };
}

InteractionManager.runAfterInteractions(async () => {
// consolidate device and user settings traits
const consolidatedTraits = {
...dataCollectionForMarketingTraits,
Expand Down Expand Up @@ -396,7 +381,21 @@ class OptinMetrics extends PureComponent {
delay += eventTrackingDelay;
});
}

this.props.clearOnboardingEvents();

// track event for user opting in on metrics and data collection for marketing
metrics.trackEvent(
metrics
.createEventBuilder(MetaMetricsEvents.ANALYTICS_PREFERENCE_SELECTED)
.addProperties({
...dataCollectionForMarketingTraits,
is_metrics_opted_in: true,
location: 'onboarding_metametrics',
updated_after_onboarding: false,
})
.build(),
);
});
this.continue();
};
Expand Down
2 changes: 0 additions & 2 deletions app/components/UI/OptinMetrics/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ describe('OptinMetrics', () => {
MetaMetricsEvents.ANALYTICS_PREFERENCE_SELECTED,
)
.addProperties({
has_marketing_consent: false,
is_metrics_opted_in: true,
location: 'onboarding_metametrics',
updated_after_onboarding: false,
Expand All @@ -76,7 +75,6 @@ describe('OptinMetrics', () => {
deviceProp: 'Device value',
userProp: 'User value',
is_metrics_opted_in: true,
has_marketing_consent: false,
});
});
});
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 8622933

Please sign in to comment.