Commit Graph

10 Commits

Author SHA1 Message Date
Ken-ichi Ueda
dca5b4235f Numerous eslint fixes 2024-02-21 10:49:08 -08:00
Amanda Bullington
045ce6f789 Improve Jest performance (#1160)
* Use faker import with specific locale

* Add global beforeAll to initiate i18next
2024-02-16 16:17:00 -08:00
Amanda Bullington
8e6269c8d0 Wrap realm.write in safeRealmWrite transaction (#1123)
* 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
2024-02-09 16:16:32 -08:00
Ken-ichi
f7dc08a704 Suggestions fixes (#972)
* 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
2023-12-15 19:58:12 -08:00
Amanda Bullington
f32a8812f5 Offline suggestions (#961)
* 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
2023-12-13 10:11:21 -08:00
Amanda Bullington
808cbee452 Replace ObsEditProvider with zustand for global state management (#948)
* 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
2023-12-05 14:10:00 -08:00
Ken-ichi
0c7c807b56 Realm & other bugfixes (#950)
* Updated faker; fixed bug w/ DisplayTaxonName trying to modify a Realm object
* Fixed crash going from ObsDetail to ObsEdit
* Fixed bug fetching observation dates (not clear how this didn't instantly crash_
* Bugfix: MyObs observation fetch was failing on taxa w/ float rank_level
2023-12-04 13:47:00 -08:00
Amanda Bullington
a401854475 Sync deleted observations from server (#924)
* Realm updates for cascading deletions

* Delete local observations from remote list

* Add tests for deleting local obs which were deelted on server

* Fix: don't create embedded objects explicitly
2023-11-27 15:07:23 -08:00
Amanda Bullington
1a27ef68cb Upgrade to Realm 12 (#925)
* 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
2023-11-22 13:01:59 -08:00
Johannes Klein
e1a7a4383d 549 filled activity icons (#574)
* Refactor ObsStatus, add filled property

* Remove viewed prop from observation

* Update properties for ObsDetail mark viewed

* Use separate fields for comments and ids for ObsStatus

* Add hook for fetching updates

* Unit tests for the updates hook

* Unit tests for different paths for updating the realm observation when using the hook

* Update MyObservations.test.js

* Add integration test if updates has been called in my observations

* Update Podfile.lock

* Update observation to not viewed if the keys have not been initialized

* Add test case if observation fields are not initialized

* Add test case

* Refetch stale data on coming back from the background

* Subscribe to observation updates also in ObsDetail screen

This also invalidates and refetches the data after a successful mutation of the id or comment being viewed.

* Refetch observation updates data on sync button press

* Throw error in updates query

* Return refetch function from hook

* Add mock to ObsDetails

* Remove unused var

* Update useObservationsUpdates.test.js

* Reset realm viewed state to true ...

for all observations on app mount and coming to the foreground.

* Reorder function calls

* Change hook to use boolean as enabled param

* Create ObsDetails.test.js

* Update date handle tests to make sure Remote data classes have parseable date

* Add test case for comment and identification

* Update ObsDetails.test.js

* Also check for user in ObsDetails

* Refactored into separate hook for App.js

* Unit and integration test for new hook

* Rename const

* Rename field

* Rename field

* Export query key from hook

* Refactor true check

* Additional methods for obs being viewed or not

* Changed test description

* Add per_page to observations updated
2023-05-11 16:33:37 +02:00