Plogalong is an app for iOS and Android designed to encourage new and existing ploggers to record the litter they pick up while walking, running, or exercising outdoors.
This is a project of Code for Boston. If you would like to get involved in helping us develop the app, join us at the next Hack Night, and we can help you get started.
We're in the beginning stages of development, but we have a very detailed Mockup.
-
React-Native + Expo: React Native is built on the same bones as React for web, except that instead of building user interfaces from DOM elements, you use platform-native views (UIViews on iOS, Views on Android). Expo is a managed version of React Native that includes a library of components known to be compatible with each other. It adds some tooling that help in the development cycle.
-
Redux for managing local state
-
Database - Firebase
-
Authentication - Firebase
-
Clone this repository (How To Clone A Git Repository)
-
Node (10.x or 12.x) -- ensure that you have a recent version installed - https://nodejs.org/en/download/ Please use a LTS (even) version
-
Make sure that /usr/local/bin is in your $PATH by opening Terminal and typing in echo $PATH (if it's not, follow directions here: https://opensource.com/article/17/6/set-path-linux)
-
(iOS) Install Xcode This may take a while... why not go plogging for an hour?
...then launch it at least once so that you can agree to its Terms and Conditions. -
(Android) Install Android Studio and create a virtual device.
See here for detailed instructions To create a virtual device from the Android welcome screen, click configure>AVD Manager To edit your virtual device selection from somewhere other than the welcome screen, click on the AVD Manager icon in the toolbar on the top right (looks like a phone with a green android alien)
n.b. Since this app will be deployed on the Google Play Store, when creating a virtual device in the AVD Manager, try to choose a device that has the triangular Google Play Store icon next to it. Download an available system image -
(Optional) Install
yarn
: https://yarnpkg.com/lang/en/docs/install/ -
Install Expo:
npm install expo-cli --global
oryarn global add expo-cli
npm install expo-cli --global) -
Configure Firestore connection: create a new file in the
firebase/
folder, name itconfig.js
. Add the proper values tofirebase/config.js
by copying in the new config info (which you can find pinned in the #plogalong Slack channel). -
Install node modules:
npm install
oryarn install
-
If you need to install an additional dependency, that dependency's documentation may give you instructions for using
npm
oryarn
. If you encounter problems with the npm installation, using the yarn installation might work better. There are also instances when you may need to donpm install
after pulling in new changes from the CfB master branch. -
If you're planning on running this on an Android simulator, you'll have to install the Expo app via the simulated device's Google Play Store. To do so, open Android Studio, open the AVD Manager (icon looks like a phone with a green Android alien in the top right toolbar), click the Play button under "Actions" to launch the simulator. You can then open the Google Play Store on the simulated device. Now search for the Expo app and install it to the simulated device. You may have to launch the simulator from Android Studio each time you want to run the app via Expo.
-
In a terminal window, navigate to the root directory of your local clone of this repository. Type
expo start
to launch Metro bundler and Expo's browser-based developer tools. -
While Expo runs, you can type
i
to run the app in the iOS simulator. In order to use the Android emulator, launch the Android Virtual Device emulator via Android studio (described above), then typea
at the terminal to run the app in the Android emulator. You can also use Expo's local web interface to launch the app.If you type 'i' and get an error, run 'sudo xcode-select -s /Applications/Xcode.app'
-
To run Plogalong on an iOS device:
1. Install Expo on your iOS device from the App Store.
2. Connect both your computer and your iOS device with same Wi-Fi.
3. In Expo XDE in your browser, select Connection > LAN
4. Use the Camera App on your iOS (iOS 11+)Device or any QR code reader (iOS 9 & 10) to scan the QR Code.
5. Your QR code reader / Camera App, will ask if you want to launch the App in Expo Client App, select "Yes"
6. Plogalong should load accordingly -
To run Plogalong on an Android device:
1. Install Expo on your Android device from the Google play store.
2. In Expo XDE in your browser, select Connection > Tunnel. Wait for a new link and QR code to generate below the connection options, and then click on the link to copy it to your clipboard.
3. Open Expo on your Android device. If you are on an emulated Android device, then select Open from Clipboard. Otherwise, select Scan QR Code.
4. There should be a message saying 'Building JavaScript Bundle as the Application loads.
5. Boom! You're ready to Plog.
Check on our Slack channel for the shared configuration file. Save it to
firebase/config.js
.
- Install Firebase CLI:
npm install -g firebase-tools
- In the
firebase/project
directory, runfirebase login
. If prompted, log in to your Firebase account. - Choose the project to use:
- An existing project: Run
firebase use --add
and follow the prompts. (I use the alias"default"
.) - A new project: Run
firebase projects:create
and follow the prompts
- An existing project: Run
- In
firebase/project/functions
runnpm install
. - Deploy with
firebase deploy
. (Seefirebase deploy --help
for additional options.)
Additional setup: see the section on SendGrid below.
Some Firebase features require additional configuration in the shared app config
(app.config.js
). When building, you can optionally specify a
LOCAL_CONFIG_FILE
environment variable. If given, it should be set to the path
(relative to the working directory) of a JS module that exports a config object.
See app.config.js
for the keys you can override.
What it's for: this API is used to send certain transactional emails: for example, user feedback.
- Create an account
- In the SendGrid dashboard, open API keys
- Create a new API key. If you choose to customize the access levels, set "Mail Send" to Full Access.
- Copy the API key
- Open the Sender Authentication page under Settings
- Choose "Authenticate Your Domain" and follow the instructions
- In this repo, cd to
firebase/project
- Set the email configuration options:
plogalong.sendgrid_api_key=SG.xxxxxxx plogalong.admin_email=xxxxxx
Replace SG.xxxxxxx
with the API key you got earlier. The
plogalong.admin_email
option determines the email address that will receive
admin alerts (comment submissions, for instance). It will also be the sender
email unless you provide a separate plogalong.sender_email
option. In either
case, you must complete "Sender Authentication" (above) for the sender domain
or address.
What it's for: this API is used to populate the Current Weather box on the Plog screen
What to do: Register for a free account on Open Weather. Copy your key
from the "API Keys" tab and paste it into the openWeatherMapKey
of your config.json
file.
-
After a pull request is merged, it may specify that node_modules will need to be deleted. When this is the case, delete the
node_modules
folder on your local repo and executeyarn install
in your terminal.
n.b. if you are using npm, executenpm install
instead ofyarn install
-
The time may come when you will have to update Expo on your simulator. To do so on the iOS simulator, execute
expo client:install:ios
in your terminal. If it doesn't take on the first try, try once more. If you're still stuck after two times, consult an expert.
Debugging Plogalong should be no different than debugging any other React Native project, but below are some useful tools for your convenience.
If you're already familiar with debugging React web apps via Chrome DevTools, this is pretty similar. The React Native documentation points out that "the React Developer Tools Chrome extension does not work with React Native" and offers a standalone version of React Developer Tools for debugging.
The steps for installation can be found here.
Similar to React-DevTools is the React Native Debugger published on GitHub by user jhen0409. This standalone app is based on the DevTools in Option 1 above, but may provide more functionality.
For installation via Homebrew, you can follow the README instructions.
Otherwise, you can simply download the appropriate prebuild binary from the release page (choose the .dmg file for macOS and .exe for Windows)
- Open React Native Debugger app, and notice that the default port is set to 8081. With this default window open, select Debugger > New Window (or more simply ⌘T or Ctrl+T) to change the port to 19001. Confirm the new packager port.
- Fire up the Plogalong app via
expo start
just like you always do. - Navigate to the Expo Developer Menu with a shake gesture (Ctrl ⌘ Z in an iOS Simulator, Cmd+M in an Android Emulator), and select "Debug Remote JS" from the menu that pops up on the device.
- The React Native Debugger should connect and you'll see console.log() statements print in the console, be able to inspect elements by triggering the Expo Developer Menu (shake gesture > Toggle Element Inspector), and set breakpoints in the Debugger by navigating to Sources > Page > RNDebuggerWorker.js
- When you're finished, you'll save yourself some trouble the next time you start Plogalong if you remember to "Stop Remote Debugging" via the Expo Developer Menu (shake gesture).
Join us on the Code for Boston Slack. We're in the #plogalong channel.