Skip to content

Commit

Permalink
7.2.0 (#6651)
Browse files Browse the repository at this point in the history
* 7.2.0

* change view ID back to proper view to scroll down (#6669)

* fix: Migration not returning state (#6675)

* fix: Approving an ERC20 token with an amount with more decimals than expected crashes approving (#6623)

* fix: Support Decimal Comma for Token Custom Spend Cap (#6637)

* should replace decimal comma to decimal dots

* check that value is a number before saving

* token decimal value should not be greater than token decimal

* improve test ids

* improve variable naming

* rebased to main

* fix: Token allowance flow update (#6619)

* token allowance flow

* failing test

* lint

* moved url

* updated copy changes

* undefined to null

* rebased to release

* fix: Approve button is always disabled for ERC721 tokens (#6660)

* isCustomSpendInputValid check updates only on erc20 tokens

* update feedback

* fix: Custom Approve value is reset whenever we see Transaction details or click Edit (#6711)

* keep inputted token spend value when present

* edit spend value should not set dapp default value

* update release branch with yarn audit fix from main (#6721)

* feat: trigger qrsigning modal using approval controller (#6212) (#6720)

* feat: trigger qrsigning modal using approval controller

* fix: use approval request to control QR modal

* remove QRState usage

* use approval request to control QR modal for tx

* fix lint

* add early return on qr signing modal

---------

Co-authored-by: OGPoyraz <[email protected]>
Co-authored-by: Vinicius Stevam <[email protected]>
Co-authored-by: Vinicius Stevam <[email protected]>

* Fix: deeplink intrinsic gas issue (#6677)

* Fix deeplink intrinsic gas issue

Signed-off-by: Olusegun Akintayo <[email protected]>

* fix comment

Signed-off-by: Olusegun Akintayo <[email protected]>

* destructure suggested gas limit

Signed-off-by: Olusegun Akintayo <[email protected]>

---------

Signed-off-by: Olusegun Akintayo <[email protected]>

* chore: Linea translations (#6649) (#6728)

* New Crowdin translations by Github Action (#6649)

* New Crowdin translations by Github Action

* format to trigger CI

---------

Co-authored-by: metamaskbot <[email protected]>
Co-authored-by: sethkfman <[email protected]>

* fix formating issue

---------

Co-authored-by: MetaMask Bot <[email protected]>
Co-authored-by: metamaskbot <[email protected]>

* fix: sign v3 and v4 expecting chain id on hexadecimal format (#6712)

* send chain id to signature controller in hexadecimal format

* to hexadecimal chain id on signature controller

* Revert "send chain id to signature controller in hexadecimal format"

This reverts commit 2a68c6a.

* set nonce to undefine if !showCustomNonce (#6707)

Signed-off-by: Olusegun Akintayo <[email protected]>

* fix: patch zero balance when getBalance query times out (#6717)

* fix: patch balance retrieval in AccountTrackerController

return an error in case of balance query timeout instead of the default zero balance

* fix for back balance retrieval

* fix return value

this was not the right fix previously...

* remove unused result variable

---------

Co-authored-by: sethkfman <[email protected]>

* fix(bitrise): bump project bitrise version (#6689) (#6730)

Co-authored-by: João Loureiro <[email protected]>

* build bump to 1142 (#6731)

* updated changelog

---------

Signed-off-by: Olusegun Akintayo <[email protected]>
Co-authored-by: metamaskbot <[email protected]>
Co-authored-by: Chris Wilcox <[email protected]>
Co-authored-by: tommasini <[email protected]>
Co-authored-by: Sylva Elendu <[email protected]>
Co-authored-by: sethkfman <[email protected]>
Co-authored-by: OGPoyraz <[email protected]>
Co-authored-by: Vinicius Stevam <[email protected]>
Co-authored-by: Vinicius Stevam <[email protected]>
Co-authored-by: Olusegun Akintayo <[email protected]>
Co-authored-by: MetaMask Bot <[email protected]>
Co-authored-by: Nico MASSART <[email protected]>
Co-authored-by: João Loureiro <[email protected]>
Co-authored-by: sethkfman <[email protected]>
  • Loading branch information
14 people authored Jul 5, 2023
1 parent 18cb3a3 commit 19457c9
Show file tree
Hide file tree
Showing 39 changed files with 321 additions and 170 deletions.
49 changes: 49 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,55 @@

## Current Main Branch

## 7.2.0 - Jun 05, 2023
### Added
- [#6632](https://github.com/MetaMask/metamask-mobile/pull/6632): feat: add linea mainnet alert message
- [#6496](https://github.com/MetaMask/metamask-mobile/pull/6496): feat(551): add Linea Mainnet
- [#6494](https://github.com/MetaMask/metamask-mobile/pull/6494): feat: Update banner component to show/hide details section
- [#6539](https://github.com/MetaMask/metamask-mobile/pull/6539): feat: [MC 0.5] Remove drawer and add remain options to settings tab
- [#6378](https://github.com/MetaMask/metamask-mobile/pull/6378): feat: Add eth_sign friction
- [#6534](https://github.com/MetaMask/metamask-mobile/pull/6534): feat(action): remove labels after issue closed
- [#6570](https://github.com/MetaMask/metamask-mobile/pull/6570): feat: Translations for the disconnected account toast
- [#6452](https://github.com/MetaMask/metamask-mobile/pull/6452): feat: [MC 0.5] - Add Account management actions
- [#5591](https://github.com/MetaMask/metamask-mobile/pull/5591): feat: Custom Spend Allowance
- [#6426](https://github.com/MetaMask/metamask-mobile/pull/6426): feat: Componentize ListItem
- [#6514](https://github.com/MetaMask/metamask-mobile/pull/6514): feat: Componentize BottomSheetFooter
- [#6466](https://github.com/MetaMask/metamask-mobile/pull/6466): feat: componentize BottomSheetHeader
- [#6294](https://github.com/MetaMask/metamask-mobile/pull/6294): feat: [MC 0.5] - Activity view and Settings on the tab bar
- [#6486](https://github.com/MetaMask/metamask-mobile/pull/6486): feat: Add disabled prop on base button

### Changed
- [#6612](https://github.com/MetaMask/metamask-mobile/pull/6612): chore: approve txn when gas estimation ready
- [#6054](https://github.com/MetaMask/metamask-mobile/pull/6054): chore: Improve TagURL
- [#6520](https://github.com/MetaMask/metamask-mobile/pull/6520): chore: improve variable name
- [#6597](https://github.com/MetaMask/metamask-mobile/pull/6597): chore: rm unused prepareFullTransaction
- [#6291](https://github.com/MetaMask/metamask-mobile/pull/6291): refactor: trigger transaction modals using approval requests
- [#5751](https://github.com/MetaMask/metamask-mobile/pull/5751): chore: Keystone links
- [#6541](https://github.com/MetaMask/metamask-mobile/pull/6541): chore: Delete an unused hook
- [#6530](https://github.com/MetaMask/metamask-mobile/pull/6530): chore: pending review feedback for token details related changes
- [#6401](https://github.com/MetaMask/metamask-mobile/pull/6401): refactor: handle watch asset accept and reject using ApprovalController only
- [#6529](https://github.com/MetaMask/metamask-mobile/pull/6529): chore: adding english string for advanced settings eth_sign warning
- [#6026](https://github.com/MetaMask/metamask-mobile/pull/6026): chore: Add toggle to enable/disable multi account balances fetching
- [#6512](https://github.com/MetaMask/metamask-mobile/pull/6512): chore: upgrade to cocoapods 1.12.0
- [#6487](https://github.com/MetaMask/metamask-mobile/pull/6487): chore: new Show test networks translation
- [#6357](https://github.com/MetaMask/metamask-mobile/pull/6357): refactor: use approval controller for watch asset confirmation

### Fixed
- [#6549](https://github.com/MetaMask/metamask-mobile/pull/6549): fix: Networks text alignement
- [#6634](https://github.com/MetaMask/metamask-mobile/pull/6634): fix: disable next button if custom input is invalid
- [#6491](https://github.com/MetaMask/metamask-mobile/pull/6491): fix: refactor linea testnet implementation
- [#6358](https://github.com/MetaMask/metamask-mobile/pull/6358): fix: No Warning appears when a Dapp sets a really high Fees for a tx, potentially loosing all user funds
- [#6592](https://github.com/MetaMask/metamask-mobile/pull/6592): fix: Nonce too low error on Approve ERC20 and ERC721 transactions
- [#6577](https://github.com/MetaMask/metamask-mobile/pull/6577): fix: onBoarding wizard horizontal alignment on step1 and on browser step
- [#6598](https://github.com/MetaMask/metamask-mobile/pull/6598): fix: Hold to reveal Spanish copy
- [#6523](https://github.com/MetaMask/metamask-mobile/pull/6523): fix: Network logo to represent first letter of network
- [#6560](https://github.com/MetaMask/metamask-mobile/pull/6560): fix: asset page header transition
- [#6473](https://github.com/MetaMask/metamask-mobile/pull/6473): fix: fix for swaps button displaying on unsupported networks
- [#6464](https://github.com/MetaMask/metamask-mobile/pull/6464): fix: bug domain not shown on signature
- [#6517](https://github.com/MetaMask/metamask-mobile/pull/6517): fix: remove duplicate ganache steps definitions
- [#6299](https://github.com/MetaMask/metamask-mobile/pull/6299): fix: for from address balance shown for ERC20 transfers
- [#6471](https://github.com/MetaMask/metamask-mobile/pull/6471): fix: Approve default ERC20

## 7.1.0 - Jun 20, 2023
- [#6334](https://github.com/MetaMask/metamask-mobile/pull/6334): feat: Aurora Token Detection
- [#6351](https://github.com/MetaMask/metamask-mobile/pull/6351): feat: use thunk to handle processed order side effects
Expand Down
7 changes: 4 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,13 @@ android {
compileSdkVersion rootProject.ext.compileSdkVersion

namespace"io.metamask"

defaultConfig {
applicationId "io.metamask"
applicationId "io.metamask"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1136
versionName "7.1.0"
versionCode 1142
versionName "7.2.0"
testBuildType System.getProperty('testBuildType', 'debug')
missingDimensionStrategy 'react-native-camera', 'general'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const CUSTOM_INPUT_TEST_ID = 'custom-input-test-id';

export default CUSTOM_INPUT_TEST_ID;
export const CUSTOM_SPEND_CAP_INPUT_TEST_ID = 'custom-spend-cap-input-test-id';
export const CUSTOM_SPEND_CAP_MAX_TEST_ID = 'custom-spend-cap-max-test-id';
export const CUSTOM_SPEND_CAP_INPUT_INPUT_ID =
'custom-spend-cap-input-input-id';
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import React from 'react';
import { TICKER } from '../CustomSpendCap.constants';
// Internal dependencies.
import CustomInput from './CustomInput';
import {
CUSTOM_SPEND_CAP_INPUT_INPUT_ID,
CUSTOM_SPEND_CAP_MAX_TEST_ID,
} from './CustomInput.constants';
import { CustomInputProps } from './CustomInput.types';

describe('CustomInput', () => {
Expand All @@ -19,6 +23,7 @@ describe('CustomInput', () => {
isEditDisabled: false,
setMaxSelected: jest.fn(),
setValue: jest.fn(),
tokenDecimal: 4,
};
});

Expand All @@ -28,4 +33,42 @@ describe('CustomInput', () => {
const component = renderComponent();
expect(component).toMatchSnapshot();
});

it('should call setMaxSelected when max button is pressed', () => {
const component = renderComponent();
component
.findWhere((node) => node.prop('testID') === CUSTOM_SPEND_CAP_MAX_TEST_ID)
.simulate('press');
expect(props.setMaxSelected).toHaveBeenCalled();
});

it('should update value if input is integer', () => {
const component = renderComponent();
component
.findWhere(
(node) => node.prop('testID') === CUSTOM_SPEND_CAP_INPUT_INPUT_ID,
)
.simulate('changeText', '123');
expect(props.setValue).toHaveBeenCalledWith('123');
});

it('should update value if input is decimal and decimal points are less than or equal to tokenDecimal', () => {
const component = renderComponent();
component
.findWhere(
(node) => node.prop('testID') === CUSTOM_SPEND_CAP_INPUT_INPUT_ID,
)
.simulate('changeText', '123.1234');
expect(props.setValue).toHaveBeenCalledWith('123.1234');
});

it('should not update value if input is decimal and decimal points are greater than tokenDecimal', () => {
const component = renderComponent();
component
.findWhere(
(node) => node.prop('testID') === CUSTOM_SPEND_CAP_INPUT_INPUT_ID,
)
.simulate('changeText', '123.1234567');
expect(props.setValue).not.toHaveBeenCalled();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import { dotAndCommaDecimalFormatter } from '../../../../util/number';
import Text, { TextVariant } from '../../../components/Texts/Text';
// External dependencies.
import { useStyles } from '../../../hooks';
import CUSTOM_INPUT_TEST_ID from './CustomInput.constants';
import {
CUSTOM_SPEND_CAP_INPUT_INPUT_ID,
CUSTOM_SPEND_CAP_INPUT_TEST_ID,
CUSTOM_SPEND_CAP_MAX_TEST_ID,
} from './CustomInput.constants';
import stylesheet from './CustomInput.styles';
// Internal dependencies.
import { CustomInputProps } from './CustomInput.types';
Expand All @@ -20,8 +24,15 @@ const CustomInput = ({
isInputGreaterThanBalance,
setValue,
isEditDisabled,
tokenDecimal,
}: CustomInputProps) => {
const handleUpdate = (text: string) => {
const decimalIndex = text.indexOf('.');
const fractionalLength = text.substring(decimalIndex + 1).length;

if (decimalIndex !== -1 && fractionalLength > Number(tokenDecimal)) {
return;
}
setValue(dotAndCommaDecimalFormatter(text));
};

Expand Down Expand Up @@ -49,11 +60,12 @@ const CustomInput = ({
backgroundColor: colors.background.alternative,
},
]}
testID={CUSTOM_INPUT_TEST_ID}
testID={CUSTOM_SPEND_CAP_INPUT_TEST_ID}
>
<View style={styles.body}>
{!isEditDisabled ? (
<TextInput
testID={CUSTOM_SPEND_CAP_INPUT_INPUT_ID}
multiline
onChangeText={onChangeValueText}
value={value}
Expand All @@ -74,6 +86,7 @@ const CustomInput = ({
</View>
{!isEditDisabled && (
<Text
testID={CUSTOM_SPEND_CAP_MAX_TEST_ID}
variant={TextVariant.BodySM}
style={styles.maxValueText}
onPress={handleMaxPress}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ export interface CustomInputProps {
* Boolean to disable edit
*/
isEditDisabled: boolean;
tokenDecimal?: number;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ exports[`CustomInput should render correctly 1`] = `
false,
]
}
testID="custom-input-test-id"
testID="custom-spend-cap-input-test-id"
>
<View
style={
Expand Down Expand Up @@ -47,6 +47,7 @@ exports[`CustomInput should render correctly 1`] = `
false,
]
}
testID="custom-spend-cap-input-input-id"
value="123"
/>
</View>
Expand All @@ -57,6 +58,7 @@ exports[`CustomInput should render correctly 1`] = `
"color": "#535A61",
}
}
testID="custom-spend-cap-max-test-id"
variant="sBodySM"
>
Max
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import CustomSpendCap from './CustomSpendCap';
// Internal dependencies.
import {
ACCOUNT_BALANCE,
DAPP_DOMAIN,
DAPP_PROPOSED_VALUE,
INPUT_VALUE_CHANGED,
TICKER,
Expand All @@ -18,10 +17,11 @@ storiesOf('Component Library / CustomSpendCap', module).add('Default', () => (
ticker={TICKER}
accountBalance={ACCOUNT_BALANCE}
dappProposedValue={DAPP_PROPOSED_VALUE}
domain={DAPP_DOMAIN}
onInputChanged={INPUT_VALUE_CHANGED}
isEditDisabled={false}
editValue={() => undefined}
tokenSpendValue={''}
toggleLearnMoreWebPage={() => undefined}
isInputValid={() => true}
/>
));
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import CustomSpendCap from './CustomSpendCap';
import {
ACCOUNT_BALANCE,
CUSTOM_SPEND_CAP_TEST_ID,
DAPP_DOMAIN,
DAPP_PROPOSED_VALUE,
INPUT_VALUE_CHANGED,
TICKER,
Expand All @@ -16,20 +15,22 @@ import {
import { CustomSpendCapProps } from './CustomSpendCap.types';

function RenderCustomSpendCap(
tokenSpendValue: string,
tokenSpendValue = '',
isInputValid: () => boolean = () => true,
dappProposedValue: string = DAPP_PROPOSED_VALUE,
) {
return (
<CustomSpendCap
ticker={TICKER}
accountBalance={ACCOUNT_BALANCE}
dappProposedValue={DAPP_PROPOSED_VALUE}
domain={DAPP_DOMAIN}
dappProposedValue={dappProposedValue}
onInputChanged={INPUT_VALUE_CHANGED}
isEditDisabled={false}
editValue={() => ({})}
tokenSpendValue={tokenSpendValue}
isInputValid={isInputValid}
tokenDecimal={18}
toggleLearnMoreWebPage={() => undefined}
/>
);
}
Expand Down Expand Up @@ -63,7 +64,7 @@ describe('CustomSpendCap', () => {

expect(
await findByText(
`Only enter a number that you're comfortable with ${DAPP_DOMAIN} accessing now or in the future. You can always increase the token limit later.`,
`Only enter a number that you're comfortable with the third party spending now or in the future. You can always increase the spending cap later. Learn more`,
),
).toBeDefined();
});
Expand All @@ -81,13 +82,15 @@ describe('CustomSpendCap', () => {

it('should render valid message if value is greater than account balance', async () => {
const valueGreaterThanBalance = '300';
const valueDifference =
Number(valueGreaterThanBalance) - Number(ACCOUNT_BALANCE);
const { toJSON } = renderWithProvider(
const { findByText } = renderWithProvider(
RenderCustomSpendCap(valueGreaterThanBalance),
);

expect(JSON.stringify(toJSON())).toMatch(`${valueDifference} ${TICKER}`);
expect(
await findByText(
'This allows the third party to spend all your token balance until it reaches the cap or you revoke the spending cap. If this is not intended, consider setting a lower spending cap. Learn more',
),
).toBeDefined();
});

it('should call isInputValid with false if value is not a number', async () => {
Expand All @@ -103,4 +106,18 @@ describe('CustomSpendCap', () => {

expect(isInputValid).toHaveBeenCalledWith(true);
});

it('should render token spend value if present', async () => {
const inputtedSpendValue = '100';

const { findByText } = renderWithProvider(
RenderCustomSpendCap(
inputtedSpendValue,
isInputValid,
DAPP_PROPOSED_VALUE,
),
);

expect(await findByText(`${inputtedSpendValue} ${TICKER}`)).toBeDefined();
});
});
Loading

0 comments on commit 19457c9

Please sign in to comment.