Skip to content

Commit

Permalink
Merge branch 'main' of github.com:MetaMask/metamask-mobile into appro…
Browse files Browse the repository at this point in the history
…ve_transaction_review_cleanup
  • Loading branch information
jpuri committed Apr 25, 2023
2 parents cd659fb + e3c09e1 commit 49ae910
Show file tree
Hide file tree
Showing 346 changed files with 4,519 additions and 2,638 deletions.
4 changes: 4 additions & 0 deletions .e2e.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ENV vars for e2e tests to run on Bitrise CI
export MM_TEST_ACCOUNT_SRP='word1 word... word12'
export MM_TEST_ACCOUNT_ADDRESS='0x...'
export MM_TEST_ACCOUNT_PRIVATE_KEY=''
17 changes: 17 additions & 0 deletions .github/workflows/ci-all-branches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Fails the pull request if it has the "DO-NOT-MERGE" label

name: ci / check all branches

on:
pull_request:
types: [opened, reopened, labeled, unlabeled, synchronize]

jobs:
do-not-merge:
runs-on: ubuntu-latest
if: ${{ contains(github.event.pull_request.labels.*.name, 'DONOTMERGE') }}
steps:
- name: 'Check for label "DONOTMERGE"'
run: |
echo 'This check fails PRs with the "DONOTMERGE" label to block merging'
exit 1
9 changes: 4 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,9 @@ tests
/android/app/src/main/assets/InpageBridgeWeb3.js
/app/core/InpageBridgeWeb3.js

# environment variables
.js.env
.ios.env
.android.env
# environment variables instances
# only version the example files
.*.env

# Sentry
/sentry.debug.properties
Expand Down Expand Up @@ -101,4 +100,4 @@ browserstack.err
/artifacts

# Reports generated by tests
e2e/reports
e2e/reports
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v14
v16
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@

## Current Main Branch

