/puente-reactnative-collect

[Mobile] Application for Data Collection and Asset Identification Using React Native

Primary LanguageJavaScriptMIT LicenseMIT

Puente - Collect

made with expo supports iOS and Android

Build Status Codacy Badge codecov Tuple

Here are some quick npm commands to get started:

  • npm install: Install Node dependencies
  • npm start: Start expo.
  • npm test: Run the test suit and watch for changes.
  • npm build: Build a production optimized bundle of the app.
  • npm lint-fix: Run the ESLinter.

Async Storage Values

Name of Value Description of Data
assetMapRegion Region location numbers of asset map
organization Name of the surveying users surveyingOrganization
residentData All SurveyData parse model data stored based on the users surveyingOrganization
offlineIDForms All SurveyData forms collected when user is offline
offlineSupForms All Supplementary/Custom forms collected when user is offline
offlineHouseholds All Household parse model created when user is offline
pinnedForms All local pinned form data that the user choses when the long press on a custom form

Select Values with Text Input

Select and MultiSelect PaperInputPicker fieldTypes have the option to have a text associated with a given select option.

For example if you wanted the user to have the option to add text when a user selects "Other", you would format your config for the field like this:

{ "label": "Some text.", "formikKey": "KEY", "value": [''], "fieldType": "select", "options": [ { "label": "Some text, "value": "some_val" }, { "label": "Other", "value": "OTHER", "text": true, "textKey": "__KEY__OTHER" } ] }

Important notes: "text": true

  • This adds the text input field to the Other select option "textKey": "KEYOTHER"
  • __: The double underscore at the beginning of the key is required. No other keys in the config use this and CANNOT use the double underscore or there will be errors
  • KEY: this portion of the textKey needs to be an exact match to the formikKey of the field
  • __: Second double underscore is also required. Without the first double underscore it will not matter.
  • OTHER: This portion of the key is a direct match to the value of the select option. This is required to append the text input value to the original value in the array
  • none of these values need to be capitalized

Deployment

Secrets

This project dynamically creates the required app.json in order to avoid commit secret keys in the project. The related commands are:

  • npm run prepublish: Generates an app.generated.json that we use for the rest of the deployment process. It runs a script in scripts/dynamic-env that does a deep merge of our app.secrets.json file with all our application keys and app.json to create app.generated.json. This will have to be run before publishing to the store

Standalone apps

For releases and bumping versions of app.json, we have:

  • npm run release-patch: Does a patch bump i.e. 1.0.0 to 1.0.1
  • npm run release-minor: Does a minor bump i.e. 1.0.0 to 1.1.0
  • npm run release-major: Does a major bump i.e. 1.0.0 to 2.0.0

NOTE it is REQUIRED to do some sort of bump in order for the app to be upload to its respective stores. Google Play and Itunes Connect disallows applications with the same bundleIdentifier or packageNumber in the store.

Lastly for actual deployment, we have:

  • npm run publish-staging: Runs npm run prepublish which generates our app.generated.json and publishes a staging application to Exp
  • npm run publish-prod: Runs npm run prepublish which generates our app.generated.json and publishes a production application to Expo
  • npm run upload: Uploads the lates staging or production application (uploaded in Expo) to both Google Play and iTunes Connect

Testing

Commands

We use jest for both unit tests and for integration/cross-stack tests.

npm run test unit runs unit tests

npm run test int runs integration tests

Resources

Troubleshooting

Standards

js-standard-style