* Add a safeRealmWrite transaction for better logging around writes; code cleanup and realm update
* Add safeRealmWrite to tests and make sure action is called synchronously
* Fix final test
* Only write to realm when useObservationsUpdates data changes; code cleanup
* Code cleanup
* Delete local & remote observations on MyObs; show progress
* Update tests & add test for delete hook
* Fix test failures
* Add tests for deletion strings in Toolbar; add test for multiple deletion
* Clear deletion text on toolbar when user navigates away from MyObs
* Add a check in e2e test to make sure observation was deleted
* #856 - support for modifying and updating observation photos locally/remotely; reordering of photos fix
* ESLint fix
* Fixed tests
* Fixed tests
* Fixes related to tests
* Bugfix: TaxonDetails was crashing if it received a null taxon
* Send lat and lng instead of latitude and longitude to the score_image
endpoint
* Show offline suggestions when you are offline
* Show notice when viewing offline suggestions
* Moved code unique to useOnlineSuggestions into that file
* Ensure we use a medium size image to get suggestions when dealing with
remote URLs
* More logging around React Query retries
* Use default retry logic for useAuthenticatedQuery
* Made a module-resolver shortcut for tests
* Move offline notice above top suggestion; hide when offlines exist but onlines do too
* Access MediaViewer from TaxonDetails
* Added our own presets for ActivityIndicator
* TaxonDetail should show a local taxon if one is available
* Made it a little easier to import the custom logger
* Refactored MediaViewer to accept photo-like objects instead of URIs
* Added license / attribution button to MediaViewer
* Moved delete button into MainPhotoDisplay so each photo has its own button
and it can be laid out relative to its photo
* Add custom header to MediaViewer when accessed from TaxonDetial
* Allow DisplayTaxonName to accept custom text components as props
* Added darker bg to photo on TaxonDetail to make title more legible
* Show edit title; add tests; set current obs before nav to ObsEdit screen
* Use edit title when obs is not synced; rewrite ObsEdit tests to show nav works correctly with useStore
* Remove uuid in params to ObsEdit; no longer needed
* Fix e2e by ensuring ObsEdit doesn't rerender with deleted obs
* Use offline model for displaying sugggestions
* Simplify Suggestions/TaxonSearch screens using hooks
* Use updateObsKeys function from useStore
* Simplify code and fix unit tests
* Fix tests for offline predictions
* Fix faker urls
* Fetch remote taxa to display taxon photos in Suggestions
* Fix useTaxon code and test
* Use online vision results as backup for offline results
* Fix tests and add test for online predictions
* Use Flatlist for Suggestions and fix tests
* Move API call out of Attribution and fix test
* Fix tests
* Fix test warnings
* 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
* Update to realm 12
* Remove unused mocks to fix some tests
* Fix test by unmocking ObsEditProvider
* Fix more tests by removing mocks/changing when tests write to realm
* Remove mocks on ObsEdit component test and fix accessibility labels
* Fix hooks tests with realm
* Set test path for realm; finish fixing tests
* Small tweak
* Upgrade realm/react library
* Migrate schema
* Simplify ObsEditProvider by moving functions into local state & calling reducer less frequently
* Fix delete all observations
* Fixes
* Move index selection to MediaViewer via params
* Access ObsEditContext on top level of ObsEdit and pass props
* Move context to top level screen components
* Fix tests
* Use waitFor to fix ObsDetails integration test
* Alphabetize props; remove realm check; refactor new Id method
---------
Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
* Remove console statements in production build
* Move uploadReducer into separate file
* Create reducer for creating obs; combine reducers
* Fixes with createObsReducer
* Move album, passes test states out of global context
* Bug fixes for ObsEdit flow
* Create photo gallery container
* Set accessibility test todo for PhotoGallery
* Improve FlashList performance MyObs
* Prevent flicker on modal close
* Create less rerenders in MyObservations
* Memoize drawer items for less rerendering
* Memoize custom tab bar
* Remove unused libraries and update snapshot
* Fix and prune dependencies
* Add AddObsModal tests
* Fix e2e test android by making comment confirm button visible
Primarily adds designed layouts for permission gates (also referred to as permissions priming).
* moved permission gate business logic into a container
* use react-native-permissions exclusively
* Show PermissionGate as a modal
* Basic unit tests for PermissionGate
* Consistent content width on tablet, other minor style changes
* Allow PermissionGate to be used outside of nav hierarchy
* Use user location on Explore after getting permission
* Remove redundant 'always' location perm in ios
* Isolate current location button in the Map component, which uses location fetching functionality from react-native-maps instead of our own
* Updated cocoapods; matched INatIcon.ttf to sha1 hashes
* Use drag and drop to let a user change photo positions
* Fix tests
* Add test for EvidenceList
* Fix tests
* Fix state for no evidence / no observation photos
* Add unit tests for empty list and displaying obs photos
* Move login and camera screens into stack navigators
* Navigation fixes
* Create ObservationsStackNavigator
* Move drawer items into drawer nav
* Navigator fixes and improvements
* Nav improvements
* Fix navigation from ObsEdit
* Fix test
* Fix test
* Redo bottom tab nav with Explore as part of ObservationsStack
* Use ObsEdit and AddID in two stacks
* Move identify into ObservationsStack and fix headers
* Fix ObsEdit bottom button issue by using fixed positioning for tab bar
That required a few other changes to places where we were explicitly
compensating for the height of the tab bar. Also fixed some other minor
layout issues.
* Typo
* Add LocationPicker to ObservationsStackNavigator
---------
Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
* Make minimum viable RemoteComment
* Minimum vialbe RemoteIdentification
* Minimum viable remote project, place, and messages
* Create minimum viable records for all remote factories
* Remove factories for local device data
* Minimum viable local taxon, comment, id
* Minimum viable for local observation photo (photo has no primary key)
* Minimum viable LocalUser
* Minimum viable record for LocalObservation
* Ensure layout of the PhotoCarousel photos doesn't change in delete mode
* Stop conflating screen-size layout differences with tablet layout differences
* Bugfix: deleting one photo in the StandardCamera removed all photos
* Animated rotation of rotatable elements on StandardCamera
* Ensure loading status shows while first photo is being taken
* Tried to remove some open handles and shore up some unhappy tests
* Make MediaViewer a navigation screen; support changing landscape/portrait orientations
* Move device orientation into hook
* Minor fixes to styling
* Styling updates based on breakpoints
* 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>
* Mock INatPaperProvider to remove warnings about wrong icon names in jest; closes#421
* Remove unnecessary paper provider mock
* Add mocked views back to tests
* Regroup accessibility label strings at end of strings file
* Add accessibility test to AddID
* Add a11y labels to AddID
* Add a11y test to StandardCamera
* Add a11y props to StandardCamera
* Remove unit test with only todos
* Add a11y test to Messages
* Refactor PhotoScroll test into own file
* Add a11y test to ObsDetails
* Add a11y test to ObsList
* Add a11y matcher to PhotoGallery test
* Add a11y matcher to ProjectDetails test
* Add a11y matcher to ProjectObservations test
* Add a11y matcher to Projects test
* Add a11y props to ProjectList
* Add a11y props to ProjectTabs
* Add a11y matcher to Search
* Add a11y matcher to UserProfile test
* Add a11y test matcher to UserText test
* Update react-native-accessibility-engine
* Add a11y matcher to Tabs test
* Add a11y label to a selectable photo
* Refactor DataTab tests into separate file
* Refactor ActivityTab test out into own file
* Added a test how to check if a component uses a mocked container
* Add wrong a11y props to TextInput left icon
* Enable a11y test with actual BottomSheet because mock does not pass a11y props down
* Add a11y default props to Button
The problem has something to do with the unicode capitalization code that got
ported from the web. It seems like the JS engine in Android has a problem
with calling toUpperCase() on some unicode characters, and this gets around
that particular bug, plus one problem with a null check on a Realm
collection.
* Use eslint rules to clean up useQuery code
* Code cleanup for useAuthenticatedMutation
* Add realm deletion and clear mock before each test in DeleteObservationDialog
* Check synced status before deleting observation remotely; closes#315
* Add tests for deleting observation from dialog
* Add jest settings for vscode; fix failing test from App.js
* Ignore vscode settings files
* Remove cached version of vscode settings file from git
* Update gitignore
* Add a test for canceling deletion
* Remove delete option for observations not in realm
* Add mutation for delete observation
* Hide delete option for observations not persisted to realm
* Close kebab menu when item pressed; this allows dialog to respond to first user
press
Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
* Allow editing of existing id; remove unused id buttons; closes#230 and closes#231
* Remove unused text component & update IdentificationSection to tailwind css
* Remove unused obsEdit styles; convert styles to tailwind
* Remove unused bottom modal component and obsedit stylesheet
* Add comments to useEffect for opening local observation; convert realm object to JSON
* ObsEdit loads obs from db only when required
* Use observation update API call for observations already on the server
* Change wasSynced to instance method; only upload unsynced evidence
* Move keyboard aware scroll mock to jest.setup
* Await uploading evidence instead of returning a different response
Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
* Use react navigation header for photo gallery / album picker
* Use react navigation for group photos header
* Use react nav header for Add ID
* Use react navigation header for ObsEdit
* Fix tests by mocking navigation setOptions
* Show all buttons in camera options modal; remove header from StandardCamera
* Only show obs edit header when observations have loaded
Closes#226
* Fix for chosen photos persisting after cancelling new obs, closes#204
* Clear observations when a user backs out of ObsEdit screen
* Add android back handler condition to make sure a user can't back out of ObsEdit & see old observations
* Make sure local observations are properly updated in ObsEdit
* Create subcomponents for ObsEditHeader and AddEvidenceModal
* Fix add evidence functionality; separate ObsEdit into smaller components; rename UploadProvider
* Add disabled check for gallery photos previously selected; fix number of imports in add evidence
* Move fetch location into relevant component; ideally this makes ObsEdit stop rerendering every second
* Fix for android build in build.gradle
* Styling fix for photo gallery grid of images
* Renaming obs to observation, bulk uploader to photo importer, upload provider back to obs edit provider
* Update pods and rename test directory to PhotoImporter
Also closes#218
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
* Sign out user when encountering a 401 error while fetching JWT
* Save currently signed in user in Realm
* Check for logged in user on app start, add loading wheel to obs list, sign user out when no user ID
Closes#99
Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
* 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
* 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
* 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