Skip to content

Commit

Permalink
Merge branch 'main' into STAKE-806--fe-integrate-stake-and-vault-data
Browse files Browse the repository at this point in the history
  • Loading branch information
amitabh94 authored Oct 23, 2024
2 parents 74be242 + a9fc0dd commit f5596eb
Show file tree
Hide file tree
Showing 33 changed files with 238 additions and 882 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,6 @@ app/util/termsOfUse/termsOfUseContent.ts
docs/assets/termsOfUse.html

/app/images/branding

# build metadata
android/app/src/main/assets/modules.json
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.12.2
20.14.0
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,12 @@ cd metamask-mobile

Before running the app, keep in mind that MetaMask uses FCM (Firebase Cloud Message) to empower communications. Based on this, as an external contributor you would preferably need to provide your own FREE Firebase project config file with a matching client for package name `io.metamask`, and update your `google-services.json` file in the `android/app` directory as well your `.env` files (`.ios.env`, `.js.env`, `.android.env`), adding `GOOGLE_SERVICES_B64` variable depending on the environment you are running the app (ios/android).

The value you should provide to `GOOGLE_SERVICES_B64` is the base64 encoded version of your Firebase project config file, which can be generated as follows:
ATTENTION: In case you don't provide your own Firebase project config file, you can make use of a mock file at `android/app/google-services-example.json`, following the steps below from the root of the project:

```bash
base64 -i ./android/app/google-services-example.json
echo "export GOOGLE_SERVICES_B64=\"$(base64 -w0 -i ./android/app/google-services-example.json)\"" | tee -a .js.env .ios.env .android.env
```

Copy the result to your clipboard and paste it in the `GOOGLE_SERVICES_B64` variable in the `.env` file you are running the app.

> [!CAUTION]
> In case you don't provide your own Firebase project config file, you will face the error `No matching client found for package name 'io.metamask'`.
You can make usage of a mock file at `android/app/google-services-example.json`, following the same steps above from the root of the project.

