Skip to content

Commit

Permalink
Merge branch 'feature/adds_useChainId_components_views' into feature/…
Browse files Browse the repository at this point in the history
…adds_useChainId_other_ui_components
  • Loading branch information
andreahaku authored Oct 21, 2024
2 parents 5415e6a + bf6d0f8 commit 9f5281c
Show file tree
Hide file tree
Showing 230 changed files with 17,301 additions and 5,263 deletions.
7 changes: 0 additions & 7 deletions .depcheckrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,17 @@ ignores:
- 'rn-nodeify'

## Unused devDependencies to investigate
- '@ethersproject/abi'
- '@metamask/swappable-obj-proxy'
- '@react-native-picker/picker'
- '@rnhooks/keyboard'
- '@segment/sovran-react-native'
- '@tradle/react-native-http'
- 'asyncstorage-down'
- 'buffer'
- 'd3-shape'
- 'dnode'
- 'eciesjs'
- 'eth-block-tracker'
- 'eth-json-rpc-infura'
- 'events'
- 'https-browserify'
- 'obs-store'
- 'path'
- 'pbkdf2'
- 'pify'
Expand All @@ -73,11 +68,9 @@ ignores:
- 'react-native-aes-crypto'
- 'react-native-aes-crypto-forked'
- 'react-native-crypto'
- 'react-native-flash-message'
- 'react-native-level-fs'
- 'react-native-os'
- 'react-native-randombytes'
- 'react-native-redash'
- 'react-native-swipe-gestures'
- 'react-native-tcp'
- 'socket.io-client'
Expand Down
28 changes: 8 additions & 20 deletions .detoxrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = {
configurations: {
'ios.sim.apiSpecs': {
device: 'ios.simulator',
app: 'ios.debug',
app: process.env.CI ? 'ios.qa' :'ios.debug',
testRunner: {
args: {
"$0": "node e2e/api-specs/run-api-spec-tests.js",
Expand All @@ -41,10 +41,9 @@ module.exports = {
device: 'ios.simulator',
app: 'ios.release',
},
// because e2e run on debug mode in bitrise
'android.emu.bitrise.debug': {
device: 'android.bitrise.emulator',
app: 'android.bitrise.debug',
'ios.sim.qa': {
device: 'ios.simulator',
app: 'ios.qa',
},

'android.emu.debug': {
Expand Down Expand Up @@ -86,32 +85,21 @@ module.exports = {
binaryPath: 'ios/build/Build/Products/Debug-iphonesimulator/MetaMask.app',
build: 'yarn start:ios:e2e',
},
'ios.release': {
'ios.qa': {
type: 'ios.app',
binaryPath:
'ios/build/Build/Products/Release-iphonesimulator/MetaMask.app',
build: "METAMASK_BUILD_TYPE='main' METAMASK_ENVIRONMENT='production' yarn build:ios:release:e2e",
},
'android.bitrise.debug': {
type: 'android.apk',
binaryPath: 'android/app/build/outputs/apk/prod/debug/app-prod-debug.apk',
build: 'yarn start:android:e2e',
'ios/build/Build/Products/Release-iphonesimulator/MetaMask-QA.app',
build: "METAMASK_BUILD_TYPE='main' METAMASK_ENVIRONMENT='qa' yarn build:ios:qa",
},
'android.debug': {
type: 'android.apk',
binaryPath: 'android/app/build/outputs/apk/prod/debug/app-prod-debug.apk',
build: 'yarn start:android:e2e',
},
'android.release': {
type: 'android.apk',
binaryPath:
'android/app/build/outputs/apk/prod/release/app-prod-release.apk',
build: "METAMASK_BUILD_TYPE='main' METAMASK_ENVIRONMENT='production' yarn build:android:release:e2e",
},
'android.qa': {
type: 'android.apk',
binaryPath: 'android/app/build/outputs/apk/qa/release/app-qa-release.apk',
build: "METAMASK_BUILD_TYPE='main' METAMASK_ENVIRONMENT='qa' yarn build:android:qa:e2e",
build: "METAMASK_BUILD_TYPE='main' METAMASK_ENVIRONMENT='qa' yarn build:android:qa",
},
},
};
2 changes: 1 addition & 1 deletion .github/scripts/get-next-semver-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ VERSION_BRANCHES=$(git branch -r | grep -o 'release/[0-9]*\.[0-9]*\.[0-9]*' | gr
VERSION_TAGS=$(git tag | grep -o 'v[0-9]*\.[0-9]*\.[0-9]*' | grep -o '[0-9]*\.[0-9]*\.[0-9]*' | sort --version-sort | tail -n 1)

# Get the version from package.json
VERSION_PACKAGE=$(node -p "require('./package.json').version")
VERSION_PACKAGE=$(node -p "require('../../package.json').version")

# Compare versions and keep the highest one
HIGHEST_VERSION=$(printf "%s\n%s\n%s" "$VERSION_BRANCHES" "$VERSION_TAGS" "$VERSION_PACKAGE" | sort --version-sort | tail -n 1)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
cache: yarn
- uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 #v1
with:
ruby-version: '3.1.5'
ruby-version: '3.1.6'
bundler-cache: true
env:
BUNDLE_GEMFILE: ios/Gemfile
Expand Down
7 changes: 5 additions & 2 deletions .js.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ export MM_ENABLE_SETTINGS_PAGE_DEV_OPTIONS="true"
# The endpoint used to submit errors and tracing data to Sentry for dev environment.
# export MM_SENTRY_DSN_DEV=

# Multichain Feature flag
export MULTICHAIN_V1=""
# Per dapp selected network (Amon Hen) feature flag
export MM_PER_DAPP_SELECTED_NETWORK=""

export MM_CHAIN_PERMISSIONS=""

#Multichain feature flag specific to UI changes
export MM_MULTICHAIN_V1_ENABLED=""
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.5
3.1.6
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ android {
release {
manifestPlaceholders.isDebug = false
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro", "${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules-app.pro", "${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules.pro"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const styleSheet = StyleSheet.create({
justifyContent: 'flex-start',
},
accountNameLabelText: {
marginLeft: 4,
paddingHorizontal: 8,
borderWidth: 1,
borderRadius: 8,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,17 @@ const AccountBase = ({

<View style={styles.accountNameLabel}>
<Text variant={TextVariant.BodyMDBold}>{accountName}</Text>
{accountTypeLabel && (
</View>
{accountTypeLabel && (
<View style={styles.accountNameLabel}>
<Text
variant={TextVariant.BodySM}
variant={TextVariant.BodyMDBold}
style={styles.accountNameLabelText}
>
{strings(accountTypeLabel)}
</Text>
)}
</View>
)}
</View>
</View>
<View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const Input: React.FC<InputProps> = ({
isReadonly = false,
onBlur,
onFocus,
autoFocus = false,
autoFocus = true,
...props
}) => {
const [isFocused, setIsFocused] = useState(autoFocus);
Expand Down Expand Up @@ -64,7 +64,7 @@ const Input: React.FC<InputProps> = ({
{...props}
style={styles.base}
editable={!isDisabled && !isReadonly}
autoFocus
autoFocus={autoFocus}
onBlur={onBlurHandler}
onFocus={onFocusHandler}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ exports[`Input should render correctly 1`] = `
style={
{
"backgroundColor": "#ffffff",
"borderColor": "transparent",
"borderColor": "#0376c9",
"borderWidth": 1,
"color": "#141618",
"fontFamily": "Euclid Circular B",
Expand Down
12 changes: 6 additions & 6 deletions app/components/Base/Title/Title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ const Title: React.FC<TitleProps> = ({

return (
<Text
style={[
style.text,
centered && style.centered,
hero && style.hero,
externalStyle,
]}
style={{
...style.text,
...(centered ? style.centered : {}),
...(hero ? style.hero : {}),
...(typeof externalStyle === 'object' ? externalStyle : {}),
}}
{...props}
/>
);
Expand Down
7 changes: 3 additions & 4 deletions app/components/UI/AssetOverview/TokenDetails/TokenDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useSelector } from 'react-redux';
import i18n from '../../../../../locales/i18n';
import { useStyles } from '../../../../component-library/hooks';
import styleSheet from './TokenDetails.styles';
import { formatAddress, safeToChecksumAddress } from '../../../../util/address';
import { safeToChecksumAddress } from '../../../../util/address';
import { selectTokenList } from '../../../../selectors/tokenListController';
import { selectContractExchangeRates } from '../../../../selectors/tokenRatesController';
import {
Expand Down Expand Up @@ -75,13 +75,12 @@ const TokenDetails: React.FC<TokenDetailsProps> = ({ asset }) => {

const tokenDetails: TokenDetails = asset.isETH
? {
contractAddress: formatAddress(zeroAddress(), 'short'),
contractAddress: zeroAddress(),
tokenDecimal: 18,
tokenList: '',
}
: {
contractAddress:
formatAddress(tokenContractAddress as string, 'short') || null,
contractAddress: tokenContractAddress || null,
tokenDecimal: tokenMetadata?.decimals || null,
tokenList: tokenMetadata?.aggregators.join(', ') || null,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import Icon, {
import ClipboardManager from '../../../../../core/ClipboardManager';
import { TokenDetails } from '../TokenDetails';
import TokenDetailsListItem from '../TokenDetailsListItem';
import { formatAddress } from '../../../../../util/address';

interface TokenDetailsListProps {
tokenDetails: TokenDetails;
Expand Down Expand Up @@ -62,7 +63,7 @@ const TokenDetailsList: React.FC<TokenDetailsListProps> = ({
onPress={copyAccountToClipboard}
>
<Text color={TextColor.Primary} variant={TextVariant.BodySM}>
{tokenDetails.contractAddress}
{formatAddress(tokenDetails.contractAddress, 'short')}
</Text>
<Icon
name={IconName.Copy}
Expand Down
4 changes: 2 additions & 2 deletions app/components/UI/CollectibleContracts/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('CollectibleContracts', () => {
AccountsController: MOCK_ACCOUNTS_CONTROLLER_STATE,
NftController: {
allNfts: {
[MOCK_ADDRESS]: {
[MOCK_ADDRESS.toLowerCase()]: {
'0x1': [
{
address: '0x72b1FDb6443338A158DeC2FbF411B71aeB157A42',
Expand Down Expand Up @@ -131,7 +131,7 @@ describe('CollectibleContracts', () => {
},
},
allNftContracts: {
[MOCK_ADDRESS]: {
[MOCK_ADDRESS.toLowerCase()]: {
'0x1': [
{
address: '0x72b1FDb6443338A158DeC2FbF411B71aeB157A42',
Expand Down
22 changes: 4 additions & 18 deletions app/components/UI/LedgerModals/LedgerConfirmationModal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -407,24 +407,10 @@ describe('LedgerConfirmationModal', () => {
});

it('calls onRejection when user refuses confirmation', async () => {
const onRejection = jest.fn();
(useLedgerBluetooth as jest.Mock).mockReturnValue({
isSendingLedgerCommands: true,
isAppLaunchConfirmationNeeded: false,
ledgerLogicToRun: jest.fn(),
error: LedgerCommunicationErrors.UserRefusedConfirmation,
});

renderWithProvider(
<LedgerConfirmationModal
onConfirmation={jest.fn()}
onRejection={onRejection}
deviceId={'test'}
/>,
checkLedgerCommunicationErrorFlow(
LedgerCommunicationErrors.UserRefusedConfirmation,
strings('ledger.user_reject_transaction'),
strings('ledger.user_reject_transaction_message'),
);
// eslint-disable-next-line no-empty-function
await act(async () => {});

expect(onRejection).toHaveBeenCalled();
});
});
9 changes: 7 additions & 2 deletions app/components/UI/LedgerModals/LedgerConfirmationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ const LedgerConfirmationModal = ({
});
break;
case LedgerCommunicationErrors.UserRefusedConfirmation:
onReject();
setErrorDetails({
title: strings('ledger.user_reject_transaction'),
subtitle: strings('ledger.user_reject_transaction_message'),
});
break;
case LedgerCommunicationErrors.LedgerHasPendingConfirmation:
setErrorDetails({
Expand Down Expand Up @@ -275,7 +278,9 @@ const LedgerConfirmationModal = ({
isRetryHide={
ledgerError === LedgerCommunicationErrors.UnknownError ||
ledgerError === LedgerCommunicationErrors.NonceTooLow ||
ledgerError === LedgerCommunicationErrors.NotSupported
ledgerError === LedgerCommunicationErrors.NotSupported ||
ledgerError === LedgerCommunicationErrors.BlindSignError ||
ledgerError === LedgerCommunicationErrors.UserRefusedConfirmation
}
/>
</View>
Expand Down
Loading

0 comments on commit 9f5281c

Please sign in to comment.