Skip to content
Yoroi Wallet - iOS and Android
Branch: develop
Clone or download
Latest commit fce1e21 Jun 11, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci removed default cache usage definitively. If we don't have a specific… Apr 30, 2019
__mocks__ Integrate react-native-cardano to the project Oct 29, 2018
android Merge pull request #682 from Emurgo/nicarq/ch1310/fastlane-android Jun 10, 2019
flow-typed/npm fixed flow. Mar 12, 2019
ios project ifix Jun 6, 2019
precompiled-targets adds missing android targets in zip Apr 9, 2019
src New Crowdin translations (#679) Jun 7, 2019
translations added basic support of react-intl Feb 19, 2019
.babelrc remove l10n from app redux state Mar 6, 2019
.buckconfig react-native init. Oct 2, 2018
.eslintrc.js eslint fixes Mar 12, 2019
.flowconfig fixed flow. Mar 12, 2019
.gitattributes react-native init. Oct 2, 2018
.gitignore working! May 24, 2019
.gitmodules Integrate react-native-cardano to the project Oct 29, 2018
.nvmrc Adds fastlane to iOS Dec 27, 2018
.watchmanconfig react-native init. Oct 2, 2018
Gemfile Adds fastlane to iOS Dec 27, 2018
Gemfile.lock adds fastlane Jun 7, 2019
README.md update readme Apr 9, 2019
crowdin.yml fixed jp mapping, added spanish Apr 30, 2019
get_rust.sh get_rust.sh: add ios targets. Feb 6, 2019
global.js Add crypto node module to globals Nov 29, 2018
index.js Update circleci build rust Oct 12, 2018
install_precompiled_targets.sh precompiled-targets Apr 9, 2019
package.json Merge branch 'develop' into nicarq/ch824/move-crashlytics-to-sentry May 24, 2019
rn-cli.config.js eslint fixes Mar 12, 2019
rust.md Update circleci build rust Oct 12, 2018
yarn.lock Merge branch 'develop' into nicarq/ch824/move-crashlytics-to-sentry May 24, 2019

README.md

Development

Installation

Both platforms

# install rustup
curl https://sh.rustup.rs -sSf | sh

# use 1.32.0 version
rustup toolchain install 1.32.0
rustup install 1.32.0
rustup target add wasm32-unknown-unknown --toolchain 1.32.0

ios

Install cocoapods and download ios dependencies:

gem install cocoapods
cd ios && pod install

Copy your GoogleService-Info.plist to ios/emurgo.

Setup React Native third-party libraries (Run these after yarn install):

node_modules/react-native/scripts/ios-install-third-party.sh
node_modules/react-native/third-party/glog-0.3.5/configure

In case of problems generating the compiled targets for iOS. You can use the precompiled targets

sh install_precompiled_targets.sh

If you get an error of the style:

Could not list contents of '/Users/myself/yoroi-mobile/third-party/glog-0.3.5/test-driver'. Couldn't follow symbolic link.

Command for updating link ln -sf /usr/local/share/automake-<version>/test-driver <path_to_repo>/third-party/glog-0.3.5/test-driver

android

Windows (Physical device)

This requires a physical Android phone & USB cable

  1. Download VirtualBox
  2. Expose the USB to VirtualBox guide here Note: You MUST expose USB 2.0 for Android devices. Exposing 3.0 will not work
  3. If your devices still doesn't appear, follow these steps 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
  2. adb kill-server
  3. adb connect 10.0.2.2:5555

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

  1. Open VirtualBox
  2. VM Settings > Network >> Advanced > Port Forwarding
  3. Enter 8081 as Host Port and Guest Port (leave everything else blank)

Android Setup

# install & stup android studio
follow https://facebook.github.io/react-native/docs/getting-started.html (tab Building Projects with Native Code)
  1. Ask for a copy of (or create a blank version of) android/gradle.properties.local, android/app/google-services.json and android/app/api-XXXX.json
  2. Make sure your Anddroid build tools match the version in android/build.gradle (you will get an error otherwise)
  3. Download the NDK form Android Studio
  4. Install Rust for Android rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android

First time

  1. yarn install
  2. yarn setup_configs - links libraries to ios testnet build configurations

If these steps fail, try looking at the android CLI

Launching

  1. react-native start - this will run RN packager, let it running

  2. react-native run-android --variant=devDebug - for version with testnet

  3. react-native run-android --variant=mainDebug - for version with mainnet

  4. react-native run-ios --scheme=emurgo-staging --configuration=Staging.Debug - staging (testnet) configuration

  5. react-native run-ios --scheme=emurgo --configuration=Debug - production configuration

Debugging

Read through this page to understand debugging for React-Native

React-Native Debugger

This will allow you to put breakpoints and everything else you would ever need.

  1. Download & run https://github.com/jhen0409/react-native-debugger/releases
  2. While app is running, open debug menu
  3. Select Debug JS remotely

Releasing

  1. Follow Signed Android APK 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 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

Code style

Imports

The imports should be in this order:

  1. import of external libraries
  2. import of our custom code
  3. import of component styles
  4. import of types

Example:

// @flow

// external libraries
import React from 'react'
import {compose} from 'redux'
import {connect} from 'react-redux'
import {View} from 'react-native'

// our code
import Screen from '../../components/Screen'
import AdaIcon from '../../assets/AdaIcon'
import {confirmationsToAssuranceLevel, printAda} from '../../helpers/utils'

// styles
import styles from './TxDetails.style'

// types
import type {NavigationScreenProp, NavigationState} from 'react-navigation'
import type {TransactionType} from '../../types/HistoryTransaction'

Styles

  • If you use component in multiple screens, it should be in UiKit folder with other UI components and imported from it.
  • Each component file has own file with styles.
  • Don't import multiple style files into one component.
  • Keep the style's structure flat.
  • If there is same component in UiKit as in react-native, use the one from UiKit.
// src/components/UiKit/index.js
// Example of export for a default component that can be imported from UI.
export {default as Button} from './Button'
import {Text, Button, Input} from '../UiKit'

// ...

Variables

import {colors} from './config'

// Wrong
// The background color can change, gray is constant name for specific color.
background: colors.GRAY
// ...

// Good
// Changing the background color doesn't require to change the name.
// We want to change values, not labels most of time.
background: colors.background
// ...
You can’t perform that action at this time.