* Changed the default React Query retry handler to be synchronous; being async
meant it returned a promise, which React Query interpreted as true-ish,
which meant it retried forever
* React Query retry handler should log info about its query key, which should
make those problems a bit easier to debug given a log
* Prevent useObservationUpdates from throwing errors when network requests
fail, which they always do while offline
* Added our own ErrorBoundary that shows a component trace
* Prevent several uses of useAuthenticatedRequest when not online
* Work around bug in vision-camera-plugin-inatvision where it can't get
dimensions of photos in Android
* Actually throw errors when vision-camera-plugin-inatvision's predictImage
throws unexpected errors
* Allow online suggestions while signed out using anonymous JWT
* Add zustand to app
* Begin replacing ObsEditProvider with zustand for global state
* Use store and add tests
* Fix bugs
* Add test to check for deleted photos in StandardCamera
* Make sure evidence is only added to current observation; submit comment with ID on ObsDetail
* Fix ObsEditWithoutProvider tests
* Move store to where it's needed
* Fix tests
* Await evidence being added to obsPhotos from camera
* Add a note about slices to useStore
* Crosshairs, location accuracy warnings, text input for location picker
* Add LocationPicker tests
* UI improvements and code refactor into smaller components; get GMaps working
* Add shadows to icons/text boxes
* Use debouncing to avoid map jitter when typing in location
* Show place results & let user pick new location from web api
* Add tests for location picker with remote results
* Add gmaps api key to github actions
* Try adding manifest placeholders for env variable to work in github actions
* Add key to printf in github actions
* Try accessing GMAPS_API_KEY a different way
* Update android e2e env file step
This updates the "Create .env file" step to use printf to print the Google Maps key into a newly created .env file in the GitHub Action runner. Using the same key as in env.example.
* Fix newline
---------
Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
* Add KebabMenu to shared components index
* Separate EvidenceList from PhotoCarousel component
* Remove unneeded props from PhotoCarousel
* Create notes bottom sheet
* Fix tests for delete obs sheet
* Add wild status sheet
* Show date from observations uploaded via website
* Move media viewer modal into evidence section
* Fix mock
* Move location fetching into its own hook
* Refactor ObsEdit header; move code into Header component
* Add discard changes sheet
* Styling updates and save changes button
* Add classes to buttons based on evidence/id missing
* Add imprecise location sheet
* Add jest.fn from provider to ObsEdit tests
* Remove fakeTimers from ObsEditWithoutProvider.test.js; minor cleanup
* Show discard obs sheet anytime a user tries to navigate back
* Fixes to bottom sheet backdrop, evidence, add discard changes sheet
* Switch to paper radio buttons instead of checkmarks
* Fix bottom sheet backdrop in android by wrapping with GestureHandlerRootView
* Update bottom sheet for add comment & notes
* Fix test
* Remove fake timer from ObsEdit test to get tests passing
* Force update github actions cache
---------
Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
* Add DateDisplay to ObsCard and make first pass at translation strings
* Add failing tests (due to lack of localization) for timeless dates
* WIP: trying to ensure i18next gets initialized before tests run
The remaining test failures might be legit. This probably breaks the actual
app, though.
* Got the rest of the tests working
* Updated tests to assume UTC
* Updated README to advise against using `npx jest` so test runs always have
the env vars we specify in our `npm test` script
* Moved i18next initialization to an explicitly-named file
* Use i18next init function in app
* Fixed up remaining tests
* Added test for non-English localization of date format
* Cleanup
* Made DateDisplay explicitly handle strings not Dates
* Restore skipped localization tests for MyObservations
* Remove duplicative tests from DateDisplay unit test
* Added note to the README about initializing i18next
* Updated change to DateDisplay in main
---------
Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
* Add custom iNat icon font to iOS and Android
* Add custom icon to iNat UI library
* Create custom iNat icons using IconButton for add obs modal & footer
* Add icon placeholders to observation edit screen
* Test fixes for accessibility
* Move paper provider into new component; fix names in UI library
* Update README with clarified directions about changing the name of the .ttf file
* Rename some functions and variables
* Rename function
* Revert to original timeout for tokens
* Get JWT for a 401 or 403 http errors in the react-query QueryClient retry handler
* Log API error to new logger
* Fetch token on every render in useApiToken hook
* Remove commented code
* Add comment
* Remove useEffect from useApiToken
* Revert "Remove useEffect from useApiToken"
This reverts commit 9cf1e0c0bc.
* Fetch user from server, set locale in realm and change language with i18next
* Added some Spanish translations so I can see localization working
* config QueryClient with `cacheTime: Infinity` to deal with "Jest did not
exit" errors
Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
These rules are largely based on the AirBnB ones, which are not quite standard
for the React Native world, where Prettier seems to be more common, but I
think they add a lot of useful checks, and unlike Prettier we can customize
them. This also just makes it easier for people on the iNat team to work on
the mobile app.
Some specific changes:
* Added eslint-plugin-react-hooks to eslint rules
* Added eslint-plugin-simple-import-sort to eslint rules
* Bugfix: could not import photo from gallery
* Added support for react-native/no-inline-styles eslint rule
* useUser should not bother fetching a user for a blank userId
* 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
* 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
* 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
* 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
* 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
* 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>
* 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
* 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
* 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