Commit Graph

30 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
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
979127ba02 Assert that observationPhoto position is a number (#3008)
* Update import

* Import realm models as types

* Remove unused import

* Add function param types

* Add function param types

* Rename param for consistency

* Remove unused function param

* Type param

* Update type

* Add TODO

* Import function param type

* File rename without change

* Update imports

* Add some fct types

* Add fct param types

* Add function param types

* Update ObservationPhoto.ts

* Remove unused param

* Type fct param

* Add type

* Remove unused param

* Update comment

* Add fct param type as accessed by local context

* Add types from what is accessed in function

* Add types

* Remove unused types

* Add basic type, as is used in  local context

* Bring require statement back

* Import other function param types

* Add property types

* Fix wrong extends

* Assert inputs and outputs for mapping a local observation photo to server action

* Update unit tests for errors

* Rename file

* Update imports
2025-07-10 08:15:03 +02:00
Ken-ichi
b5ed9d0475 feat: show obs on TaxonDetails map (#2399)
* reduce prop surface area for map-related components
* map just receives an observation, not a bunch of its properties
* adjust a lot of logic based on observation.obscured to more specific logic
  based on whether the current user can view the coordinates
* hide the map on ObsDetails if there are no coordinates
* show the spec'd explanation for why coordinates are obscured
* remove a prop that just hides a component if true; that should really be up
  to the outer context
* fixed a bug on ObsDetail where the remote obs wasn't getting mapped to
  Realm-ish attributes
* prevent button mashing from opening multiple TaxonDetails
* clean out the state related obs create / edit after exiting that flow so
  that TaxonDetails (or anyone else trying to detect an obs being edited)
  doesn't end up finding it when the user has finished creating / editing.

Closes #2271
2024-11-11 14:20:14 -08:00
Amanda Bullington
5945ccc525 Fixes and error handling for API throttling (#1971)
* Add new error type for 429; remove unnecessary logs

* Batch API calls for SpeciesSeenCheckmark

* Remove SpeciesSeenCheckmark test

* Revert logging errors

* Use Set for observedTaxonIds

* Add comments around logger.info statements

* Merge linting update

* More fixes from code review

* Switch to non-authenticated useQuery for fetching taxon ids seen by X user id

* Fix tests
2024-08-14 22:08:03 -07:00
Ken-ichi
e08cd83d6a Control web access (#1970)
* Convert web view components to typescript
* Basic tests for URL handling in FullPageWebView
* Allowlist of domains in FullPageWebView
* Open links in browser in most situations
* Allow FullPageWebView to handle mailto links
* Throw errors if FullPageWebView is about to leak a JWT
* Restore FullPageWebView functionality to signup screens

Closes #1803
Closes #1934
2024-08-13 14:45:37 -07:00
Ken-ichi
609b7c936f Select taxon button always visible from Suggestions (#1933)
* Send user back when they access a camera on a device with no camera
* Always show SELECT button on TaxonDetails when reached from Suggestions
2024-08-07 09:39:32 -07:00
Amanda Bullington
90a803d55b Only show select button when coming from Suggestions/Search; closes #1813 (#1829) 2024-07-18 13:55:33 -07:00
Amanda Bullington
ce39b03495 Changes to showing select taxon button & vision attribute; closes #1773 (#1790) 2024-07-10 13:18:27 -07:00
Ken-ichi
e747b37a8f Push TaxonDetails onto nav stack in Taxonomy section (#1767)
* Refactor useCallacks into components
* Push TaxonDetails onto the nav stack in Taxonomy section

Closes #1735
2024-07-03 17:25:58 -07:00
Amanda Bullington
452ebcbdf4 Navigate user correctly with selected ID when coming from TaxonDetails (#1766) 2024-07-03 16:29:46 -07:00
budowski
137f9f1b03 Display taxon name according to user settings (#1496)
* display taxon name according to user settings
* Cleaned up Taxonomy style a bit

---------

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2024-05-21 20:45:34 -07:00
Angie
f10b25fecc 1198 photos on taxondetails should be swipable (#1432)
* TaxonDetails carousel

* Fix tests, disable taxondetails accessibility test because of photo carousel

* spacing change

* Fix failing tests
2024-04-23 09:59:13 -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
0b57ce898b Use API call for species seen checkmark (#1249)
* Show species seen checkmark from API call, not realm; closes #1197

* Fix tests
2024-03-05 10:08:48 +11: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
cd18e970d7 Taxonomy component, TaxonDetails (#978)
* Style taxonomy ancestors and current taxon

* Link to TaxonDetails pages

* Add children to TaxonDetails taxonomy

* Add children taxa toggle

* Display children after button tap

* Wrap text'

* Fix italic font size in DisplayTaxonName

* Add tests to Taxonomy component

* Change Taxonomy test
2023-12-19 11:04:30 -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
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
9c6106f5d0 Refactor tests to use minimum viable test factories (#681)
* 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
2023-06-27 17:06:01 -07:00
Amanda Bullington
a21abbb392 Bring TaxonDetails UI closer to Figma spec (#602)
* Bring TaxonDetails UI closer to Figma spec

* Fix test
2023-04-27 18:20:28 -07:00
Amanda Bullington
ba181e75fd Remove warnings about custom icons / Material icons in jest (#429)
* Mock INatPaperProvider to remove warnings about wrong icon names in jest; closes #421

* Remove unnecessary paper provider mock

* Add mocked views back to tests
2023-02-03 08:38:51 -08:00
Johannes Klein
1b4039eb36 417 eslint testing (#419)
* Add eslint-plugin-testing-library dependency

* Enable plugin inside tests folder

* Fix errors given by eslint-plugin
2023-02-01 12:50:59 +01:00
Amanda Bullington
ec0a686df6 Eslint: disallow console logs (#312)
* Remove console.logs; remote useLoggedIn hook and instead use useCurrentUser; closes #310

* Comment out locale test
2022-12-29 10:56:50 -08:00
Amanda Bullington
c4d9cd4dc6 Use babel-plugin-module-resolver (#188)
* Add alias and update eslint/flow to resolve modules

* Update aliases for components and api

* Add other src directories to module resolver aliases
2022-10-07 10:20:55 -07:00
Amanda Bullington
af8f17190d Keep toolbar sticky & collapse header on ObsList scroll (#182)
* Change bottom sheet modal to bottom sheet
* Give flatlist container a minHeight to make bottom sheet snap correctly when flatlist has few items
* Make entire header sticky above FlatList
* Hide header on scroll while keeping toolbar sticky on scroll
* Allow flatlist to scroll while bottom sheet modal up
* Use animated event on scroll with interpolation and stickyheaderindices to keep toolbar sticky while animating header
* Add accessibility label to logged out card

Closes #175
2022-09-27 16:20:13 -07:00
Amanda Bullington
d892d755a7 Use React Query to simplify API requests (#166)
* Start using React Query to make remote data requests
* Renaming, standardized error handling from API calls, moving code
* Fixed messages test; changed useQuery mocking approach
* React Query should only retry for network issues
* Tried using useAuthenticatedRequest on TaxonDetail
* Clear the React Query cache on sign out

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-09-01 18:43:52 -07:00
Ken-ichi
e929764c25 Adopted and enforced code style from other iNat Javascript projects
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
2022-07-13 13:55:59 -07: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
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