Skip to content

Commit

Permalink
Rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
gantunesr committed Mar 14, 2023
2 parents 8acc208 + f46e93e commit f83cbb2
Show file tree
Hide file tree
Showing 55 changed files with 1,032 additions and 515 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

[submodule "ios/mixpanel-iphone"]
path = ios/mixpanel-iphone
url = https://github.com/mixpanel/mixpanel-iphone
url = https://github.com/mixpanel/mixpanel-iphone
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@

## Current Main Branch

## 6.0.1 - Feb 27, 2023
## 6.1.2 - Mar 03, 2023
- [#5925](https://github.com/MetaMask/metamask-mobile/pull/5925): [FIX] handle all ios biometric errors and create wallet
- [#5906](https://github.com/MetaMask/metamask-mobile/pull/5906): [FIX] Add try-catch to recreateVault

## 6.1.1 - Mar 01, 2023
- [#5848](https://github.com/MetaMask/metamask-mobile/pull/5848): [FIX] Remove default eth sign

## 6.1.0 - Feb 27, 2023
- [#5851](https://github.com/MetaMask/metamask-mobile/pull/5851): [FIX] Fix search network crasher
- [#5809](https://github.com/MetaMask/metamask-mobile/pull/5809): [FIX] Resolve tab bar merge conflicts
- [#5461](https://github.com/MetaMask/metamask-mobile/pull/5461): [IMPROVEMENT] On-ramp: Refactor Payment Methods view to componentization
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ android {
applicationId "io.metamask"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1078
versionName "6.1.0"
versionCode 1082
versionName "6.1.2"
multiDexEnabled true
testBuildType System.getProperty('testBuildType', 'debug')
missingDimensionStrategy "minReactNative", "minReactNative46"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { ImageSourcePropType } from 'react-native';
const imageSource =
'https://assets.coingecko.com/coins/images/279/small/ethereum.png?1595348880';

export const CONTRACT_ADDRESS = '0x2990079bcdEe240329a520d2444386FC119da21a';
export const CONTRACT_PET_NAME = 'DAI';
export const CONTRACT_BOX_TEST_ID = 'contract-box';
export const CONTRACT_LOCAL_IMAGE: ImageSourcePropType = {
Expand All @@ -22,3 +21,6 @@ export const CONTRACT_EXPORT_ADDRESS = () => {
export const CONTRACT_ON_PRESS = () => {
console.log('contract pressed');
};

export const HAS_BLOCK_EXPLORER = true;
export const TOKEN_SYMBOL = 'D';
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,41 @@
import React from 'react';
import { storiesOf } from '@storybook/react-native';

// External depencies
import TEST_ADDRESS from '../../../../constants/address';

// Internal dependencies.
import ContractBox from './ContractBox';
import {
CONTRACT_ADDRESS,
CONTRACT_PET_NAME,
CONTRACT_LOCAL_IMAGE,
CONTRACT_COPY_ADDRESS,
CONTRACT_EXPORT_ADDRESS,
CONTRACT_ON_PRESS,
HAS_BLOCK_EXPLORER,
TOKEN_SYMBOL,
} from './ContractBox.constants';

storiesOf('Component Library / Contract Box', module)
.add('Address Not Saved', () => (
<ContractBox
contractAddress={CONTRACT_ADDRESS}
contractAddress={TEST_ADDRESS}
contractLocalImage={CONTRACT_LOCAL_IMAGE}
onCopyAddress={CONTRACT_COPY_ADDRESS}
onExportAddress={CONTRACT_EXPORT_ADDRESS}
onContractPress={CONTRACT_ON_PRESS}
hasBlockExplorer={HAS_BLOCK_EXPLORER}
tokenSymbol={TOKEN_SYMBOL}
/>
))
.add('Saved Address', () => (
<ContractBox
contractAddress={CONTRACT_ADDRESS}
contractAddress={TEST_ADDRESS}
contractPetName={CONTRACT_PET_NAME}
contractLocalImage={CONTRACT_LOCAL_IMAGE}
onCopyAddress={CONTRACT_COPY_ADDRESS}
onExportAddress={CONTRACT_EXPORT_ADDRESS}
onContractPress={CONTRACT_ON_PRESS}
hasBlockExplorer={HAS_BLOCK_EXPLORER}
/>
));
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const styleSheet = StyleSheet.create({
container: {
flexDirection: 'row',
justifyContent: 'space-between',
marginHorizontal: 10,
},
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import { shallow } from 'enzyme';
import TEST_ADDRESS from '../../../../constants/address';
import { ContractBoxProps } from './ContractBox.types';
import ContractBox from './ContractBox';
import {
CONTRACT_BOX_TEST_ID,
CONTRACT_ADDRESS,
CONTRACT_PET_NAME,
CONTRACT_LOCAL_IMAGE,
CONTRACT_COPY_ADDRESS,
Expand All @@ -16,7 +16,7 @@ describe('ContractBox', () => {
it('should render ContractBox', () => {
const wrapper = shallow<ContractBoxProps>(
<ContractBox
contractAddress={CONTRACT_ADDRESS}
contractAddress={TEST_ADDRESS}
contractPetName={CONTRACT_PET_NAME}
contractLocalImage={CONTRACT_LOCAL_IMAGE}
onCopyAddress={CONTRACT_COPY_ADDRESS}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const ContractBox = ({
onExportAddress,
onCopyAddress,
onContractPress,
hasBlockExplorer,
tokenSymbol,
}: ContractBoxProps) => (
<View testID={CONTRACT_BOX_TEST_ID}>
<Card style={styles.container}>
Expand All @@ -23,6 +25,8 @@ const ContractBox = ({
onExportAddress={onExportAddress}
onCopyAddress={onCopyAddress}
onContractPress={onContractPress}
hasBlockExplorer={hasBlockExplorer}
tokenSymbol={tokenSymbol}
/>
</Card>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@ const styleSheet = (params: { theme: Theme }) => {
flexDirection: 'row',
alignItems: 'center',
},
imageContainer: {
marginRight: 16,
},
icon: {
paddingHorizontal: 6,
},
iconContainer: {
flexDirection: 'row',
width: 60,
alignItems: 'center',
justifyContent: 'space-between',
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { shallow } from 'enzyme';
import ContractBoxBase from './ContractBoxBase';
import TEST_ADDRESS from '../../../../constants/address';
import {
CONTRACT_ADDRESS,
CONTRACT_PET_NAME,
CONTRACT_LOCAL_IMAGE,
} from '../ContractBox/ContractBox.constants';
Expand All @@ -14,7 +14,7 @@ describe('Component ContractBoxBase', () => {

beforeEach(() => {
props = {
contractAddress: CONTRACT_ADDRESS,
contractAddress: TEST_ADDRESS,
contractPetName: CONTRACT_PET_NAME,
contractLocalImage: CONTRACT_LOCAL_IMAGE,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { formatAddress } from '../../../../util/address';
import Icon, { IconName, IconSize } from '../../../components/Icons/Icon';
import { useStyles } from '../../../hooks';
import Button, { ButtonVariants } from '../../../components/Buttons/Button';
import Identicon from '../../../../components/UI/Identicon';

// Internal dependencies.
import { ContractBoxBaseProps, IconViewProps } from './ContractBoxBase.types';
Expand All @@ -30,24 +31,37 @@ const ContractBoxBase = ({
onCopyAddress,
onExportAddress,
onContractPress,
hasBlockExplorer,
tokenSymbol,
}: ContractBoxBaseProps) => {
const formattedAddress = formatAddress(contractAddress, 'short');
const { styles } = useStyles(styleSheet, {});
const {
styles,
theme: { colors },
} = useStyles(styleSheet, {});

const IconView = ({ onPress, name, size, testID }: IconViewProps) => (
<Pressable onPress={onPress} testID={testID}>
<Icon color={'grey'} name={name} size={size} />
<Pressable style={styles.icon} onPress={onPress} testID={testID}>
<Icon color={colors.icon.alternative} name={name} size={size} />
</Pressable>
);

return (
<View style={styles.container} testID={CONTRACT_BOX_TEST_ID}>
<View style={styles.rowContainer}>
<Avatar
variant={AvatarVariants.Token}
size={AvatarSize.Xl}
imageSource={contractLocalImage}
/>
<View style={styles.imageContainer}>
{contractLocalImage ? (
<Avatar
variant={AvatarVariants.Token}
size={AvatarSize.Md}
imageSource={contractLocalImage}
/>
) : tokenSymbol ? (
<Text variant={TextVariant.BodyMDBold}>{tokenSymbol}</Text>
) : (
<Identicon address={contractAddress} diameter={25} />
)}
</View>
{contractPetName ? (
<Pressable onPress={onContractPress}>
<Text style={styles.header} variant={TextVariant.HeadingMD}>
Expand All @@ -60,11 +74,10 @@ const ContractBoxBase = ({
<Button
variant={ButtonVariants.Link}
textVariant={TextVariant.HeadingMD}
label={formattedAddress}
style={styles.header}
onPress={onContractPress}
>
{formattedAddress}
</Button>
/>
</View>
)}
</View>
Expand All @@ -75,12 +88,14 @@ const ContractBoxBase = ({
size={IconSize.Lg}
testID={COPY_ICON_TEST_ID}
/>
<IconView
onPress={onExportAddress}
name={IconName.Export}
size={IconSize.Md}
testID={EXPORT_ICON_TEST_ID}
/>
{hasBlockExplorer && (
<IconView
name={IconName.Export}
onPress={onExportAddress}
size={IconSize.Md}
testID={EXPORT_ICON_TEST_ID}
/>
)}
</View>
</View>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IconName, IconSize } from '../../../components/Icons/Icon';
export interface ContractBoxBaseProps {
contractAddress: string;
contractPetName?: string;
contractLocalImage: ImageSourcePropType;
contractLocalImage?: ImageSourcePropType;
/**
* function that copies the contract address to the clipboard
*/
Expand All @@ -17,6 +17,11 @@ export interface ContractBoxBaseProps {
* functions that called when the user clicks on the contract name
*/
onContractPress: () => void;
/**
* Boolean that determines if the contract has a block explorer
*/
hasBlockExplorer?: boolean;
tokenSymbol?: string;
}

export interface IconViewProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,23 @@ exports[`Component ContractBoxBase should render correctly 1`] = `
}
}
>
<Avatar
imageSource={
<View
style={
Object {
"uri": "https://assets.coingecko.com/coins/images/279/small/ethereum.png?1595348880",
"marginRight": 16,
}
}
size="48"
variant="Token"
/>
>
<Avatar
imageSource={
Object {
"uri": "https://assets.coingecko.com/coins/images/279/small/ethereum.png?1595348880",
}
}
size="32"
variant="Token"
/>
</View>
<Component>
<Text
style={
Expand All @@ -52,7 +60,6 @@ exports[`Component ContractBoxBase should render correctly 1`] = `
"alignItems": "center",
"flexDirection": "row",
"justifyContent": "space-between",
"width": 60,
}
}
>
Expand All @@ -61,11 +68,6 @@ exports[`Component ContractBoxBase should render correctly 1`] = `
size="24"
testID="copy-icon"
/>
<IconView
name="Export"
size="20"
testID="export-icon"
/>
</View>
</View>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ const CustomSpendCap = ({
)
: strings(
'contract_allowance.custom_spend_cap.no_value_selected',
{ domain },
{
domain,
},
)}
</Text>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('ApproveTransactionHeader', () => {
it('should render correctly', () => {
const wrapper = shallow(
<Provider store={store}>
<ApproveTransactionHeader origin="0x" spenderAddress="0x" url="" />
<ApproveTransactionHeader origin="0x" from="0x" url="" />
</Provider>,
);
expect(wrapper).toMatchSnapshot();
Expand Down
Loading

0 comments on commit f83cbb2

Please sign in to comment.