To run the app locally we need to provide a couple of native dependencies (XCode, AndroidStudio).
Setup differs between platform therefore the best place to follow is
Setting up the development environment guide for
React Native CLI Quickstart
(sections Installing dependencies and Preparing the Android
device (just for android development).
Also a proper environment variables should be provided. Create a file at the app root named .env
and provide a proper env specific variables (variables in .env.example
can be used as a default to
run on the dev
environment).
After environment setup is completed you can start the app in emulator (yarn start:ios
or
yarn start:android
).
_Note: For ios before starting the app for the first time and after any changes to the ios
native modules pod
's should be installed manually.
yarn install-pods
yarn start
yarn start:ios
yarn start:ios:release
yarn start:android
yarn start:android:release
Often it's required to clean app artifacts (metro bundler cache, watchman cache, ios build folder / pods, etc.) to make the app building again. To avoid repeating commands manually two scripts are available.
To clean automatically and reinstall dependencies use
yarn clean
For a more fine-grained control use manual mode
yarn clean:manual
yarn format
To fix automatically formatting issues use
yarn format:fix
To run typescript compiler in no-emit mode use
yarn tsc
Given that react-native
uses under the hood babel to compile typescript it won't throw an error on
type mismatch therefore always run yarn tsc
to force type checking.
Before running e2e tests make sure you have followed E2E tests setup guide.
yarn e2e:ios-debug
yarn e2e:ios-release
yarn e2e:android-debug
yarn e2e:android-release
For debugging Flipper is the best choice. It includes a build in doctor
tool that will help you with installing missing pieces (ios idb
cli tool, correct paths to SDK's,
etc).
Our app additionally has support for the following flipper plugins:
You can install plugins though Flipper desktop app:
Manage Plugins > Install Plugins > search "redux-debugger" > Install
Unfortunately Flipper doesn't support code debugging, given that, good old Chrome Dev Tools are the most useful.
Apk is signed using debug
keystore which is committed to repository with cleantext passwords. The
application id is org.neufund.mobile
(TODO: we should add .debug
postfix soon)
Android release uses aab
(bundle) format. In that scheme, the final signing key is maintained by
Google in Play Store and bundle is signed with upload key. The application id is
org.neufund.mobile
. To generate and sign you should follow the steps.
- Make sure you have Java JDK and Android build toolchain available with SDK level 28.
- Valid
.env
file must be present containing valid production configuration (like Firebase service access) - You need keystore in
wallet/android/app/production.keystore.p12
- specify signing config name in
NF_WALLET_ANDROID_RELEASE_SIGCONFIG_NAME
, if missing it defaults todebug
- specify signing keys for
production
signing config inNF_WALLET_ANDROID_PRODUCTION_KEYSTORE_PASS
- Make sure you build the react app, run
yarn
from repository root. - build apk (
./gradlew :app:assembleRelease
) or bundle (./gradlew :app:bundleRelease
). you mustcd
to[..]/wallet/android
- verify release build with
jarsigner -verify -verbose -certs app/build/outputs/apk/release/app-release.apk
Encrypted keystore is committed to repo. We use PKCS12 format. JKS are cryptographically inadequate and should not be used: https://publik.tuwien.ac.at/files/publik_279118.pdf p. 13. We use randomly generated 256bit password. To figure out keystore format:
- make sure keystore is in PKCS12 format with
keytool -list -v -keystore app/production.keystore
Keystore type: jks
Keystore provider: SUN
- convert to keytool -importkeystore -srckeystore app/production.keystore -destkeystore app/production.keystore.p12 -srcstoretype JKS -deststoretype PKCS12 -deststorepass [..] -destkeypass [same as deststorepass]
- verify again
Keystore type: PKCS12
Keystore provider: SUN
- mind that PKCS12 uses same password for keystore and private keys protection