Skip to content

Commit

Permalink
Merge branch 'develop' into wallet-address
Browse files Browse the repository at this point in the history
  • Loading branch information
vsubhuman committed Jul 24, 2021
2 parents 6af9369 + 17d6534 commit c772c5f
Show file tree
Hide file tree
Showing 50 changed files with 709 additions and 550 deletions.
44 changes: 22 additions & 22 deletions .github/workflows/pr-checks.yml
Expand Up @@ -2,40 +2,40 @@ name: PR Checks

on:
pull_request_review:
types: [ submitted ]
types: [submitted]

jobs:
flow:
if: github.event.review && (github.event.review.state == 'approved' || contains(github.event.review.body, '/check'))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '10.14.2'
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: install
run: |
yarn install
- name: run flow
run: |
yarn flow
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '16.5.0'
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: install
run: |
yarn install
- name: run flow
run: |
yarn flow
lint:
if: github.event.review && (github.event.review.state == 'approved' || contains(github.event.review.body, '/check'))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '10.14.2'
node-version: '16.5.0'
- name: Cache node modules
uses: actions/cache@v1
with:
Expand All @@ -58,7 +58,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '10.14.2'
node-version: '16.5.0'
- name: Cache node modules
uses: actions/cache@v1
with:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -98,4 +98,5 @@ app-mainnet-release.apk
output.json
java_pid*

flow-coverage
flow-coverage
.eslintcache
1 change: 1 addition & 0 deletions .husky/.gitignore
@@ -0,0 +1 @@
_
5 changes: 5 additions & 0 deletions .husky/pre-commit
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
yarn flow
2 changes: 1 addition & 1 deletion .nvmrc
@@ -1 +1 @@
v10.14.2
v16.5.0
31 changes: 22 additions & 9 deletions README.md
@@ -1,7 +1,7 @@
# Download

