540 Commits

Author SHA1 Message Date
Ken-ichi Ueda
1b5599f95c Skip legacy peer deps when running CI tests 2022-06-28 12:27:27 -07:00
Amanda Bullington
9b85991b83 Show comments on ObsDetail (#111)
* Save uuid to Comment realm; rerender ObsDetail when comment deleted; delete comment locally first

* Fix styling for kebab menu; closes #104

* Update package lock

* Get tests passing

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-06-27 11:13:31 -07:00
budowski
0144200e9c Settings Screen (#77)
Gets most of the way toward #27. Blocks, mutes, and some other functionality require API v2 updates. UI needs refinement.
2022-06-09 15:49:22 -07:00
Amanda Bullington
1f2becdef6 Media Viewer (#107)
* Create basic media viewer with full sized image, selection, carousel, and header

* Create photo delete dialog component

* Wrap camera stack in Mortal component instead of resetting state on camera blur

* Use photo carousel in PhotoPreview for standardized photo sizes

* Make media viewer accessible from ObsEdit

* Remove evidencelist component and use photo carousel instead in ObsEdit/suggestions

* code tweaks

* Create realm ObsPhotos in standard camera for passing to media viewer, ObsEdit

* Move resize image function into Photo model

* Update photo preview to use delete photo functions from photo and obsphoto model

* Allow photo deletion in media viewer from ObsEdit, StandardCamera; switch to Modal view

* Swap in zoom functionality instead of carousel, media viewer

* Remove media viewer from nav, now that it's a modal

* Remove comment

* Update babel config with react-native-paper plugin for production

* Mock RN paper Portal component

* Media viewer takes photo uris; handles obsPhoto updates in ObsEdit and photo uri updates in StandardCamera

* Make sure tests pass with optional chaining for obsPhotos

* Update styling for StandardCamera

* Create obsPhotos attached to photos from camera

* Pass photos to StandardCamera from ObsEdit to reflect any changes made in MediaViewer

* Get tests passing

* Fix flow issues

* Change flow type for photoUris

* Add pre-commit hook for flow

* Fix flow erros
2022-06-01 11:10:03 -07:00
Amanda Bullington
c5528c67a9 Edit existing observations (#86)
* Convert Realm objects into plain objects for ObsEdit; check for recently edited obs in ObsList

* Code cleanup; closes #85

* Extend classes with Realm.Object; use .toJSON( ) to edit plain objects with less code

* Check for local updates before syncing from server

* Code cleanup; rename existingObs and remove projects in OtherDataSection
2022-05-12 18:38:26 -07:00
Ken-ichi Ueda
25fe935de0 WRITE permissions for camera / gallery so they can write resized images 2022-05-10 16:32:00 -07:00
Amanda Bullington
f46d4086ad Save observations, photos, sounds in Realm for upload (#78)
* Break uploader into helper function; add bottom model for uploading from obs list

* Create mapping function for uploading observations to iNat

* Mark observations as uploaded when id is returned from server

* Format dates on obs list

* Save all obs locally before trying to upload

* Resize grouped photo gallery photos for upload

* Resize photos btw group photos screen and obs edit

* Get sound, photo, obs uploads saving to realm and uploading later

* ObsEdit progresses to next or prev screen after one obs is saved locally

* Format date in camera; use time observed to show new local obs in ObsList

* Remove time zone attribute, since this is handled by server

* Submit sound and photo uuids as the file name for sound/photo uploads

* Make obsSounds an array in case there are multiple sounds for upload

* Removing time synced from Photo model bc not sure it's necessary

* Save _synced_at and _created_at time for all remote obs

* Fix back button, obs edit

* Don't show obs edit for unuploaded obs

* Get rid of ObservationProvider, move useObservations hook

* Fix place name; add date/time and location to no evidence uploads

* Add species_guess to observation when taxon_id changes

* Format date from picker; use string for sending to server

* Styling cleanup with react-native-paper; make ObsEdit into section components

* Add vector icons to ios (for searchbar)

* Add empty text to CV suggestions

* Cleanup code for marking records synced & uploading to server

* Use placeholder icons on bottom tab bar

* Add icons to ObsList; fix grid view when photo === null

* Fix jest tests

* Simplify setting an identification in ObsEdit

* Move inline styles to separate files

* Display all relevant saved obs data on ObsDetails; function to check for camel or snake case attributes

* Move logic for creating new sound observation to model, not sound recorder

* Add android vector icons

* Move create obs and create with no evidence into Observation model

* Add mock for react-native-fs

* Show option to edit user obs in ObsDetail; fix captive/geoprivacy/date fields for uploaded obs

* Move obsPhoto creation and obs with obsPhoto creation into models

* Create obs with sound from Obs model

* Create multiple obs from gallery photos; move logic into model

* Pass observation to ObsDetails via navigation to avoid opening and closing realm twice

* Lint error fixes

* Fix jest tests

* Use icons on normal camera

* Use timestamps from gallery and camera for new observations

* Keep simplifying code

* Update version/build number; add key to info.plist for faster ios build

* Remove TranslatedHeadline component

* Move saveLocalObservation logic to model

* Move all FIELDS for api calls into models (except messages, which doesn't have a model yet)

* Only show upload UI if user is logged in

* Fix obs edit link so it works for both logged in and logged out users

* Bug fixes: get fields from models; addListener function in test

* Model code cleanup

* More code cleanup

* Remove unused imports
2022-05-10 14:41:31 -07:00
Ken-ichi
09ed361d02 Camera and gallery now display after granting permission (#79)
* Camera and gallery now display after granting permission

Previously these were not quite working because the usePhotos hook was asking
for a permission, so if that was used anywhere in conjunction with another
permission request, one or both success promises never got executed. This
commit tries to solve that with a PermissionGate component that takes a
permission as a prop, asks for it if not granted, then renders its children
when granted. If not granted, it renders a message saying that the permission
is required to use the feature.

Other stuff

* Added `env.example` so people know how to populate `.env`
* Added the `intl-pluralrules` polyfill to support pluralization with i18next
* Skip some token granting logic if the user is not logged in
* Trim whitespace from username/email before auth
* Some minor UI changes to auth form so I know where to tap
* Test fixes

* Use a full screen view for children of PermissionGate

* Globalized text on PermissionGate
2022-04-27 12:36:03 -07:00
Ken-ichi
0c8c9020ec Test fixes (#80)
* Comment model needs a UUID attribute
* mocked useLoggedIn in ObsEdit test
* updated caniuse
* Close Realm when hooks are done
2022-04-26 17:07:55 -07:00
Amanda Bullington
1ebf4b951d Bug fixes from beta 0.0.1 (#75)
* Add exception handler library; fix computer vision results

* Create loggedIn hook to check whether user is logged in before cv suggestions or upload

* Create user profile card on MyObs

* Update packages

* Add text for camera permissions denied

* Remove log

* Upgrade react native on iOS

* Add vendor file for ruby gems to gitignore

* Remove vendor file from github

* Update react native for android

* Add plural example to fluent; create TranslatedText component to render translations

* Add translations and update camera roll screens

* Small changes to uploader flow; add date/time picker

* Separate explore into landing screen and view screen

* Show total number of observations, explore

* Clean up styling and add details for grid view; banner for total observations in explore

* Add checkboxes for status, quality grade, media filters

* Add a lot of explore filters

* Show months in Explore filters

* Create About screen; sync package.json version using react native version

* Get explore filters in mostly working condition

* Observations download after login; clear login screen after nav; closes #62 and #60

* Allow separating photos if at least 1 combined photo obs is selected; closes #68

* Fix auth tests; add user id

* Pop text input above keyboard to address #66

* Lint cleanup

* Create bottom modal for user tapping back button on ObsEdit

* Check permissions on android only, camera

* Keep trying to get android camera working

* Change version number to 0.1.0
2022-04-01 15:46:51 -07:00
Amanda Bullington
78cca57b0d Android permissions (#58)
* Get camera and sound recording working in Android

* Use obs uuid for create observation

* Fix no evidence upload screen; create new obs to upload

* Fix tests and flow errors

* Get photo gallery working on android; fetch more photos on user scroll

* Add alert for upload in progress

* Update build number

* Set up upload key for release build

* Make test todo
2022-03-22 13:07:16 -07:00
Amanda Bullington
4a4bccd28a Make app run on Android (#57)
* Fixes to make the app run on Android

* Update to android gradle.properties

Co-authored-by: Yaron Budowski <budowski@gmail.com>
2022-03-15 18:24:11 -07:00
Amanda Bullington
59508b6840 Merge user profile, obs detail updates (#56)
* Add to user profile

* Create a hook to fetch member projects

* Create custom header for user profile

* Updates to user profile; resize image for CV suggestions; build config for Android

* Bug fixes with obs list & CV suggestion fields

* Add functions for creating id, faving obs and adding comment in obsdetail

* Show comments as activity items; create comments and refetch obs data

* Fix activity item keys

* Add data to data tab, obs detail

* Let user unfave observation

* Fix camera modal

* Get tests passing
2022-03-15 18:00:54 -07:00
Amanda Bullington
94bd3dd270 Merge identify into main (#55)
* Create identify screen with gridview, grid items, agree button, agree API call

* Add dropdown to allow sorting by taxon and location

* Add activity indicator to grid items while waiting for agree

* Tweaks

* Create card swipe view for identify

* Add mark as reviewed; swipe right to agree on identifications for species rank
2022-03-10 10:27:35 -08:00
Amanda Bullington
6e228dd2b2 Observation uploader (photos, sound, no evidence) (#52)
* Get observation upload and obs_photo upload working with staging v1

* Add location with accuracy to normal camera uploads

* Add location and date to sound recordings

* Add camera options button to end of evidence list

* Add photos to obsEditProvider from camera, sound, and photo library

* Code cleanup

* Use ObsEditProvider as global state for uploader; support multi photo/sound; get test passing

* Set config to API v2
2022-03-01 16:56:25 -08:00
Amanda Bullington
5caaf58c0b Merge login changes for staging server (#49)
* Override base URL for AuthenticationService + some integration fixes for Android

* Update lock file

* Trying to get staging JWT working; allow navigation from Login screen

* Code cleanup

* More code cleanup

* Fix tests; set username

Co-authored-by: Yaron Budowski <budowski@gmail.com>
2022-02-15 12:51:13 -08:00
Amanda Bullington
6f4e830026 Merge sound recorder, regular camera, nav without evidence, realm updates (#48)
* Build basic sound recorder; flow fixes

* More progress on sound recorder; add metering for visualization

* Flow fixes

* Use logged in user to fetch observations; use modified param to clean up realm code

* Hide tests that aren't passing; add mock for rn-localize

* Code cleanup - remove autolink

* Add member id lookup for projects screen

* Navigate to obs detail with sound recording; don't display photos

* Add basic camera with take photo functionality

* Toggle flash

* Add front camera; camera toggle

* Add pinch to zoom functionality

* Add tap to focus functionality; create focus square component for animation

* Add thumbnails to top of regular camera

* Parse photos from regular camera for ObsEdit

* Nav to obs edit with no photos/sounds

* Revert auth service

* Flow fixes AuthService
2022-02-12 10:40:29 -08:00
Amanda Bullington
03392f7da3 Merge login into main 2022-02-07 11:43:51 -08:00
Amanda Bullington
f1f7fcc382 Update lock files 2022-02-07 11:36:02 -08:00
Amanda Bullington
37743f0652 Merge photo gallery and obs edit into main (#45)
* Add gallery library; hide camera stack in drawer navigation since we can't use a tab navigator

* Add gallery permissions ios and android

* Move to obs edit screen when a photo is selected from gallery

* Make sure camera options modal closes on navigate

* Create shared hook for reverse geocoded locations

* Obs edit; dismiss keyboard; uuid generator

* Use popup modal to search for projects / taxa from obs edit & add to obs

* Obs edit updates

* Add i18next mock for global testing

* Add tests for photo gallery

* Add test for obs edit

* Get album picker working and store albums + photos in ObsEditProvider

* Maintain photo selection across multiple photo albums

* Create GroupPhotos screen with photos sorted by timestamp across all albums

* Add styling for group photos

* Pseudocode for grouping photos

* Combine photos into observations in photo gallery

* Remove photos from camera roll selection on group photos screen

* Fix remove photos function

* Finish combine, separate, remove photo functionality

* Display multiple obs and multiple photos on obs edit screen

* Code cleanup

* Code cleanup again

* Show number observation at top of obs edit screen

* Update navigation

* Get one photo gallery test passing

* Fix obs edit test

* Fix warning eslint

* Make tests happy

* Remove unused variable
2022-02-04 09:59:49 -08:00
Yaron Budowski
2947bb6514 Merged; fixed issue with installCoreFunctions; tests to AuthenticationService 2022-01-30 23:47:42 +01:00
Amanda Bullington
5d543d617a Add /projects/search endpoint (#42)
* Create projects screen which searches projects and changes API params on button press

* Create project details screen which makes an API call by project id

* Clean up project code; get one project test passing

* Basic styling for project details; add project observations grid

* Add testing for project details

* Add loading wheel to project obs
2022-01-24 12:03:50 -08:00
Ken-ichi
9ea8bf7070 i18n with Fluent and i18next (#40)
* Support localization with i18next and Fluent

* src/i18n/strings.ftl holds all application strings. If you're going to add a
  string, add it there
* src/i18n/l10n/ has all the translations (or localizations), both .ftl files
  in Fluent format and .ftl.json files in which the file structure is JSON
  but the values are Fluent strings
* src/i18n/i18ncli.js is a CLI tool to generate files and code given
  localizations in .ftl files

So the process for adding strings looks like

1. Update src/i18n/strings.ftl
2. Add strings to code using the useTranslation hook
3. Run `node src/i18n/i18ncli.js ftl2json`
4. Build

* Set up for use with Crowdin CLI or github integration

* Added some example strings that might not change

* Expanded README to explain how to add new text
2022-01-24 12:02:44 -08:00
Yaron Budowski
7cc7ece8df Implementation of getAPIToken / getAnonymousJWTToken / getJWTToken 2022-01-17 16:35:03 +01:00
Amanda Bullington
c5c50b3c24 Merge projects / project details into main (#38)
* Create projects screen which searches projects and changes API params on button press

* Create project details screen which makes an API call by project id

* Clean up project code; get one project test passing

* Basic styling for project details; add project observations grid

* Add testing for project details
2022-01-12 14:27:51 -08:00
Amanda Bullington
9ef85a6818 Explore and explore filters (#24)
* Create Explore screen

* Add input field component

* Add input fields

* UI for list view in Explore; dropdown taxa picker

* UI for list view in Explore; dropdown taxa picker

* ObservationViews component is shared between Explore and My Observations

* Get tests passing with Explore + ObservationViews

* Add map view, iOS location permission whenInUse, and geolocation fetch

* Add RN permissions and geolocation to jest mocks

* Explore filters, testing, explore provider/navigation stack

* Crash fix for grid items with no observation photos

* Code cleanup; remove duplicate files

* Remove more duplication

* Consolidate pickers into a single component

* Move copyRealmSchema into Observation model

* Move copyRealmSchema into Observation model

* Move observation photo logic to Obs model

* Obs details fetches an observation from API instead of from realm/exploreList

* Rename hooks files with 'use' instead of 'fetch'

* Add user to observation schema

* Change realm keys from camelcase to snakecase with mapping

* Simplify model code

* Fix tests for ObsDetails

* Attempt to clean up ObsList code; move useObservations hook into provider

* Several minor changes to get tests passing

* Stopped mocking useObservation hook in MyObservations integration test; this
  should not be mocked in an integration test since the point is to test the
  integration of all the different moving pieces within the app, and it was
  causing a failure because it was mocked but none of the methods were
  actually provided with mock responses, so it wasn't doing anything
* Used the LocalObservation factory for ObsDetails.test.js, where the
  useObservation hook should return an observation in the Realm schema
  (or something like it), not in the remote schema
* Updated the LocalObservation factory to meet expectations

* Attempting to work around weird problem with fkirc/skip-duplicate-actions

* Removed fkirc/skip-duplicate-actions from CI for now

* CI fix

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-01-07 11:38:50 -08:00
Yaron Budowski
4f855834cd Sign up / login flow - initial implementation 2021-12-13 15:34:13 +01:00
Amanda Bullington
e8da272dbd Taxon detail; testing coverage (#21)
* Fetch taxon details from API v2

* Add basic styling, html renderer, Wikipedia link

* Add testing for TaxonDetails API results

* Code cleanup

* Upgrade accessibility engine

* Add testing for ObsDetails

* Check that data tab renders when user taps it

* Make user profiles dynamic and tappable from ObsDetail

* Add test coverage for user profile

* Test navigation and linking to wikipedia

* Add accessibility roles and test todos

* Add grid view to observation list

* Add accessibility roles to pressables in obslist
2021-12-02 14:49:07 -08:00
Amanda Bullington
e206970c8c Pre-commit hooks; Realm updates
* Move realm object creation functions into realm classes

* Make all fields except for uuids optional in realm & update schemaVersion

* Add pre-commit hooks for linting

* Add eslint automatic fix line

* Testing pre-commit hook

* Still testing

* Tweak husky settings and remove lint-staged

* Add a Taxon realm shared by Observation and Identification; add listener for obs list changes

* Create new User realm model for Comments/Identifications

* Remove code comments from models

* Add loading wheel while ObsList is fetching initial data

* Move observations into stack within drawer navigator

* Remove unneeded code

* Look up existing obs using .objectForPrimaryKey method

* More code cleanup (naming, adding primary keys, etc.)

* Merge testing code from main; remove unused imports

* Add more factories and fix ObsCard tests

* Update tests to match updated realm models

* Move ObservationProvider to wrap MyObservationsStackNavigator instead of all navigation

* Remove code comments

* Add primary keys to User and Taxon schemas

* Update realm models to include ObservationPhotos

* Get integration test to pass with new realm schemas
2021-11-24 15:48:14 -08:00
Ken-ichi
523da746f2 Several updates to testing (#17)
* Several updates to testing

* Restructured tests so they are in their own dir at the root
* Added an integration test that mocks the response from inaturalistjs
* Instead of mocking Realm, I mocked the Realm config so it writes to an
  in-memory database for tests
* Added test data factories with factoria and faker

TODO
* Try mocking hooks to make a unit tests for the ObsList component; it should
  be possible to write unit tests for components with hooks
* Data in the in-memory Realm db is probably sticking around between tests; we
  need a way to trash the db after each test

* Tried to address logbox failure in Github Actions test run

* Tried bumping the timeout for tests for github actions

* Added skip duplicates and Slack notification to test action

* Added unit test for ObsList

* Seriously, how much time do you need to run a test...

* Added missing factory import

* Test fixes for context & providers

* DRY out ObsList.test.js a bit

* Made ObsList.test.js synchronous

In theory I suspect all component tests should be synchronous because if
you've mocked out all the hooks, there should be no reason to wait for
effects to complete.

Also removed subscriptionRef which didn't seem to be doing anything.
2021-11-19 13:53:44 -08:00
Amanda Bullington
075073b78b Add react native modal for camera navigation; add messages nav to obs list header 2021-11-16 15:35:48 -08:00
Amanda Bullington
67f130fe59 Code cleanup; add accessibility engine to test suite 2021-11-04 16:36:52 -07:00
Amanda Bullington
ff6789c32c Merge obs list, obs card, and user profile into main (#4)
* Obs detail screen skeleton; move safe area view to wrapper component

* Progress on obs detail

* Get ids and photos from api v2

* Fetch data needed for data tab in obs detail

* Create basic map for data tab, centered on lat/long

* Create linked realms for photos and identifications; access these on obs detail screen

* User Profile and more setup for test suite

* Delete coverage directory

* Add Jest coverage folder to gitignore

* Keep trying to mock out fetch for inatjs in ObsList.test.js

* Rename ObsList.test to match component name
2021-11-04 15:44:57 -07:00
Amanda Bullington
750f7d729a Merge realm + jest implementation into main (#3)
* Struggles with git

* Continued struggles with git stash

* Database experiments

* Get API v2 implementation working with fetch

* WatermelonDB fetch; API v2; RN testing library set up; pods installed

* Enable hermes

* WatermelonDB working with Jest; code cleanup; install latest inatjs

* Experiment with migrations in WatermelonDB

* Remove WatermelonDB from project

* Continue removing watermelonDB

* Add observation schema; remember to remove hermes

* Create local realm observations from observations/search fetch

* Wrap ObsList test in navigation container; add realm files to gitignore
2021-10-15 18:03:49 -07:00
Amanda Bullington
ec922e7c4f Merge incoming changes from main 2021-10-12 17:15:21 -07:00
Amanda Bullington
fe6d44085d Drawer + stack navigation (#2)
* Create a hook to fetch a particular user's observations; add basic styling to obs cards

* Delete prettier config file

* Create stack navigator, footer with shadow

* Create stack, drawer nav and footer component

* Remove default hamburger icon in header
2021-10-12 17:11:30 -07:00
Amanda Bullington
180da57723 Create a hook to fetch a particular user's observations; add basic styling to obs cards 2021-09-30 15:14:03 -07:00
Amanda Bullington
a839f7867c Add eslint rules & make lint fixes 2021-09-15 11:16:47 -07:00
Amanda Bullington
bc71c97055 Update repo name to iNaturalistReactNative 2021-09-13 16:41:59 -07:00
Amanda Bullington
d4adde847d Create RN repo with npx react-native init 2021-09-13 14:38:14 -07:00