coopcycle / coopcycle-app

CoopCycle native app
MIT License
151 stars 33 forks source link

CoopCycle

Build Status

Prerequisites

Setup - Firebase

Create a Firebase account.

Android

Follow the Firebase instructions to download and copy google-services.json to the android/app folder.

iOS

Follow the Firebase instructions to download and copy GoogleService-Info.plist to the ios/ folder.

Setup - All Platforms

Install dependencies with Yarn.

$ yarn install

Populate your local .env file:

$ cp .env.dist .env

Setup - Linux

Setup - Android

Get a Google Maps API Key

A Google Maps API Key is needed at compilation time for Android (see AndroidManifest.xml).

GOOGLE_MAPS_BROWSER_KEY=YOUR_API_KEY
GOOGLE_MAPS_ANDROID_KEY=YOUR_API_KEY

Those keys won't work for address autocomplete if you don't have billing enabled in Google Cloud. Before enabling billing in your project, read and check the the terms and conditions for the free trial.

Setup - iOS

iOS development requires macOS and CocoaPods.

$ bundle install
$ cd ios && USE_FRAMEWORKS=static NO_FLIPPER=1 bundle exec pod install

Running App

Start the bundler

yarn start

Run the Android app

yarn android

Run the iOS app

yarn ios
With Npx
    npx react-native start
    npx react-native android

For iOS replace android with ios.

Testing

yarn test
Detox (end-to-end testing):

Setup: https://wix.github.io/Detox/docs/introduction/environment-setup

Build the app and run tests:

Android:

detox build -c android.emu.debug
detox test -c android.emu.debug

iOS:

detox build -c ios.sim.debug
detox test -c ios.sim.debug

Make sure that you have emulators set up as specified in .detoxrc.js > devices or use --device-name parameter while running tests. For example: detox test -c android.emu.debug --device-name="Pixel_8_API_34"

Troubleshooting

« Have you tried turning it off and on again? »

watchman watch-del-all
rm -rf $TMPDIR/react-*
rm -rf $TMPDIR/metro-*
rm -rf ~/.rncache
rm -rf node_modules
rm yarn.lock
yarn cache clean
yarn install