| Android | iOS |
|---|----|
| Android | iOS |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [<img src="https://pbs.twimg.com/profile_images/1164525925242986497/N5_DCXYQ_400x400.jpg" width="48">](https://play.google.com/store/apps/details?id=com.emurgo) | [<img src="https://pbs.twimg.com/profile_images/1283958620359516160/p7zz5dxZ_400x400.jpg" width="48">](https://apps.apple.com/us/app/emurgos-yoroi-cardano-wallet/id1447326389) |

Looking for the Yoroi Extension? See [here](https://github.com/Emurgo/yoroi-frontend)
Expand All @@ -12,7 +12,7 @@ Looking for the Yoroi Extension? See [here](https://github.com/Emurgo/yoroi-fron

### Both platforms

Make sure your Node.js version matches `v10.14.2`. If you have `nvm` installed, you can just `nvm use`
Make sure your Node.js version matches `v16.5.0`. If you have `nvm` installed, you can just `nvm use`

```
# install rustup
Expand All @@ -23,6 +23,7 @@ rustup toolchain install 1.41.0
rustup install 1.41.0
rustup target add wasm32-unknown-unknown --toolchain 1.41.0
```

Make sure `rustc --version` outputs `1.41.0`, which is the stable version (and not nightly).

### ios
Expand All @@ -49,21 +50,24 @@ This requires a physical Android phone & USB cable

1. Download [VirtualBox](https://www.virtualbox.org/wiki/Downloads)
1. Expose the USB to VirtualBox [guide here](https://www.wikihow.tech/Connect-a-USB-to-Virtualbox)
**Note**: You MUST expose USB 2.0 for Android devices. Exposing 3.0 will not work
**Note**: You MUST expose USB 2.0 for Android devices. Exposing 3.0 will not work
1. If your devices still doesn't appear, follow [these steps](https://android.stackexchange.com/a/144967)
**Note**: The format for these steps have changed over the years so be careful if you need this.
**Note**: The format for these steps have changed over the years so be careful if you need this.

#### Windows (Virtual Device)

On Host (Setup Android device)

1. Run Virtual Device from Android Studio

On VM (Detect VirtualDevice from VirtualBox)

1. `adb tcpip 5555`
1. `adb kill-server`
1. `adb connect 10.0.2.2:5555`

On Host (allow app to connect to packaged bundle after build)

1. Open VirtualBox
1. VM Settings > Network >> Advanced > Port Forwarding
1. Enter `8081` as Host Port and Guest Port (leave everything else blank)
Expand All @@ -81,6 +85,7 @@ follow https://facebook.github.io/react-native/docs/getting-started.html (tab Bu
1. Install Rust for Android `rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android`

### First time

Make sure the rust targets for the platform you will work on (android/iOS) have been correctly installed with `rustup show`. Then:

1. `yarn install`
Expand All @@ -103,37 +108,46 @@ If these steps fail, try looking at the [android CLI](https://github.com/Emurgo/
## Unit Testing

To run all unit tests:

```bash
$ yarn test
```

You can also run single test files, e.g.:

```bash
$ jest wallet.test.js
```

## End-to-end Testing

For E2E tsting we use the [detox](https://github.com/wix/Detox) framework.

### Requirements

- **iOS**: MacOS 10.13 (High Sierra) or higher, Xcode 10.1 or higher.
- **Android**: Tested on Android Studio 3.5.1. Simulator: Android >= 9, API >= 28 (but prior versions may work too).

### Setup (applies to iOS only)

You only need to follow the instructions listed in the Step 1 of Detox's official [docs](https://github.com/wix/Detox/blob/master/docs/Introduction.GettingStarted.md#step-1-install-dependencies):

```bash
$ brew tap wix/brew
$ brew install applesimutils
$ npm install -g detox-cli
```

### Building and Running

Important: You need to build the app not only the first time you run the tests but also anytime you modify the code.

```bash
$ yarn e2e:build-android # for ios just replace "android" by "ios"
$ yarn e2e:test-android
```
This will build and test a *release* version of the app.

This will build and test a _release_ version of the app.

# Debugging

Expand All @@ -147,20 +161,19 @@ This will allow you to put breakpoints and everything else you would ever need.
1. While app is running, open debug menu
1. Select `Debug JS remotely`


# Releasing

1. Follow [Signed Android APK](https://facebook.github.io/react-native/docs/signed-apk-android) to generate and setup signing certificate for Android
(required only before first release).
2. `cd android`
3. `./gradlew assembleMainRelease`

*Important*: You may run into `Could not follow symbolic link third-party/glog-0.3.5/test-driver` error
_Important_: You may run into `Could not follow symbolic link third-party/glog-0.3.5/test-driver` error
if you try to build Android release on Mac. This is caused by incorrect linking in react-native/npm.
To fix the issue, locate path where `automake` is installed (default `/usr/local/share`) and re-link
file by running command:

```ln -sf /usr/local/share/automake-<version>/test-driver <path_to_repo>/third-party/glog-0.3.5/test-driver```
`ln -sf /usr/local/share/automake-<version>/test-driver <path_to_repo>/third-party/glog-0.3.5/test-driver`

# Troubleshooting

Expand Down
58 changes: 35 additions & 23 deletions package.json
Expand Up @@ -24,7 +24,26 @@
"e2e:test-android-debug": "detox test -c android.emu.mainnet.debug",
"e2e:build-android-debug": "detox build -c android.emu.mainnet.debug",
"prestorybook": "rnstl --searchDir ./src/components --pattern '**/*.stories.js'",
"storybook": "start-storybook"
"storybook": "start-storybook",
"prepare": "husky install"
},
"lint-staged": {
"*.{js,jsx}": [
"eslint --cache --fix --max-warnings=0",
"prettier --write",
"flow focus-check"
],
"*.{md,json}": "prettier --write"
},
"jest": {
"preset": "react-native",
"testMatch": [
"**/__tests__/**/*.[jt]s?(x)",
"**/?(*.)+(test).[jt]s?(x)"
],
"transform": {
"^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
}
},
"dependencies": {
"@babel/cli": "7.12.8",
Expand Down Expand Up @@ -139,9 +158,12 @@
"flow-bin": "0.126.0",
"flow-coverage-report": "0.8.0",
"flow-typed": "3.1.0",
"husky": ">=6",
"jest": "25.1.0",
"lint-staged": ">=10",
"metro-react-native-babel-preset": "0.59.0",
"prettier": "2.3.2",
"prettier-plugin-packagejson": "^2.2.11",
"prettylint": "1.0.0",
"react-dom": "16.8.3",
"react-intl-translations-manager": "^5.0.3",
Expand All @@ -150,29 +172,7 @@
"react-native-storybook-loader": "^1.8.1",
"react-test-renderer": "16.13.1"
},
"jest": {
"transform": {
"^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
},
"preset": "react-native",
"testMatch": [
"**/__tests__/**/*.[jt]s?(x)",
"**/?(*.)+(test).[jt]s?(x)"
]
},
"xcodeSchemes": {
"Debug": [
"Staging.Debug"
],
"Release": [
"Staging.Release"
]
},
"engineStrict": true,
"engine": {
"node": "~10.14.2",
"npm": "~6.4.1"
},
"detox": {
"test-runner": "jest",
"configurations": {
Expand All @@ -199,5 +199,17 @@
}
}
}
},
"engine": {
"node": "~16.5.0",
"npm": "~7.19.1"
},
"xcodeSchemes": {
"Debug": [
"Staging.Debug"
],
"Release": [
"Staging.Release"
]
}
}
13 changes: 1 addition & 12 deletions src/actions/language.js
@@ -1,6 +1,6 @@
// @flow

import {writeAppSettings, APP_SETTINGS_KEYS, loadTOS} from '../helpers/appSettings'
import {writeAppSettings, APP_SETTINGS_KEYS} from '../helpers/appSettings'

import {type Dispatch} from 'redux'

Expand All @@ -16,20 +16,9 @@ export const changeLanguage = (languageCode: string) => (dispatch: Dispatch<any>
})
}

export const changeTOSLanguage = (tos: string) => (dispatch: Dispatch<any>) => {
dispatch({
path: ['tos'],
payload: tos,
reducer: (state, tos) => tos,
type: 'CHANGE_TOS_LANGUAGE',
})
}

export const changeAndSaveLanguage = (languageCode: string) => async (dispatch: Dispatch<any>) => {
await writeAppSettings(APP_SETTINGS_KEYS.LANG, languageCode)
const tos = await loadTOS(languageCode)

dispatch(changeTOSLanguage(tos))
dispatch(changeLanguage(languageCode))
}

Expand Down
1 change: 0 additions & 1 deletion src/components/Common/FingerprintScreenBase.js
Expand Up @@ -20,7 +20,6 @@ const messages = defineMessages({
welcomeMessage: {
id: 'components.common.fingerprintscreenbase.welcomeMessage',
defaultMessage: '!!!Welcome Back',
description: 'some desc',
},
})

Expand Down

0 comments on commit c772c5f

Please sign in to comment.