TreeMama / iSeaTree-React-Prototype

Prototype for the iSeaTree (a mobile app which creates compatible data collection for the iTree project).
MIT No Attribution
14 stars 9 forks source link
# iSeaTree-React-Prototype

This is the repository for iSeaTree, a mobile app which observers can use to collect data for the iSeaTree project.

What’s the project about?

The iSeaTree project is an open source project for building the react-native iSeaTree app (available in iOS and Android). Links to our current releases can be found on our TreeMama.org webpage. This project utilizes the USDA's US Forest Service iTree API to calculate the individual CO2/Stormwater tree benefits of trees. iSeaTree is an educational tool, and was founded by Treemama.org with the belief that "kids can do more for then environment then just study it - they can participate in conserving it!".

Git repository branching guidelines for contributors

We follow a relaxed version of the Git Flow workflow.

The develop branch is the default branch. The develop branch is always ready to be released. It contains only completed features and completed bugfixes. Do not commit directly to develop; use pull requests and merges from feature branches instead.

All feature and bugfix work is done in feature branches, branching from develop, and named with the pattern feature/<short descriptive name>. Code reviews are not required, but pull requests are required. You can approve your own PR, or you can tag another team member to review it if you like.

Use descriptive names for feature branches. You can use the #234 syntax in the comments to link to a particular issue or pull request. But please name your branches descriptively, so that another human can look at the branch name and understand what it's about.

The release branch is where all releases are built from. You will not touch the release branch at all unless you are deploying a release to an app store. Update the version number and build number directly in the release branch, just before release. Do not commit directly to release, except for edits of of the files that control the version number and build number. Merge all other changes to release from develop.

To add a feature or fix a bug:

To update the version or build number:

Please keep these in sync for Android and iOS.

Android version and build number are controlled by android/app/release/output-metadata.json.

iOS version and build number are controlled by ios/iSeaTree/Info.plist. Info.plist is an XML file. You can edit it with a text editor, no need for Xcode.

Development toolkit

This project uses [react-native-cli]. Here is a guide how to get started with react-native-cli. react-native-cli is contains the actual React Native framework code and is installed locally into your project, react-native-cli project is said to be a pure React Native app, since none of the native code is hidden away from the developer. a development tool that runs interpreted JavaScript on your mobile device, in debug mode. react-native-cli project has native code for Android and iOS, so, you can perform any release related operation for Android and iOS, by using Android Studio and Xcode respectively.

You need Xcode or Android Studio to work on this project. It doesn't matter which one you use. You'll be working on the JavaScript code in whatever text editor you like (many of us use VSCode). The IDE is used only to wrap the JavaScript and package it for Android or iOS devices.

Tookit prerequisites

This is a one-time setup for each computer you'll do Yarn/react-native-cli development on.

Although we no longer use the Expo platform, there are still some Expo-prefixed node modules in use. This is not an oversight.

Installation

From the project's root directory run:

yarn install

This sets up Yarn for the iSeaTree project directory.

Note: you'll probably have to run yarn install after a git pull, if the updated code has added React libraries or changed library versions.

Source Code Secrets

There are 3 critical files NOT CHECKED in that you will need (as a developer) to interact with the iTree API & the backend firebase database(s).

To get these files - contact an iSeaTree project administrator.

The 3 files are:

./verify-checksums.sh

will check to see whether you have envVariables.ts in the right place, and whether it is the current production or development version or something else.

For project administrators: when you update envVariables.ts

For Google map functionality we have to add "google api key" in the below file

Running in a simulator

In your terminal window, change directories to the project root. Then

This command launches a metroServer on your computer and loads the JavaScript source code for the project.

Possible failure modess:

Running on a real mobile device

You'll want to use a real mobile device if you're doing anything with the camera.

To create a standalone native build that we can submit to the iOS App Store, we need to create a cryptographically signed .xcarchive file using Xcode. That procedure is described in the iOS document too.

Interacting with the Android Simulator

when you run npx react-native run-android it run the application on all devices which enabled debug mode.

To obtain a standalone native build, we have android folder that contain native code for our application, by open it on Android Studio, we can make signed APK.

Linting

This project has configured Eslint with recommended typescript and react rules.

Production builds

Do not change version or build number yourself. Follow the procedures documented in the App store release instructions. Version and build numbers must be changed simultaneously for the Android and iOS versions. The version update must be a single commit, performed in the release branch, and is the only operation in that commit.

General architecture/history/backstory

Prior to September 2021, the project used expo-cli package. In order to add certain features, including our AR-tool and the Jest test framework we removed expo with the work done in Issue #299. This made the project react-native only (and fundamentally changed how we build and test our source code).

Key dependency changes

why change expo-camera dependency with react-native-camera?