## 6.4.0 - Apr 20, 2023
- [#6144](https://github.com/MetaMask/metamask-mobile/pull/6144): [FEATURE] New Crowdin translations by Github Action
- [#6143](https://github.com/MetaMask/metamask-mobile/pull/6143): [UPDATE] Crowdin token to use METAMASKBOT_CROWDIN_TOKEN
- [#5627](https://github.com/MetaMask/metamask-mobile/pull/5627): [IMPROVEMENT] Refactor remaining `web3-provider-engine` methods
- [#6082](https://github.com/MetaMask/metamask-mobile/pull/6082): [IMPROVEMENT] Remove inactive IPFS providers
- [#5620](https://github.com/MetaMask/metamask-mobile/pull/5620): [IMPROVEMENT] Refactor RPC `getAccounts` usage
- [#6122](https://github.com/MetaMask/metamask-mobile/pull/6122): [FIX] TypeError: undefined is not an object (evaluating 'n.find')
- [#6134](https://github.com/MetaMask/metamask-mobile/pull/6134): [REFACTOR] Reveal Private Key section
- [#6009](https://github.com/MetaMask/metamask-mobile/pull/6009): [FEATURE] On-ramp: Add what's new modal content
- [#5619](https://github.com/MetaMask/metamask-mobile/pull/5619): [IMPROVEMENT] Refactor `eth_sendTransaction` handler
- [#6058](https://github.com/MetaMask/metamask-mobile/pull/6058): [FIX] broken erc721 approve token link
- [#6020](https://github.com/MetaMask/metamask-mobile/pull/6020): [FEATURE][MC] Token list with network logo and token name
- [#5992](https://github.com/MetaMask/metamask-mobile/pull/5992): [FEATURE][MC] - Wallet actions on Tab bar
- [#5937](https://github.com/MetaMask/metamask-mobile/pull/5937): [FEATURE]Show internet protocol on confirmation screens
- [#6015](https://github.com/MetaMask/metamask-mobile/pull/6015): [UPDATE] sentry version and enable performance metrics
- [#6109](https://github.com/MetaMask/metamask-mobile/pull/6109): [FIX] linea network order in dropdown + remove feature toggle for linea (#6072)
- [#6081](https://github.com/MetaMask/metamask-mobile/pull/6081): [UPDATE] ESLint rules for scripts
- [#6006](https://github.com/MetaMask/metamask-mobile/pull/6006): [UPDATE] Upgrade xcode version
- [#6003](https://github.com/MetaMask/metamask-mobile/pull/6003): [IMPROVEMENT] Adding document to refactor send flow
- [#6060](https://github.com/MetaMask/metamask-mobile/pull/6060): [IMPROVEMENT] Refactor send transaction v2
- [#6037](https://github.com/MetaMask/metamask-mobile/pull/6037): [FEATURE] update sdk persistence
- [#5900](https://github.com/MetaMask/metamask-mobile/pull/5900): [IMPROVEMENT] Creating reusable address from/to component.
- [#5933](https://github.com/MetaMask/metamask-mobile/pull/5933): [IMPROVEMENT] Componentize Banner Component
- [#5927](https://github.com/MetaMask/metamask-mobile/pull/5927): [IMPROVEMENT] Componentize Form Components

## 6.3.0 - Apr 05, 2023
- [#6025](https://github.com/MetaMask/metamask-mobile/pull/6025): [FIX] Add url-parse lib to our MainNavigator
- [#6039](https://github.com/MetaMask/metamask-mobile/pull/6039): [ENHANCEMENT] Improve Android setup instructions
Expand Down
50 changes: 46 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The code is built using React-Native and running code locally requires a Mac or

- Install [sentry-cli](https://github.com/getsentry/sentry-cli) tools: `brew install getsentry/tools/sentry-cli`

- Install [Node.js](https://nodejs.org) **version 14**
- Install [Node.js](https://nodejs.org) **version 16**

- If you are using [nvm](https://github.com/creationix/nvm#installation) (recommended) running `nvm use` will automatically choose the right node version for you.

Expand Down Expand Up @@ -212,20 +212,62 @@ Work is in progress to have both platforms using Detox.

E2E tests use a wallet able to access testnet and mainnet.
On Bitrise CI, the wallet is created using the secret recovery phrase from secret env var.
For local testing, the wallet is created using the secret recovery phrase from the `.js.env` file.
For local testing, the wallet is created using the secret recovery phrase from the `.e2e.env` file.

##### iOS
All tests live within the e2e/specs folder.

First, [follow the instructions here](https://github.com/wix/AppleSimulatorUtils) to install `applesimutils`. Then:
Prequisites for running tests:
- Make sure to install `detox-cli` by referring to the instructions mentioned [here](https://wix.github.io/Detox/docs/introduction/getting-started/#detox-prerequisites).
- Additionally, install `applesimutils` by following the guidelines provided [here](https://github.com/wix/AppleSimulatorUtils).
- Before running any tests, it's recommended to refer to the `iOS section` above and check the latest simulator device specified under `Install the correct simulator`.
- Make sure that Metro is running. Use this command to launch the metro server:

```bash
yarn watch
```

You can trigger the tests against a `release` or `debug` build. It recommended that you trigger the tests against a debug build.

To trigger the tests on a debug build run this command:

```bash
yarn test:e2e:ios:debug
```

If you choose to run tests against a release build, you can do so by running this command:

```bash
yarn test:e2e:ios
```

If you have already built the application for Detox and want to run a specific test from the test folder, you can use this command:

```bash
yarn test:e2e:ios:debug:single e2e/specs/TEST_NAME.spec.js
```

##### Android
All android tests live within the wdio/feature folder.

By default the tests use an avd named `Android 11 - Pixel 4a API 31`, with API `Level 30` (Android 11). You can modify the emulator and platform version by navigating to `wdio/config/android.config.debug.js` and adjusting the values of `deviceName` to match your emulator's name, and `platformVersion` to match your operating system's version. Make sure to verify that the config file accurately represents your emulator settings before executing any tests.

The sequence in which you should run tests:

create a test build using this command:
```bash
yarn start:android:qa
```

Then run tests using this command:

```bash
yarn test:wdio:android
```

If you want to run a specific test, you can include the `--spec` flag in the aforementioned command. For example:
```bash
yarn test:e2e:android
yarn test:wdio:android --spec ./wdio/features/Onboarding/CreateNewWallet.feature
```

### Changing dependencies
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 1095
versionName "6.3.0"
versionCode 1100
versionName "6.4.0"
multiDexEnabled true
testBuildType System.getProperty('testBuildType', 'debug')
missingDimensionStrategy "minReactNative", "minReactNative46"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe('AccountBalance', () => {
accountBalanceLabel={''}
accountAddress={ACCOUNT_BALANCE_TEST_ID}
badgeProps={BADGE_PROPS}
useBlockieIcon={false}
/>,
);
const singleSelectComponent = wrapper.findWhere(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const AccountBalance = ({
accountBalanceLabel,
accountAddress,
badgeProps,
useBlockieIcon,
}: AccountBalanceProps) => (
<Card style={styles.container} testID={ACCOUNT_BALANCE_TEST_ID}>
<AccountBase
Expand All @@ -23,6 +24,7 @@ const AccountBalance = ({
accountBalanceLabel={accountBalanceLabel}
accountAddress={accountAddress}
badgeProps={badgeProps}
useBlockieIcon={useBlockieIcon}
/>
</Card>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe('AccountBase', () => {
accountBalanceLabel={''}
accountAddress={TEST_ACCOUNT_ADDRESS}
badgeProps={BADGE_PROPS}
useBlockieIcon={false}
/>,
);
const singleSelectComponent = wrapper.findWhere(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Text, { TextVariant } from '../../../components/Texts/Text';
import BadgeWrapper from '../../../components/Badges/BadgeWrapper';
import Badge from '../../../../component-library/components/Badges/Badge';
import Avatar, { AvatarVariants } from '../../../components/Avatars/Avatar';
import { AvatarAccountType } from '../../../components/Avatars/Avatar/variants/AvatarAccount';
import {
ACCOUNT_BALANCE_AVATAR_TEST_ID,
ACCOUNT_BASE_TEST_ID,
Expand All @@ -19,15 +20,22 @@ const AccountBase = ({
accountBalanceLabel,
accountAddress,
badgeProps,
useBlockieIcon,
}: AccountBaseProps) => (
<View style={styles.body} testID={ACCOUNT_BASE_TEST_ID}>
<View style={styles.container}>
<BadgeWrapper
badgeElement={<Badge {...badgeProps} />}
style={styles.badgeWrapper}
testID={ACCOUNT_BALANCE_AVATAR_TEST_ID}
>
<Avatar
variant={AvatarVariants.Account}
type={
useBlockieIcon
? AvatarAccountType.Blockies
: AvatarAccountType.JazzIcon
}
testID={ACCOUNT_BALANCE_AVATAR_TEST_ID}
accountAddress={accountAddress}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ export interface AccountBaseProps {
* Avatar wrapper props
*/
badgeProps: BadgeProps;
/**
* account identicon
*/
useBlockieIcon: boolean;
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
/* eslint-disable import/prefer-default-export */

// External dependencies.
import { SAMPLE_BUTTONSECONDARY_PROPS } from './variants/ButtonSecondary/ButtonSecondary.constants';

// Internal dependencies.
import { ButtonSize, ButtonWidthTypes } from './Button.types';
import {
ButtonSize,
ButtonWidthTypes,
ButtonProps,
ButtonVariants,
} from './Button.types';

// Defaults
export const DEFAULT_BUTTON_SIZE = ButtonSize.Md;
export const DEFAULT_BUTTON_WIDTH = ButtonWidthTypes.Auto;

// Samples
export const SAMPLE_BUTTON_PROPS: ButtonProps = {
variant: ButtonVariants.Secondary,
...SAMPLE_BUTTONSECONDARY_PROPS,
};
10 changes: 8 additions & 2 deletions app/component-library/components/Buttons/Button/Button.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ export enum ButtonVariants {
/**
* Button component props.
*/
export type ButtonProps =
export type ButtonProps = (
| ButtonLinkProps
| ButtonPrimaryProps
| ButtonSecondaryProps;
| ButtonSecondaryProps
) & {
/**
* Variant of Button.
*/
variant: ButtonVariants;
};
113 changes: 113 additions & 0 deletions app/component-library/components/Buttons/Button/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Button

Buttons allow users to take actions, and make choices, with a single tap.
This component is a union component, which consists of [ButtonLink](./variants/ButtonLink/ButtonLink.tsx), [ButtonPrimary](./variants/ButtonPrimary/ButtonPrimary.tsx), and [ButtonSecondary](./variants/ButtonSecondary/ButtonSecondary.tsx).

## ButtonLink Props

### `textVariant`

Optional props to configure text component variants.

| <span style="color:gray;font-size:14px">TYPE</span> | <span style="color:gray;font-size:14px">REQUIRED</span> |
| :-------------------------------------------------- | :------------------------------------------------------ |
| [TextVariant](../../../../Texts/Text/Text.types.ts) | No |

## Common Props

### `label`

ButtonBase text.

| <span style="color:gray;font-size:14px">TYPE</span> | <span style="color:gray;font-size:14px">REQUIRED</span> |
| :-------------------------------------------------- | :------------------------------------------------------ |
| string | Yes |

### `size`

Optional prop for the size of the button.

| <span style="color:gray;font-size:14px">TYPE</span> | <span style="color:gray;font-size:14px">REQUIRED</span> | <span style="color:gray;font-size:14px">DEFAULT</span> |
| :-------------------------------------------------- | :------------------------------------------------------ | :----------------------------------------------------- |
| [ButtonSize](../../Button.types.ts) | Yes | Md |

### `onPress`

Function to trigger when pressing the button.

| <span style="color:gray;font-size:14px">TYPE</span> | <span style="color:gray;font-size:14px">REQUIRED</span> |
| :-------------------------------------------------- | :------------------------------------------------------ |
| Function | Yes |

### `startIconName`

Optional prop for the icon name of the icon that will be displayed before the label.

| <span style="color:gray;font-size:14px">TYPE</span> | <span style="color:gray;font-size:14px">REQUIRED</span> |
| :-------------------------------------------------- | :------------------------------------------------------ |
| [IconName](../Icons/Icon.types.ts) | No |

### `endIconName`

Optional prop for the icon name of the icon that will be displayed after the label.

| <span style="color:gray;font-size:14px">TYPE</span> | <span style="color:gray;font-size:14px">REQUIRED</span> |
| :-------------------------------------------------- | :------------------------------------------------------ |
| [IconName](../Icons/Icon.types.ts) | No |

### `isDanger`

Optional boolean to show the danger state of the button.

| <span style="color:gray;font-size:14px">TYPE</span> | <span style="color:gray;font-size:14px">REQUIRED</span> | <span style="color:gray;font-size:14px">DEFAULT</span> |
| :-------------------------------------------------- | :------------------------------------------------------ | :----------------------------------------------------- |
| boolean | No | false |

### `width`

Optional param to control the width of the button.

| <span style="color:gray;font-size:14px">TYPE</span> | <span style="color:gray;font-size:14px">REQUIRED</span> | <span style="color:gray;font-size:14px">DEFAULT</span> |
| :-------------------------------------------------- | :------------------------------------------------------ | :----------------------------------------------------- |
| [ButtonWidthTypes](../../Button.types.ts) or number | No | ButtonWidthTypes.Auto |

## Usage

```javascript
// ButtonLink
<Button
variant={ButtonVariants.Link}
label={SAMPLE_LABEL}
startIconName={IconName.Bank}
endIconName={IconName.Bank}
size={ButtonSize.Md}
onPress={SAMPLE_ONPRESS_HANDLER}
isDanger
width={ButtonWidthTypes.Auto}
textVariant={TextVariant.DisplayMD}
/>;

// ButtonPrimary
<Button
variant={ButtonVariants.Primary}
label={SAMPLE_LABEL}
startIconName={IconName.Bank}
endIconName={IconName.Bank}
size={ButtonSize.Md}
onPress={SAMPLE_ONPRESS_HANDLER}
isDanger
width={ButtonWidthTypes.Auto}
/>;

// ButtonSecondary
<Button
variant={ButtonVariants.Secondary}
label={SAMPLE_LABEL}
startIconName={IconName.Bank}
endIconName={IconName.Bank}
size={ButtonSize.Md}
onPress={SAMPLE_ONPRESS_HANDLER}
isDanger
width={ButtonWidthTypes.Auto}
/>;
```
Loading

0 comments on commit 49ae910

Please sign in to comment.