# App Setup

## Firebase Configuration <a href="#admin-web-dashboard" id="admin-web-dashboard"></a>

### 1. Create a Firebase Project <a href="#id-1-create-a-firebase-project" id="id-1-create-a-firebase-project"></a>

Head over to [Firebase.com](https://firebase.google.com/) and create a new account. Once logged in, you’ll be able to create a new project in the [Firebase Console](https://console.firebase.google.com/u/0/).

* Create a new account on [Firebase.com](https://firebase.google.com/)
* Create a new project in [Firebase Console](https://console.firebase.google.com/)
* Enable Phone, Google & Facebook auth method in *Firebase Console* -> *Authentication* -> *Sign-in method*
* Create a new iOS app, with App ID *com.example*

![](https://688338901-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGmfhCy2pCAN8pvGNqh%2F-MGr21XPbwb3Cz8FxLcx%2F-MGr2Vp9VRhMmx-5prnl%2FScreenshot%202020-09-10%20at%201.37.07%20PM.png?alt=media\&token=a9682a0e-2332-4d5f-96ca-a56c62701c79)

* Create a new Android app with package name *com.example*
* Download the configuration file generated at the next step to your computer (*GoogleService-Info.plist* for iOS, and *google-services.json* for Android)
* Create database from Cloud Firestore

![](https://688338901-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGmfhCy2pCAN8pvGNqh%2F-MGr21XPbwb3Cz8FxLcx%2F-MGr4XxxJQ_DEgJEx88H%2FScreenshot%202020-09-10%20at%201.45.00%20PM.png?alt=media\&token=01525019-59b8-4628-b6c4-9dc0b990311f)

### 2. Create a Cloudinary Account <a href="#id-1-create-a-firebase-project" id="id-1-create-a-firebase-project"></a>

* Create a cloudinary app for media uploading. <https://cloudinary.com/documentation/how_to_integrate_cloudinary>

### 3. Create a Stripe Account <a href="#id-1-create-a-firebase-project" id="id-1-create-a-firebase-project"></a>

* Create a stripe account for the payment gateway. <https://www.paulisystems.net/how-to-create-a-stripe-account-for-online-payment-processing/?cn-reloaded=1>

## Mobile App Configuration <a href="#admin-web-dashboard" id="admin-web-dashboard"></a>

Steps to initiate the app.

* Go to the App folder

* Type on terminal: `npm install`

* Open a code editor of your choice.<br>

* Go to `src/config/config.js`. Update\
  `WEB_CLIENT`  with `YOUR_WEB_CLIENT`  (Get this value from Firebase console > Authenication > Sign in Method > Google > Web SDK Configuration)\
  `CLOUDINARY_PRESENT_NAME,` with `YOUR_CLOUDINARY_PRESENT_NAME` (Get this value from Cloudinary dashboard > Settings > Upload > Upload presents)\
  `CLOUDINARY_CLOUD_NAME` with `YOUR_CLOUDINARY_CLOUD_NAME` (Get this value from Cloudinary dashboard)\
  `STRIPE_PUBLIC_KEY` with `YOUR_STRIPE_PUBLIC_KEY` (Get this value from Stripe dashboard > Developers > API keys)

  `STRIPE_CLOUD_SERVER_URL` with `YOUR_STRIPE_CLOUD_SERVER_URL` (Get this value from  below **How to get stripe cloud URL**)&#x20;

  `IS_STRIPE_LIVE`  set `true` and `false` (Set true if you use live `STRIPE_PUBLIC_KEY` otherwise false)

* Facebook Setup On Android and iOS\
  iOS:\
  1\) Navigate to **`ios`** folder\
  2\) Navigate **`Epicbae/Info.plist`** replace the `value` of `FacebookAppID` and `FacebookDisplayName` with `YourFacebookAppID` & `YourFacebookDisplayName`  \
  Android: \
  1\) Navigate to **`android`** folder\
  2\) Navigate **`app/src/main/res/values/strings.xml`** replace the `value` of `facebook_app_id` and `fb_login_protocol_schema` with `yourfacebook_app_id` & `yourfb_login_protocol_schema`

* Firebase Setup on Android and iOS\
  iOS:\
  1\) Navigate to **`ios/Epicbae`** folder\
  2\) Added **`GoogleService-Info.plist`** file to project \
  Android:\
  1\) Navigate to **`android/app`** folder\
  2\) Added **`google-services.json`** file to project<br>

* If you would like to run the app in Android, you need to connect an Android phone to a system or you can run the app on an Android emulator. Type `react-native run-android` Make sure that you have configured the AVD before running the command. If you would like to run the app on an iPhone simulator(MacOS), run `react-native run-ios`.\
  NOTE: Make sure you run the Epicbae.xcworkspace project<br>

### 2. How to get stripe cloud URL <a href="#id-1-create-a-firebase-project" id="id-1-create-a-firebase-project"></a>

* We then need to install the firebase-tools package globally using NPM.\
  `$ npm install -g firebase-tools`
* Now we have firebase-tools installed, we should log in to our firebase account and initiate a new project in our project directory. You will get a choice of which services you would like to use — you only need to select ‘Functions’ here for now.\
  `$ firebase login` \
  `$ firebase init`
* Let’s move into the functions folder.\
  `$ npm install`
* We can then deploy our function and get our endpoint (Function URL in output in screenshot).\
  `$ firebase deploy --only functions`

![](https://688338901-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGmfhCy2pCAN8pvGNqh%2F-MHK2DnTpVz2rgalTVKR%2F-MHKJuMWQt9eOkyrjc8L%2Fs.png?alt=media\&token=d6940d1d-7300-43a2-b703-114d7f457e73)

* **Additional Information** \
  1\) Here is Facebook Authentication Step for Integration on iOS and Android  <https://firebase.google.com/docs/auth/?authuser=0>\
  2\) Here is Stripe payment with Firebase Cloud function tutorial\
  <https://medium.com/enappd/stripe-payment-integration-in-react-native-apps-using-firebase-926c3b1f1448>

&#x20;
