This repository contains the code for the MassEnergize community app, a mobile companion to the Massenergize community portal. The app mirrors the functionality of the web portal using the React Native framework. This project is currently under ongoing development.
Follow the instructions below to run the app on a simulator on your local machine for testing and development. The following instructions are for Mac users targeting the iOS simulator. Further instructions will be added as needed.
Follow the instructions in the Installing Local API and Database guide to run the backend API on your own
Navigate to the directory where you want the code to be installed and clone the repository with git clone massenergize/massenergize-mobile-application
.
Node is a JavaScript runtime used to run the app and npm is its package manager, used to install and run external libraries used in the app.
Check for an existing verions using node -v
. If none exists, install using brew install node
.
XCode is an IDE used specifically for development targeting Apple operating systems, including iOS. It will be used to run the iPhone simulator and install the app.
XCode can be found on the Mac App Store.
In the project root directory, run npm install
to install the required modules.
CocoaPods is a package manager which we will use to install iOS specific packages.
Check for a Ruby installation using ruby -v
. If none is found, install it with brew install ruby
.
With Ruby installed, install CocoaPods with sudo gem install cocoapods
.
Finally, navigate to the ios
directory and install the required pods using pod install
.
Obtain a copy of the appropriate GoogleService-Info.plist
file from either the project's Firebase Console, the MassEnergize Slack, or by contacting one of the contributors to this repository. Add the file to ios
directory.
Open app/api/config.json and change IS_LOCAL
to true
and both other options to false
:
{
"IS_LOCAL": true,
"IS_PROD": false,
"IS_CANARY": false,
"BUILD_VERSION": "X.X.X"
}
Run the app by running npm start
in the project root directory and pressing i
when prompted.
That's it! Please reach out to William Soylemez or Moizes Almeida by email or Slack with any questions.
To distribute the app on the Apple App Store or on Testflight, we need to upload the app archive to App Store Connect.
In XCode, switch the target device to "Any iOS Device (arm64)", then click on Product -> Archive.
Once the app has finished building, a popup should open displaying all app archives (if not, open it under Window -> Organizer). Select the verison you wish to distribute, click on "Distribute App", and follow the instructions.
The instructions above will configure the app to use the developer (local) backend. To use the production backend, follow these steps:
Switch the API config to use the Canary (or Prod) API:
{
"IS_LOCAL": false,
"IS_PROD": false,
"IS_CANARY": true,
"BUILD_VERSION": "X.X.X"
}
Replace the contents of ios/GoogleService-Info.plist with a production version that can be found in the ME slack here or by reaching out to a ME team member.
Open the updated GoogleService-Info.plist
and copy the value under REVERSED_CLIENT_ID
.
Open XCode and click on the project in the left-hand navigator. Ensure the correct project is picked under "targets" then navigate to "info" and open "URL Types". Replace the value in "URL Schemes" with the ID you just copied from GoogleService-Info.plist
.
Copy the Firebase client ID, the last section of the REVERSED_CLIENT_ID
from the section above, into the first section of the GIDClientID
field of ios/MassenergizeAppV2/Info.plist.
Lastly, open app/pages/RootWrapper.js and update the lines under GoogleSignIn.Configure
with the same part of the REVERSED_CLIENT_ID
as the last step:
GoogleSignin.configure({
webClientId:
'*YOUR_CLIENT_ID*.apps.googleusercontent.com',
});
With that, the app should use the production backend. Please reach out to William Soylemez with questions!
This is a new React Native project, bootstrapped using @react-native-community/cli
.