Commit Graph

35 Commits

Author SHA1 Message Date
Johannes Klein
b4516b7b25 Update react native to v0.78.x (#3043)
* Update package.json

* Update package.json

* Updates for native files with upgrade-helpers

* Update .flowconfig

* Update package-lock.json

* Update Podfile.lock

* Add react-dom types

* Update package-lock.json

* Wrong install

* Use types-react-codemod

* Update TaxonSearch.tsx

* Remove react-native-accessibility-engine dependency

This is currently not maintained and not compatible with RN 0.78

* Comment out accessibility tests

* Disable broken snapshot test

* Move broken test

* Move broken test

* Move broken test

* Remove duplicate file

* Move broken tests

* Move broken tests

* Move broken tests

* Move broken tests

* Move broken tests

* Move broken test

* Remove duplicate file

* Move broken tests
2025-08-09 13:47:46 +02:00
Johannes Klein
a618b6e870 Update react-native-testing-library to latest (#3044)
* Update package.json

* Update package-lock.json

* Update

* Update to v13

* Update package-lock.json

* Breaking change: remove extend-expect

* Latest version

* Update package-lock.json

* Breaking change: Removed Accessibility matcher

* Update Suggestions.test.js

* Update DisplayTaxonName.test.js

* Testing the same but differently phrased

* Not really needed to test this

And since not.toHaveTextContent stopped working I just remove it.

* Update useTaxonSearch.test.js

* Move broken tests into folders that are not run

* Only move single tests that are failing

* This does work after all

* Remove only single tests that are broken

* Only move failed tests

* Only move failed tests

* Only move failed tests

* Does not pass on CI only
2025-08-05 13:44:49 +02:00
Johannes Klein
f10188250c Some Flow to Typescript migrations, in simple components (#3034)
* Update Attribution.tsx

* Update FollowButton.tsx

* Update LoginSheet.tsx

* Update UnfollowSheet.tsx

* Update UnfollowSheet.tsx

* Update EstablishmentMeans.tsx

* Update TaxonDetailsTitle.tsx

* Update Taxonomy.tsx

* Update TaxonMapPreview.tsx

* Update FullScreenActivityIndicator.tsx

* Update ActivityIndicator.tsx

* Update SpeciesSeenCheckmark.tsx

* Update Mortal.tsx

* Update HideView.tsx

* Update ConfidenceInterval.tsx

* Update ViewWrapper.tsx

* Update ScrollViewWrapper.tsx

* Update SimpleObservationLocation.tsx

* Update Divider.tsx

* Update DateTimePicker.tsx

* Update MediaNavButtons.tsx

* Update MediaNavButtons.tsx

* Update MediaNavButtons.tsx

* Update DisplayTaxon.tsx

* Update InputField.tsx

* Update InputField.tsx

* Update ObservationLocation.tsx

* Update WarningText.tsx

* Update LoadingIndicator.tsx

* Update CrosshairCircle.tsx

* Update CoordinatesCopiedNotification.tsx

* Update PhotoSharing.tsx

* Update TaxonDetailsMediaViewerHeader.tsx

* Update EvidenceButton.tsx

* Update TextSheet.tsx

* Update Wikipedia.tsx

* Update About.tsx

* Update About.tsx

* Update imports

* Code style
2025-08-01 12:25:46 +02:00
Johannes Klein
12c2e0e8ea Update vision-camera-plugin; breaking changes (#2701)
* Update vc plugin

* Update tests with breaking change: combined_score now 0-100

* Frame processor predictions are in range of 0-100 with new key

* Remove offline convert score to confidence

* Update calculateConfidence.js

* Common ancestor should use combine_score

* Offline suggestions have combined_scores now instead of scores

* Change filtering to range 0-100

* Only use combined_score for Match screen

* Update debug data

* Fic typo in tests

* Remove key from type
2025-02-28 14:21:01 +01:00
Amanda Bullington
4902dcf825 Show match screen after gallery; limit gallery selection to one photo (#2614) 2025-01-15 14:43:29 -08:00
Amanda Bullington
94ac9f2c05 Add suggestions to match screen (#2609)
* Create useSuggestions hook with all online/offline logic for reuse in Match screen

* Show real online/offline suggestions on Match screen

* Code improvements

* Display top suggestion from useSuggestions, not AICamera
2025-01-14 16:55:41 -08:00
Amanda Bullington
4652929056 UI for Match Screen after AICamera (#2598)
* Save TaxonPhoto to realm; display taxon on match screen

* Code tweaks

* Add match screen to navigation after AI camera in debug/default mode

* Fix test and refactor

* Fix issue with infinite renders in useLayoutPrefs
2025-01-08 14:28:16 -08:00
Ken-ichi
69959869ca feat: offline taxon search (#2469)
Searches the local database for taxa if there are no online results.

Also

* typescript conversions
* refactor and consolidate view logic around taxon search

Closes #2348
2024-11-21 14:44:48 -08:00
Johannes Klein
6f8f2ea926 1953 suggestion logged out (#2163)
* TaxonResult TS

* Suggestion TS

* Do not show checkmark for logged out online suggestions

* Update strings.ftl

* From suggestions show bottom sheet on taxon detail

* Refactor updateTaxon

* Add text

* Another text

* Two more texts

* Fix import

* Function stubs

* Use a bulleted text list

* Restyle entire bottom sheet

* Code reorder

* Refactor saveObservation function

* Navigate to login screen for Upload now button

* Add key

* Save obs on press and nav to list

* Code style

* Get updated currentObservation immediately to pass to saveObservation

* Test AICamera with current user

* Show the bottom sheet only for logged out users

* Mock useCurrentUser hook

* Mock useCurrentUser hook

* Mock user

* Mock user
2024-09-25 12:56:32 +02:00
Amanda Bullington
e0b5d446a2 Don't overwrite description in Suggestions/TaxonSearch (#1916)
* Don't overwrite description in Suggestions/TaxonSearch; closes #1913

* Fix TS

* Remove unused code related to adding/editing comments in Suggestions/TSearch

* Remove test about showing comments on Suggestions
2024-08-06 18:41:54 -07:00
Johannes Klein
c81201cffa 1843 offline taxon search (#1864)
* realm TS

* provider/contexts TS

* todo

* useIconicTaxa TS

* Refactor taxa list into component

* Use TaxaList for taxon search screen

* Refactor render decision

* Use flex 1 container instead of footer

* Show offline notice for query without results

Refetch taxa when going back online

* Update required because of useIsConnected

* Await typing in test

* Mock useIconicTaxa

* Add tests to taxon search

* emitUploadProgress TS

* createUTFPosition TS

* convertScores TS

* Add field type

* Fix imports
2024-08-03 15:13:13 +02:00
Amanda Bullington
7f2ed32d32 Use fields to limit response from search API; save taxon results in realm (#1905) 2024-08-01 14:21:26 -07:00
Amanda Bullington
14f53cd47c Show vision result from AICamera in Suggestions loading screen (#1900)
* Add AICamera result to loading screen; closes #1851

* Add test for loading state with vision result
2024-07-31 14:20:45 -07:00
Angie
27912676dc Loading wheel to explore filters searches (#1840) 2024-07-23 20:04:13 -07:00
Amanda Bullington
fbd22f9e9d Fix location toggle on Suggestions (#1833)
* Fix Suggestions test & create test for online suggestions with location

* Fetch location according to toggle

* Update tests

* Show loading & remove prev queries when toggling location

* Fix loading test
2024-07-22 06:44:35 -07:00
Amanda Bullington
59959317d7 Fix photo deletion test (#1830) 2024-07-19 07:47:59 -07:00
Amanda Bullington
cc8b610f2f Web parity for displaying top suggestion (#1721)
* Fix suggestions tests; use SectionList for suggestions

* Comment out offline test, Suggestions
2024-06-27 17:29:33 -07:00
Amanda Bullington
d9d7a6ff06 Suggestions screen UI fixes, location toggle, and offline reloading state (#1708)
* UI changes to suggestions screen

* Update offline suggestions UI and allow refetch

* Allow user to search online suggestions with and without evidence location

* Add improve location button and refactor header

* Use loading screen correctly between location/ignore location

* Hide location permission button and code cleanup

* Fix test for suggestions changes
2024-06-24 16:26:40 -07:00
Amanda Bullington
0833d2ddf0 Jest config updates; fixes for slower tests (#1401)
* Speed up ObsEdit test with jest-test-time

* Update jest config and standardize accessibility tests

* Add test:memory to package json
2024-04-17 10:07:29 -07:00
Amanda Bullington
9c96e1e443 Allow user to navigate to ObsEdit when no suggestions found (#1379)
* UI updates when no suggestions from Camera; closes #1366

* Fix suggestions loading test
2024-04-09 16:06:11 -07:00
Amanda Bullington
4916e960c3 Show Suggestions after camera in ObsEdit flow (#1294)
* Navigate user to Suggestions after Camera; add location check to usePrepareStateForObsEdit function

* Test that Camera advances to Suggestions when checkmark tapped

* Use vision result as top suggestion on Suggestions screen

* Write AR nav test; filter vision result from all suggestions list

* Show LocationPermission on camera screen; navigate back from ObsEdit

* Updates to flow so user can back out of ObsEdit to cameras

* Fixes

* Add evidence to existing observation when backing out of ObsEdit flow

* Fix tests

* Add mocks for worklet functions

---------

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2024-03-27 12:34:37 -07:00
Ken-ichi
6fdf3d2faf Taxon result updates (#1254)
* Only requests remote taxon if local is missing or hasn't been synced in a
  week
* Returns a localized version of the remote taxon immediately without waiting
  to get a newly-created record from realm
* Expands tests to use a unique realm, integrate more of our code, and check
  to ensure the API gets called
* Show indicator while loading taxon on ARCamera
* Show iconic taxon found in model results if we can't load a remote taxon
* Show iconic taxon as backdrop for ObsImage whenever possible
2024-03-05 16:54:42 -08:00
Amanda Bullington
fe688de7ea Show multiple common names consistently (#1248)
* Use taxa.search API call instead of generic search to fetch multiple common names

* Fix tests

* Fix one more test

* Clean logs

* Rename query key
2024-03-05 06:13:38 +11:00
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
Johannes Klein
60de855f6b Explore filters (#1067)
* Remove Explore Filters screen

* State for Explore filters modal

* Accept modal state in Header to open modal

* Basic explore filters modal

* Save taxon object to explore state on update

* Update types expected

* Pass state and update function into filters modal

* Receive new props

* Destructure taxon from props

* Restyle header View

* Add main Heading

* Add taxon section

* Restyle modal header

* Add numbers badge component

* TaxonResult add prop for general on press

* Make TaxonResult checkmark optional

* DisplayTaxon can receive children as right-side component

* Refactor ExploreFilters component tree

* Move header out of scroll view

* Update ExploreFilters.js

* Update ExploreFilters.js

* Add icon to display taxon

* Update ExploreFilters.js

* Add basic taxon search screen

* Use taxon result without checkmark, send taxon to Explore screen

* Add string

* Accept taxon on explore screen

* Add a dummy screen for explore location search

* Add type

* Store place in state when received as route param

* Basic explore filters location section

* Add strings

* Move filter modal to separate component, add sort by props

* Add screen for testing purposes

Because atm we can not have two modals open at the same time, I move filters to a separate screen for testing the other modals.

* Add initial filter params and do not pass down undefined ones

* Pass function to update sort by down

* Create SortBySheet.js

* Navigate to test screen instead

* Sort by button text

* Add default filters definition

* Call reset function if filters are not default

* Add prop and function to reset

* Add user search screen

* Move search screens

* Move references

* Replace list with flash list

* Add item separator

* Remove footer

* Return user to Explore

* On press handle for user list item

* Fix wrong imports

* If a user is in prop show user icon and edit button instead

* Refactor display taxon to be inside a Pressable

* Missing import

* Receive user in explore rout params

* Quality grade section header

* Placeholder

* Add TODO

* Calculate number of filters set

* Only send user id to explore screen

* Do send back user object, filter out user_id

* Add project section

* Refactor project list item into standalone component

* Change initial value to undefined

* Add project search screen

* Remove loading state

* Show project in filter modal

* If project is in param set it to state

* Add Checkboxes to filter modal

* Remove comment

* Taxonomic Ranks section UI

* Use props for checkboxes

* Update ExploreContainer.js

* Calculate actual query param

* Is Most Faved possible?

* Actually set sort by query params

* Save hrank and lrank to explore state, prop down

* Update ExploreContainer.js

* Show ranks in button text

* Radio modal to test taxonomic ranks

* Add sticky toolbar

* Update strings.ftl

* Date observed section bottom sheet

* Date observed prop

* Change padding

* Date observed all UI

* Taxonomic ranks section

* Add todo

* Refactor open sheets state

* Update button

* Add exact date picker sections

* Store dates in state

* Update strings.ftl

* Refactor function name

* Refactor constants

* Reset date states on mode change

* Set new months to state on change

* Configuration for showing months checkboxes

* Receive and update months with checkboxes

* Refactor RadioButton sheet to export radio button row

* Add Media section UI

* Add media state to Explore

* Start with Establishment Means section

* Add checkbox texts

* Add states

* Functions to update state

* Add sort by param for most faved

* Spacing for checkboxes

* Wild Status section UI

* Wild status state

* Reviewed UI section

* Reviewed state

* Set current user id as viewer_id for review true to work

* Remove testing code

* Photo licensing UI section

* Photo license state

* Prop down photo license update, use param in search

Forgotten in previous commit

* Unused prop

* Add noStatus state

* Change Establishment Means status to TODO

* Add TODO text

* Console log for testing params

* After rebase from main this was necessary

* Simple switch between two UIs

* Simple explore context

* Lift Provider one up

* Copy over photo license to new provider

* Copy over review filter

* Refactor to use enum

* Copy over wild status, and enum refactors

* Refactor some more state

* Remove unused navigation

* Refactor one state

* Refactor some more state

* Refactor some more state

* Remove testing screen

* Refactor some more state and derived state

* Do send over project as param from Project Details

* Update FilterModal.js

* Rename components

* Remove unused param handling

* Add keys

* Remove substring for key

* lrank and hrank combined counts as one only

* Use the correct constants

* Add key

* Fix issue with button text

* Add View Wrapper for filters section

* UI cosmetics

* Compare current filters state to a snapshot

* Change button level to focus

* Add context action to revert to snapshot

* Confirmation dialog strings

* Add confirmation sheet

* Send current user along to Explore from Home Header

Closes #887

* Date bottom sheets texts

* Show texts in modal

* Set search to worldwide on param received

* Send taxon as param to Explore from Taxon details screen

Closes #889

* Show all observations worldwide of project

* On species view pressed should navigate to explore species view

Closes #893

* Go to explore from users profile

* Navigate to species view from user profile

Closes #894

* Enable unclear filters

* Add taxon to context

* Use context for explore params further down the tree

* Refactor one state

* Remove unused action

* Remove unused state

* Refactor function

* Refactor state

* Refactor place_id, which concludes reducer refactor

* Refactor names

* Do not use key inside context's state

* Add a11y label

* Remove duplicate test ID

* Remove superfluous component

* Create ProjectListItem.test.js

* Add failing filter modal test

* Remove log

* Rename function

* Months strings

* Remove todo

* A11y labels

* Remove TODOs

* A11y label

* A11y label

* Refactor taxon search hook

* Update FilterModal.js

* A11y labels

* A11y not possible in react-native-paper lead to test fails

* Update TaxonSearch.test.js

* Add dropshadow

* Another dropshadow

* Add TODO text to UI elements that are not finished

* Reverse order

* Refactor constants

* Revert "Refactor constants"

This reverts commit 2f52e936d6.

* Refactor to use constants

* Refactor constants use

* Refactor constant use

* Refactor constants use

* Refactor constants use

* Refactor constants use

* Refactor code

* Add validation of date format

* Correct type for snapshot action

* Add taxonomic rank enum

* Taxon can be undefined

* More precise type

* Fix wrong string usage

* Refactor radio button row component

* Refactor ProjectListItem import

* Example usage of new ui elements

* Pull sort by sheet back inside filter modal

* Rename params

* Add useEffect dependency

* Rename param

* Fix broken function
2024-01-23 18:08:36 +01: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
budowski
af3812f31b Support for adding ID for someone else's observation
Prevents adding an ID from suggestions from returning you to ObsEdit like it does in the new obs flow. Closes #851

---------

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2023-11-29 10:57:16 -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
Ken-ichi Ueda
38e75d3cdf Remove some unecessary react-navigation mocks 2023-11-20 11:09:36 -08:00
Amanda Bullington
361ad1d1f5 Performance: simplify ObsEditProvider (#908)
* 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>
2023-11-17 12:35:29 -08:00
Amanda Bullington
7d20f6aa81 Suggestions (using server data) (#821)
* UI overhaul for Suggestions

* Updates to suggestions

* Update permissions library and Podfile

* Get tests passing

* Add tests for suggestions

* Update snapshot

* Add comment prompt & box to TaxonSearch

* Add empty state

* Nav and loading fixes

* Add more tests to Suggestions flow

* Fix tests

* Fix tests
2023-10-13 14:46:05 -07:00