In case of any doubt, please follow the instructions in the link below to get your Firebase project config file.
Expand Down
32 changes: 26 additions & 6 deletions android/app/google-services-example.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
},
"client": [
{
"api_key": [
{
"current_key": ""
}
],
"api_key": [{ "current_key": "" }],
"client_info": {
"mobilesdk_app_id": "1:123456789000:android:f1bf012572b04063",
"client_id": "android:io.metamask",
Expand All @@ -21,7 +17,31 @@
"certificate_hash": []
}
}
},
{
"api_key": [{ "current_key": "" }],
"client_info": {
"mobilesdk_app_id": "1:123456789000:android:f1bf012572b04063",
"client_id": "android:io.metamask.qa",
"client_type": 1,
"android_client_info": {
"package_name": "io.metamask.qa",
"certificate_hash": []
}
}
},
{
"api_key": [{ "current_key": "" }],
"client_info": {
"mobilesdk_app_id": "1:123456789000:android:f1bf012572b04063",
"client_id": "android:io.metamask.flask",
"client_type": 1,
"android_client_info": {
"package_name": "io.metamask.flask",
"certificate_hash": []
}
}
}
],
"configuration_version": "1"
}
}
2 changes: 1 addition & 1 deletion app/components/UI/Swaps/QuotesView.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import PropTypes from 'prop-types';
import Eth from 'ethjs-query';
import Eth from '@metamask/ethjs-query';
import {
View,
StyleSheet,
Expand Down
4 changes: 3 additions & 1 deletion app/components/UI/Tokens/TokenList/TokenListFooter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
import { getDecimalChainId } from '../../../../../util/networks';
import { selectChainId } from '../../../../../selectors/networkController';
import { TokenI } from '../../types';
import { selectUseTokenDetection } from '../../../../../selectors/preferencesController';

interface TokenListFooterProps {
tokens: TokenI[];
Expand All @@ -45,6 +46,7 @@ export const TokenListFooter = ({
const [isNetworkRampSupported, isNativeTokenRampSupported] = useRampNetwork();

const detectedTokens = useSelector(selectDetectedTokens);
const isTokenDetectionEnabled = useSelector(selectUseTokenDetection);
const chainId = useSelector(selectChainId);

const styles = createStyles(colors);
Expand All @@ -68,7 +70,7 @@ export const TokenListFooter = ({
return (
<>
{/* renderTokensDetectedSection */}
{detectedTokens && (
{detectedTokens?.length !== 0 && isTokenDetectionEnabled && (
<TouchableOpacity
style={styles.tokensDetectedButton}
onPress={showDetectedTokens}
Expand Down
2 changes: 2 additions & 0 deletions app/components/UI/Tokens/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const initialState = {
iconUrl: '',
},
],
detectedTokens: [],
},
TokenRatesController: {
marketData: {
Expand Down Expand Up @@ -210,6 +211,7 @@ describe('Tokens', () => {
backgroundState: {
...backgroundState,
TokensController: {
detectedTokens: [],
tokens: [
{
name: 'Link',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,23 @@ exports[`DefaultSettings should render correctly 1`] = `
style={
{
"flex": 1,
"paddingHorizontal": 16,
"paddingTop": 16,
}
}
>
<View>
<Text
accessibilityRole="text"
<View
style={
{
"color": "#141618",
"fontFamily": "EuclidCircularB-Regular",
"fontSize": 14,
"fontWeight": "400",
"letterSpacing": 0,
"lineHeight": 22,
"paddingHorizontal": 16,
}
}
>
MetaMask uses default settings to best balance safety and ease of use. Change these settings to further increase your privacy.
<Text
accessibilityRole="text"
onPress={[Function]}
style={
{
"color": "#0376c9",
"color": "#141618",
"fontFamily": "EuclidCircularB-Regular",
"fontSize": 14,
"fontWeight": "400",
Expand All @@ -39,10 +30,26 @@ exports[`DefaultSettings should render correctly 1`] = `
}
}
>
Learn more about privacy best practices.
MetaMask uses default settings to best balance safety and ease of use. Change these settings to further increase your privacy.
<Text
accessibilityRole="text"
onPress={[Function]}
style={
{
"color": "#0376c9",
"fontFamily": "EuclidCircularB-Regular",
"fontSize": 14,
"fontWeight": "400",
"letterSpacing": 0,
"lineHeight": 22,
}
}
>
Learn more about privacy best practices.
</Text>
</Text>
</Text>
</View>
<TouchableOpacity
onPress={[Function]}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ const styleSheet = () =>
paddingHorizontal: 16,
paddingTop: 16,
},
scrollRoot: {
flex: 1,
paddingTop: 16,
},
textContainer: {
paddingHorizontal: 16,
},
});

export default styleSheet;
18 changes: 10 additions & 8 deletions app/components/Views/OnboardingSuccess/DefaultSettings/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { ScrollView, Linking } from 'react-native';
import { ScrollView, Linking, View } from 'react-native';
import { useNavigation } from '@react-navigation/native';
import { useOnboardingHeader } from '../../../hooks/useOnboardingHeader';
import { useStyles } from '../../../../component-library/hooks';
Expand All @@ -23,14 +23,16 @@ const DefaultSettings = () => {
};

return (
<ScrollView style={styles.root}>
<Text variant={TextVariant.BodyMD}>
{strings('default_settings.description')}
<Text color={TextColor.Info} onPress={handleLink}>
{' '}
{strings('default_settings.learn_more_about_privacy')}
<ScrollView style={styles.scrollRoot}>
<View style={styles.textContainer}>
<Text variant={TextVariant.BodyMD}>
{strings('default_settings.description')}
<Text color={TextColor.Info} onPress={handleLink}>
{' '}
{strings('default_settings.learn_more_about_privacy')}
</Text>
</Text>
</Text>
</View>
<SettingsDrawer
title={strings('default_settings.drawer_general_title')}
description={strings('default_settings.drawer_general_title_desc')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1674,7 +1674,7 @@ exports[`OnboardingAssetSettings should render correctly 1`] = `
}
}
>
We batch accounts and query Infura to responsively show your balances. If you turn this off, only active accounts will be queried. Some dApps won’t work unless you connect your wallet.
Get balance updates for all your accounts at once. Turning off this feature means others are less likely to associate one account with another.
</Text>
</View>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ exports[`OnboardingSuccess should render correctly 1`] = `
{
"alignItems": "center",
"flexDirection": "row",
"marginTop": 16,
},
{
"paddingTop": 10,
Expand Down
1 change: 1 addition & 0 deletions app/components/Views/OnboardingSuccess/index.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const styles = StyleSheet.create({
linkWrapper: {
flexDirection: 'row',
alignItems: 'center',
marginTop: 16,
},
footerText: {
fontSize: 12,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ exports[`BatchAccountBalanceSettings should render correctly 1`] = `
}
}
>
We batch accounts and query Infura to responsively show your balances. If you turn this off, only active accounts will be queried. Some dApps won’t work unless you connect your wallet.
Get balance updates for all your accounts at once. Turning off this feature means others are less likely to associate one account with another.
</Text>
</View>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -1501,7 +1501,7 @@ exports[`SecuritySettings should render correctly 1`] = `
}
}
>
We batch accounts and query Infura to responsively show your balances. If you turn this off, only active accounts will be queried. Some dApps won’t work unless you connect your wallet.
Get balance updates for all your accounts at once. Turning off this feature means others are less likely to associate one account with another.
</Text>
</View>
<View
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import { connect } from 'react-redux';
import { getSendFlowTitle } from '../../../../UI/Navbar';
import PropTypes from 'prop-types';
import Eth from 'ethjs-query';
import Eth from '@metamask/ethjs-query';
import {
renderFromWei,
renderFromTokenMinimalUnit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
Linking,
ScrollView,
} from 'react-native';
import Eth from 'ethjs-query';
import Eth from '@metamask/ethjs-query';
import ActionView, { ConfirmButtonState } from '../../../../UI/ActionView';
import PropTypes from 'prop-types';
import { getApproveNavbar } from '../../../../UI/Navbar';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Eth from '@metamask/ethjs-query';
import { withNavigation } from '@react-navigation/compat';
import Eth from 'ethjs-query';
import PropTypes from 'prop-types';
import React, { PureComponent } from 'react';
import { Animated, ScrollView, StyleSheet, View } from 'react-native';
Expand Down
1 change: 0 additions & 1 deletion app/core/Engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,6 @@ class Engine {
};

const approvalController = new ApprovalController({
// @ts-expect-error TODO: Resolve mismatch between base-controller versions.
messenger: this.controllerMessenger.getRestricted({
name: 'ApprovalController',
allowedEvents: [],
Expand Down
4 changes: 2 additions & 2 deletions app/lib/ens-ipfs/resolver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import namehash from 'eth-ens-namehash';
import Eth from 'ethjs-query';
import EthContract from 'ethjs-contract';
import Eth from '@metamask/ethjs-query';
import EthContract from '@metamask/ethjs-contract';
import registryAbi from './contracts/registry';
import resolverAbi from './contracts/resolver';
import contentHash from 'content-hash';
Expand Down
2 changes: 1 addition & 1 deletion app/util/number/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import { BN, stripHexPrefix } from 'ethereumjs-util';
import { utils as ethersUtils } from 'ethers';
import convert from 'ethjs-unit';
import convert from '@metamask/ethjs-unit';
import {
BNToHex,
hexToBN as controllerHexToBN,
Expand Down
1 change: 1 addition & 0 deletions app/util/test/initial-background-state.json
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@
"domains": {}
},
"SignatureController": {
"signatureRequests": {},
"unapprovedPersonalMsgs": {},
"unapprovedTypedMessages": {},
"unapprovedPersonalMsgCount": 0,
Expand Down
2 changes: 1 addition & 1 deletion bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1553,7 +1553,7 @@ app:
NVM_SHA256SUM: '8e45fa547f428e9196a5613efad3bfa4d4608b74ca870f930090598f5af5f643'
- opts:
is_expand: false
NODE_VERSION: 20.12.2
NODE_VERSION: 20.14.0
- opts:
is_expand: false
YARN_VERSION: 1.22.22
Expand Down
2 changes: 1 addition & 1 deletion locales/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@
"data_collection_title": "Data collection for marketing",
"data_collection_description": "We’ll use MetaMetrics to learn how you interact with our marketing communications. We may share relevant news (like product features and other materials).",
"batch_balance_requests_title": "Batch account balance requests",
"batch_balance_requests_description": "We batch accounts and query Infura to responsively show your balances. If you turn this off, only active accounts will be queried. Some dApps won’t work unless you connect your wallet.",
"batch_balance_requests_description": "Get balance updates for all your accounts at once. Turning off this feature means others are less likely to associate one account with another.",
"third_party_title": "Get incoming transactions",
"third_party_description": "Third party APIs (Etherscan) are used to show your incoming transactions in the history. Turn off if you don’t want us to pull data from those services.",
"metametrics_opt_out": "MetaMetrics Opt-out",
Expand Down
Loading

0 comments on commit f5596eb

Please sign in to comment.