Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Getting Started

patogallaiovlabs edited this page Jun 28, 2021 · 11 revisions

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

  1. npm install to install dependencies (or npm i).

    1. If you are using Windows, use npm run install:windows to install and fix the broken metro-config blacklist.js file.
  2. Create an environment variable file named .env in the root directory

    # Parse server configuration
    # Server URL https://rwallet.app/v1
    # Devbox Server URL for Android Simulator http://10.0.2.2:1338/parse
    # Devbox Server URL for iOS Simulator http://<YOUR_IP_ADDRESS>:1338/parse
    # RWALLET_ENV: Production, Dogfood or others. If RWALLET_ENV value is "Production", or not set, the final server URL value is the same as Server URL such as "https://rwallet.app/v1"; otherwise, the RWALLET_ENV value will be prepended to Server URL in lower case as a sub-domain. For example, if RWALLET_ENV is "Dogfood" and Server URL is "https://rwallet.app/v1", the final URL is https://dogfood.rwallet.app/v1.
    
    PARSE_SERVER_URL=https://rwallet.app/v1
    RWALLET_API_KEY=6a740128-2ba2-4b82-9301-8cbe07208ee9
    RWALLET_ENV=Dogfood
    
    • If .env file is changed, manually edit the file importing react-native-dotenv (rwallet/config.js) by either adding an empty line or whitespace will work.
    • For security, we force the use of https to transfer data. If you use http during development, you need to set NSAllowsArbitraryLoads to true in the iOS environment and useCleartextTraffic to true in the Android environment.
    • Note: There are 2 examples for Dogfood (.env_dogfood) and Local (.env_local) environments for easy configuration. Copy the files to .env for a quick change of environments.
  3. In order to use firebase messaging on Android/iOS:

    1. Add google-services.json file to Android: ./android/app/.
    2. Add GoogleService-Info.plist file to iOS: ./ios/rwallet/.
  4. (for iOS only) npm run podinstall : will install all pods from ios/Podfile

  5. npm run android or npm run ios. The script will first start server daemon in a separate terminal window, the same effect as npm run start. You should see console output like below.

    > rwallet@0.0.1 start /Users/mikasa/Documents/repos/rwallet
    > node node_modules/react-native/local-cli/cli.js start
    
    ┌──────────────────────────────────────────────────────────────────────────────┐
    │                                                                              │
    │  Running Metro Bundler on port 8081.                                         │
    │                                                                              │
    │  Keep Metro running while developing on any JS projects. Feel free to        │
    │  close this tab and run your own Metro instance if you prefer.               │
    │                                                                              │
    │  https://github.com/facebook/react-native                                    │
    │                                                                              │
    └──────────────────────────────────────────────────────────────────────────────┘
    
    Looking for JS files in
      /Users/mikasa/Documents/repos/rwallet 
    
    Loading dependency graph, done.
    
    • For Android, npm run android will start the app in your physical device or Android virtual device. You need to check what device are available by running adb devices in terminal. To test the app in a physical Android device, you need to make sure Developer Options -> Enable Debugging via USB is turned on for that device. Note: If you encounter an error like below then you need to create a local.properties file under ./android and add one line sdk.dir = /Users/<username>/Library/Android/sdk in it.
      SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/<usernmae>/Documents/repos/rwallet/android/local.properties'.
      
    • For iOS device, npm run ios will start the App in iOS physical or virtual device.
  6. Hot reload code change - Press Command + m on virtual device and select Enable Hot Reloading to hot reload file changes.