Commit Graph

79 Commits

Author SHA1 Message Date
Seth Peterson
55354e23f0 Merge pull request #3221 from frewsxcv/frewsxcv-240FC0C7-86BF-40B6-BCF7-DEC15AB7E4F8
Migrate `tryToReplaceWithLocalTaxon` to TypeScript.
2025-11-14 09:17:55 -06:00
Corey Farwell
c6bd05edb1 Migrate tryToReplaceWithLocalTaxon to TypeScript. 2025-11-12 12:32:37 -05:00
Corey Farwell
56a9793371 Migrate src/components/Match/EmptyMapSection to TypeScript. 2025-11-12 12:21:39 -05:00
Abbey Campbell
4870dae72a Merge pull request #3189 from inaturalist/mob-797-change-the-green-checkmark-under-top-id-suggestion-on-the
remove misleading suggestion checkmark state
2025-11-06 13:52:17 -08:00
Abbey Campbell
cebbcfa061 remove misleading suggestion checkmark state 2025-11-05 15:10:01 -08:00
Johannes Klein
1137a05605 Match screen needs no top inset 2025-11-05 14:28:06 +01:00
Johannes Klein
bac5d02289 Remove deprecated estimatedItemSize prop 2025-10-28 16:07:17 +01:00
Johannes Klein
fc16b91ded Fix a crash in SuggestionsResult (#3100) 2025-09-08 14:23:02 +02:00
Corey Farwell
a43446909c Remove the need to specify TypeScript file extensions in imports (#3094)
* Don't require TS extensions in imports

* Resolve all import extension errors

* Remove file extension from import paths used in mocks

* Remove .d of type definition file paths

* Remove .d of type definition file and import as type

---------

Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
2025-09-07 23:41:42 +02:00
Corey Farwell
19d0dcf17b Migrate src/sharedHelpers/getImageDimensions to TypeScript. (#3078) 2025-09-05 13:16:11 +02:00
Johannes Klein
6a9db677c0 Consistent location permission asks (#3032)
* Reorder conditions

* This does not really do anything because the option

keys have different names

* The Add Location CTA should always ask for permission

The only state we show the Add Location CTA is if the observation does not have a location when landing on ObsEdit.

* Use an initial state wether an observation should watch users location

In this case we can override the state to true whenever we want to force the app to watch the location.
For example when the user grants location permission on the screen we want to watch no matter where the user came from.

* Remove unused or nowhere imported functions

* Use same navigation on Match as ObsEdit does

* Always ask for permission when the MyLocation button

is pressed on the map

* Add a loading state to the "Add Location button"
2025-08-09 13:46:35 +02:00
budowski
bb54de0540 MOB-827 - crash fix in SuggestionsResult when trying to access invalidated Realm object of the taxon (#3033) 2025-07-29 15:02:10 +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
budowski
46ea4ea4af MOB-711 - add location for better IDs change (#2965)
* MOB-711 - add location for better IDs change

* Various fixes according to PR feedback

* Make button fill all available space

* Change padding to margin

---------

Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
2025-07-08 23:23:41 +02:00
Johannes Klein
1ffa0bb920 Return addListener result in useEffects (#3005)
* Rename const

* Return the result of addListener

* Split useEffect apart and return result of each addListener
2025-07-07 19:34:33 +02:00
Amanda Bullington
bb31c1907b Update react navigation libraries for performance (#2903)
* Update navigators and create util for tabstack navigation

* Changes for react navigation 7

* Refactor to use navigateToTabStack throughout app

* Add comment about unmountOnBlur

* Get all unit tests passing; remove navutils & mock HeaderBackButton

* Fix animation issues in tests

* Temporarily remove parts of tests with back functionality

* Fix tests

* Delete ios/iNaturalistReactNative.xcodeproj/project.pbxproj

* Fix pbxproj

* Code cleanup; minimize unnecessary changes

* Fix tests

* Downgrade react-native-screens to v4.4.0 (#2918)

react-native-screens version 4.5.0 increases the react native version that it supports to 0.74.0+ (https://github.com/software-mansion/react-native-screens/pull/2613/files). So, by using 4.4.0 we are still able to build the app on Android as we are still on 0.73 for now (have tested and it works).
Have not seen any effect on the changes related to the latest react-navigation versions.

* Make requested changes

* Speed up Explore nearby tile loading (#2912)

* Create a performance tracker to show urltile load time in debug mode

* Set default radius to 1km, not 50km

* Code cleanup & TypeScript definitions

* Fix TypeError

* Address eslint error

* Make github actions happy

---------

Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>

* New Crowdin translations by GitHub Action (#2920)

Co-authored-by: Crowdin Bot <support+bot@crowdin.com>

* MOB-690 - Add error context to 401 errors (#2921)

* MOB-690 - Add error context to 401 errors

* Add Object.defineProperty like in the other error classes

* Add logger line

* Also throw 401 error if the error object has no response property

---------

Co-authored-by: Yaron Budowski <budowski@gmail.com>

* v1.0.4+164

* Rebase with latest version of RN screens. Remove unused code and packages, add eslint package for TS, suppress TS errors (#2924)

* New Crowdin translations by GitHub Action (#2926)

Co-authored-by: Crowdin Bot <support+bot@crowdin.com>

* New Crowdin translations by GitHub Action (#2929)

Co-authored-by: Crowdin Bot <support+bot@crowdin.com>

* Use 3 separate initial routes for tabs; hide animations on drawer screens

* Fix test

---------

Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
Co-authored-by: Ken-ichi <kenichi.ueda@gmail.com>
Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
Co-authored-by: Yaron Budowski <budowski@gmail.com>
2025-05-30 09:26:47 -07:00
budowski
f12c03bce3 MOB-692 - suggestions result crash fix (#2908) 2025-05-19 11:20:43 -07:00
Johannes Klein
ed3f0e982c Migrate SuggestionsResult to TypeScript (#2901)
* Rename file

* Use PressableProps interface for PressableWithTracking

* Remove TODO

* Update handleLayout types

* Update allowed prop type

If SuggestionsResult can have ApiTaxon | RealmTaxon, we have to enable it in DisplayTaxonName as well, and rank_level can be undefined according to this union.

* Allow null

accessibleTaxonName uses currentUser directly from useCurrentUser which can be null.

* Use as to declare which type is used

* Source might be null
2025-05-16 14:57:25 +02:00
Johannes Klein
85a7385b62 Migrate MatchHeader and imported components/functions to TypeScript (#2890)
* Rename file

* Migrate flow to TS

* Update type

* Update type

* Rename file

* Update useTranslation.ts

* Check if instanceof Error

* Update imports

* Update type

* Rename file

* Migrate translatedRank to TS

* Migrate DisplayTaxonName to TS

* Also accept number for taxonId

* Those types are currently not optional

* Revert "Migrate translatedRank to TS"

This reverts commit c69cc18061.

* Rename taxon.js

* Add interfaces and types

* Remove adding a key to the function param

* Move fetchTaxonAndSave back to original file

* Move interface

* Update import

* Update types

* Rename some variables for clarity

* This is how it currently props down from only HOC

* Update imports

* Rename file

* Add param interface

* Update imports

* Revert "Move fetchTaxonAndSave back to original file"

This reverts commit 981ce228e8.

* Move fetchTaxonAndSave to own file

* Type inference is easiest way for React components

* Rename file

* Remove unused props

* Add types

* Update type

* Infer return type

* Update import

* Add interface

* Rename const and interface

* Update import (Merge conflict)
2025-05-13 11:34:59 +02:00
Johannes Klein
575db8294d Not access taxon in SuggestionsResult if none 2025-04-16 20:43:31 +02:00
Johannes Klein
81751fb7ac Revert "Do not access taxon if no longer there"
This reverts commit 131784db89.
2025-04-16 13:09:09 +02:00
Johannes Klein
131784db89 Do not access taxon if no longer there 2025-04-16 13:04:56 +02:00
Amanda Bullington
6dabe7ba5f Change text on Match loading screen (#2838) 2025-04-08 11:36:40 -07:00
Amanda Bullington
902e7c566a Change copy for Match header & omit check for already seen species (#2837) 2025-04-08 11:36:27 -07:00
Amanda Bullington
45cb760ae0 Populate taxon in AICamera -> ObsEdit with AICamera suggestion (#2832)
* Populate taxon in AICamera -> ObsEdit with AICamera suggestion

* Make sure we're only displaying predictions we already showed on AICamera

* Make suggested changes from PR review

* Add more types
2025-04-07 20:34:54 +02:00
Angie
d633799ffe Mob 596 sharing one image at a time in default mode shows outdated (#2804)
* Update query key in Match and Suggestions for sharing into app

* Remove  console logs
2025-03-31 11:44:05 -07:00
Johannes Klein
dfcef0b6a8 Spread suggestion's taxon into new function return (#2808)
This is necessary because the representative_photo returned by the image similarity search from API is fleeting only (e.g. from useOnlineSuggestions -> useSuggestions -> suggestions.topSuggestion).
The key is not saved to realm with the taxon because it only is relevant to the current photo scored on the API.
Therefore when overriding the taxon info with offline data we need to keep it.
2025-03-31 11:02:23 -07:00
Amanda Bullington
7733ededfb Carousel, Permission, Match, Login, AI Camera copy edits (#2802)
* Text updates and AICamera icon update for onboarding carousel

* Update background image camera permission

* Update text for permission gates

* Update text match screen, login signup, and camera

* Fix AICamera test
2025-03-25 16:18:39 -07:00
Johannes Klein
1cd63968f6 Add a UI for when there is no top suggestion but other suggestions with low confidence on match screen (#2790)
* Code indentation

* Additional case of returning a UI. For when no top suggestion.

* Basic layout

* Refactor MatchHeaders fallback title to the higher components fallbacks

* Add string

* Add header for when no top suggestion (but others)

* Additional suggestions section

* Different header for additional suggestions section

* Update header padding according to designs for all match UIs

* Update padding between add suggestions header and scrollable list

* Correct margins for no suggestions UI

* Add location button also to no suggestions state

* Correct margin for location button on match with top suggestion

* Correct margins for location button in no top but other suggestions UI

* Use wrapper for additional suggestions scroll to set margin

* Correct margin left of additional suggestions scroll

* Hide button while loading

* Increase margins for text in no suggestions state

* Less margin left of scroll
2025-03-24 11:42:38 +01:00
Johannes Klein
1516681515 Only show no match UI without add suggestions (#2786)
So, in a case of having no top suggestion but low confidence additional suggestions we show all UI available for the match screen, so that a user can potentially also improve them by giving location permission.
2025-03-19 14:19:31 +01:00
Angie
4a2feb926c fix location accuracy and using evidence location in match (#2764)
* use useWatchPosition for location fetch

* Fix latitude check, add shouldFetchObservationLocation to check for evidence

* Update Podfile.lock

* Update MatchContainer.js

---------

Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
2025-03-17 11:32:33 +01:00
Angie
136847d089 Hide "no suggestions" UI state when MatchScreen loading (#2772) 2025-03-14 14:38:53 -07:00
Amanda Bullington
7f784ce006 Remove height/width styling around additional match results to bring border styling back (#2769) 2025-03-14 10:44:19 -07:00
Johannes Klein
611c01a666 Online suggestions also need a skipped state (#2765)
* Undo a change I made in an earlier branch

* Add online skipped state

Integration test of UnsyncedObservations is checking the onlineSuggestions hook with setting NetInfo's isConnected to fasle. The assumption there is that the score_image API is not even hit in such an instance.
So, we also need a skip state for online suggestions.
2025-03-14 09:17:00 +01:00
Amanda Bullington
73ea2c9180 Fix for common name display for previously seen organisms on Match (#2760) 2025-03-13 14:07:03 -07:00
Johannes Klein
1712713682 Show iconic taxa icons if no taxon photo on no-suggestions match screen (#2759)
* The actual name of this taxon is iconic

* Does not apply here
2025-03-13 16:13:38 +01:00
Johannes Klein
170bf8017d Add an offline suggestions loading state (#2757)
* Define const in other component

* Separate out online and offline loading state

* Add type

* Add debug data

* Also call fetchError when netInfo says we are offline
2025-03-13 14:36:06 +01:00
Amanda Bullington
d6856b52ee Remove unnecessary taxon fetches in Match screen & replace with simple realm lookup (#2749) 2025-03-12 14:53:31 -07:00
Johannes Klein
252cc251fb Rename prop back to photos (#2746) 2025-03-12 13:35:33 +01:00
Amanda Bullington
8c0cfe1c47 Fuss a lot with invisible layout to make sure all suggestions are the same height (#2726) 2025-03-07 10:46:19 -08:00
Johannes Klein
d1398a4d29 Add UI for match screen not identifying (#2728)
* Alternative return for match screen in absence of suggestion

* Add lower part text elements

* Add margin at bottom

* Copy code to make a new suggestions scrll for iconic taxa

* Removing not needed properties of the copied code

* Remove log

* Remove width constraints

* Add a state to track selected iconic taxon

* Comment and code style

* Pass prop down to taxa scroll

* Use new props in iconic taxa scroll

* Color border according to selected state

* Use iconic taxon as top ID if none given

* Remove testing code

* Update Match.test.js
2025-03-07 19:42:38 +01:00
Johannes Klein
626fbfd94f Full screen loading state on match screen (#2717)
* Build UI for loading state between AI->Match

* Make designs for AI loading screen match Figma

* Selective changes from bf872e2d4f

* Selective changes from 9ed81f99c7

* Selective changes from 4bc7c3474f

* Selective changes from 4916cf70fb

* Replace loading state from store with props

* Add some types

* Make component agnostic of what skipping does

* Remove debug info

* Add more debug data

* Elongate loading state if online errors out and offline is still loading in sequence

* Remove underline

This classname had no effect as far as I can tell.

* Hide skip button when it has no function

* Remove a comment that slipped through partial cherry-picking

* Split apart online and offline fetch status

Weird but even though they start in sequence it happened to me that online error was received after offline was fetched successfully. So, Let's split apart online and offline loading state.

---------

Co-authored-by: Amanda Bullington <albullington@gmail.com>
2025-03-07 11:50:49 +01:00
Johannes Klein
2557936364 Also scroll to top when location permission is granted (#2720) 2025-03-06 21:05:51 +01:00
Johannes Klein
ba8315ab9f Remove initial block function from location permission gate (#2713)
This was introduced to a misunderstanding of requirements in a previous ticket. Now the permission gate behaves again the same on all screens.
2025-03-06 09:29:31 +01:00
Johannes Klein
7408e81733 Show congratulatory text based on rank and score (#2712)
* Add strings

* Add more congratulatory texts
2025-03-04 17:23:15 +01:00
Angie
25d0ac7e22 Removes location picker from match screen, fetches user location and reload suggestions (#2703)
* Removes location picker from match screen, fetches user location and reloads suggestions instead

* fix variable name

* Remove unused prop

* changes requested, changes to fetching place guess, changes to refetch offline

* Close permission gate when permissions denied initially

* change toggle to set in reducer

* add optional chaining to location values

* Add optional chaining for place name

* Closing on initial block optional

The function of closing the permission gate on pressing the initial block button was as far as I can see only scoped to the Match container.

---------

Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
2025-03-04 12:22:10 +01:00
Johannes Klein
a44f0412f3 Hide observation status for logged out users on simple MyObs (#2710)
* Show simple my obs header only for logged-in users

* ActivityCount TS

* CommentsCount TS

* IdentificationsCount TS

* ObsStatus TS initial pass not looking at errors

* QualityGradeStatus TS

* Update RealmObservation interface

* Update RealmObservation interface

* ObsUploadStatus TS, plain copy, no errors yet

* Update types

* Update type

* IconicTaxonIcon TS

* ObsImage TS

* PhotoCount TS

* ObsImagePreview TS

* Image is only opaque when logged in

* DateDisplay TS

* Remove debug flag from UploadObsStatus

* Update type

* Prop to hide ObsUploadStatus

* Test observations need those otherwise they appear as needing edit

* Update imports
2025-03-04 09:01:21 +01:00
Kirk van Gorkom
960ed4fabe Return null to help us visibly diagnose missing scores; update comment after debugging.
Part of MOB-513
2025-03-02 01:19:45 -08:00
Kirk van Gorkom
6918849cc8 Patch confidence calculation crash by handling both score and combined_score 2025-02-28 22:23:47 -08:00
Kirk van Gorkom
f0e0f7ca3d Revert "Patch confidence calculation crash by handling both score and combined_score"
This reverts commit 4bab4b222d.

Didn't catch an error when trying to change to a new branch, accidentally committed and pushed to main.
2025-02-28 22:16:44 -08:00