265 Commits

Author SHA1 Message Date
Ryan Stelly
b78be9243d lint rule & autofix for "trailing comma" (#3299)
* (lint) MOB-1063 enforce trailing commas

* autofix trailing commas

* manually fix newly introduced maxlen violations

* add trailing comma convention to i18n build
2025-12-22 20:17:13 -06:00
sepeterson
0d42eab08a MOB-512 edit tests to rm unnecessary code, make consistent with greater test suite, and rm out of scope test 2025-12-08 18:10:32 -06:00
sepeterson
dfcf12cc73 MOB-512 merge main 2025-12-04 21:31:43 -06:00
sepeterson
998f21a121 MOB-512 add map section tests 2025-12-04 21:23:13 -06:00
sepeterson
6c839f9036 MOB-512 rm silly import 2025-12-04 20:40:17 -06:00
sepeterson
ff4537dd62 MOB-512 first pass SavedMatch integraton 2025-12-04 20:33:04 -06:00
Abbey Campbell
2ee99d6c7b fix tests 2025-12-02 13:29:00 -08:00
sepeterson
ab96a0be89 Merge branch 'main' into mob-512-implement-saved-match-screen 2025-11-25 08:11:28 -06:00
sepeterson
19cb7064a6 MOB-512 minimal unit test fix and prop spreading allowed for tests 2025-11-21 10:12:59 -06:00
Yaron Budowski
9c2facc680 MOB-925 - new designs for add-obs button sheet 2025-11-14 14:19:05 -08:00
Johannes Klein
9c90c2e45f Update react-native to 0.79 (#3051)
* Upgrade helper: package.json

* Upgrade helper: gems

* Upgrade helper: Android

* Update AppDelegate

* Fix error in compiling

* Update package-lock.json

* Update Podfile.lock

* Update package-lock.json

* Update Podfile.lock

* Remove no longer needed mock

* Comment out entire test and not only the expect call

* Most other unit tests use this render helper function that

wraps the component in the entire app.

* Mock react-native exports as esModule

* Update .flowconfig

* Update Gemfile

* Revert "Comment out entire test and not only the expect call"

This reverts commit 8785f81529.
2025-10-01 22:44:14 -05: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
Johannes Klein
49091f8fc4 Enable React Compiler (#3082)
* Update package.json

* Update package-lock.json

* Enable plugin

* Update package.json

* Update package-lock.json

* Update .eslintrc.js

* Create a new object instead of mutating the existing one

* Update SoundRecorder.js

* Do not mutate prop directly

* Do not mutate store value directly

* Disable compiler for zoom hook

Because it uses reanimated logic, and previous work laid out we should specifically disregard a rule of react here, unsure what to do here for now.

* Move array for tracking results into component

* Disable compiler for StandardCamera

* Do not mutate store value directly

* Disable compiler for FullPageWebView

* Do not mutate route param

* Remove unnecessary check if state is true before setting it to false

* Fix: user might be undefined

* Update reanimated usage with new compiler compliant API

* Fix: taxon might be undefined

* Fix: taxon might be undefined

* Fix: common pitfall of trying to render text outside of Text component

* Update interface

* Add package override

* Update package-lock.json

* Refactor updating of user preferences into User model

* Remove no memo directive from zoom

* Update file imports

* Migrate safeRealmWrite to TS

* Update interface and import path

* Update interface

* Refactor useLocaalObservation hook to not mutate return value of a function that should not be mutated

* Update tests to new return structure

* Remove useSafeRoute hook

We get the same information from error contexts and surrounding documents, and this hook was violating the rules of react by conditionally calling another hook.

* Use optional chaining

* Update TaxonNamesSetting.test.js

* Fix: use optional chaining

* Extend on RNTLs renderHook instead of re-implementing

* Remove unnecessary mock

* Remove unnecessary mock

* Remove unecessary mock

* Remove trailing spaces
2025-09-01 17:06:51 +02:00
Johannes Klein
dc1e1ec3f1 Testing with mocked FadeInView component (#3064)
* Repair integration test

* Repair Explore.test.js

* Move no longer broken test

* Mock the fadeInView that does screen transitions in tests

* Mock another fade in view
2025-08-22 21:09:23 +02:00
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
6e696cb524 Update to react-native 0.77 (#3026)
* Upgrade helper changes JS side

* Upgrade helper Android

* Upgrade helper iOS side

* Update project.pbxproj

* Create react-native-modal+14.0.0-rc.1.patch

* BackHandler.removeEventListener is deprecated

* Update react-native-modal

* Update .flowconfig

* Update package-lock.json

* Update Podfile.lock

* Update Podfile.lock from main

* Replace toBeVisible with toBeOnTheScreen

This is not recommended by react-navigation, because even though toBeOnTheScreen makes sure the components are in the tree it does not mean they are visible to the user. For example, in terms of navigation a previous screen is still i the tree but not visible to the user in the app.
I spent around a day trying to figure out why the isVisible check stopped working, and still have no clear answer.
Testing in the actual app shows that all of those flows are still working as expected, so it is a test-environment-only problem.
My suggestion would be to re-visit this problem after we have updated RN to latest, and testing related libraries to latest versions.
2025-08-01 12:11:13 +02:00
Johannes Klein
020d46f9b9 Add conditions for which the Obswheel tooltip is shown (#2980)
* Update tooltip trigger logic in AddObsButton for logged in

Refines the tooltip display conditions for AddObsButton. Now shows the tooltip for logged-out users after their second observation, and for logged-in users with 50 or fewer observations upon landing on the My Observations screen. Adds comments for future handling of users with more than 50 observations.

* Refactor the state justFinishedSignup into the layout store slice

* Refactor trigger logic and add conditions for when the tooltip would overlap with pivot cards

* Move files

* Basic AddObsButton unit test

* Add mock for addListener

* Basic test for tooltip

* Add tests for two conditions that require a card dismissal

* Wrap setState in act in helper function
2025-06-27 13:19:28 +02:00
budowski
7ce12fb66c Mob 706 hide toggle location when no photo location (#2963)
* MOB-706 - don't show use/ignore location button if obs/evidence is missing location

* Fixed tests
2025-06-18 14:01:59 +02:00
Amanda Bullington
5eb77e91fd Add unit and integration tests around sharing photos (#2948) 2025-06-12 16:00:50 -07:00
Johannes Klein
4e7322ed3b Update react native gesture handler (#2955)
* Update react-native-gesture-handler

Version 2.18.x introduces support for RN 0.75

* Update package-lock.json

* Update Podfile.lock

* Fix PhotoLibrary tests

* Update jest.setup.js

* Remove time travel calls
2025-06-11 23:24:38 +02:00
Johannes Klein
26f0863ec9 Fix: integration tests store setup when changing layout slice (#2932)
* Update MyObservations.test.js

* Remove comment

* Remove unnecessary setState

* Update MyObservationsLocalization.test.js

* Previous change can be more specific

* Update MyObservationsSimple.test.js

* Update AICamera.test.js

* Update Explore.test.js

* Update MyObservations.test.js

* Update ObsEdit.test.js

* Update SoundRecorder.test.js

* Update PhotoImport.test.js

* Update CustomTabBar.test.js

* Update SuggestionsWithUnsyncedObs.test.js

* Update SuggestionsWithSyncedObs.test.js

* Update PhotoDeletion.test.js

* Update Suggestions.test.js

* Update AddObsButton.test.js

* Update MediaViewer.test.js

* Update PhotoLibrary.test.js

* Update StandardCamera.test.js

* Update SimpleUploadBannerContainer.test.js

* This test needs to be in advanced mode

* Remove setState of shownOnce back to default

* Refactor store override calls into a helper function

* Update MyObservationsLocalization.test.js

* Update MyObservationsSimple.test.js

* Update PhotoDeletion.test.js

* Update PhotoImport.test.js

* Update SuggestionsWithSyncedObs.test.js

* Refactor to use helper

* Update SimpleUploadBannerContainer.test.js
2025-06-10 16:10:19 +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
Amanda Bullington
7f42509797 Add logging to uploads & validate jwts at each upload step (#2923)
* Revalidate jwt token before uploading observation and before attaching media

* Add logging to uploads and jwts

* Make logs more useful, add context and appstate

* Fix inat uploading mocks in tests

* Fix uploader test to reflect errors being thrown
2025-05-29 16:42:34 -07:00
Amanda Bullington
47bbcbd18f Maintenance: break upload code into smaller modules -- API calls (#2900)
* Split apart observation & media uploaders & add unit tests

* Use typescript

* Return only media items needed

* Fix tests related to uploading vs. uploaded status

* Remove undefined from union for observationUUID

Above and below in the callstack of those functions the type is only string, so that change seems to be fine for me to make directly on your PR.

* Extract an Operation interface (#2904)

* Type updates

* Update mapped param types

---------

Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
2025-05-16 15:19:34 -07:00
Johannes Klein
a20a22bad8 Hide "id with ai button" for no media or sound only (#2896)
* Add Boolean to control button being shown

Same Button component, only with changed indentation

* Apply margin between buttons to hide button instead

* Move left margin to container

Because ID button is now optional but container is not.

* Increase margin between buttons

Not part of the ticket, but it was not according to designs.

* Use existing state for the button

* Update integration test

* Update duplicate testID

* Add unit test for showing button behaviour based on photos
2025-05-16 15:30:06 +02:00
budowski
4c20939c1a MOB-704 - declutter explore obs grid items (#2889)
* MOB-704 - declutter explore obs grid items

* Code review fixes
2025-05-12 12:17:32 -07:00
Johannes Klein
844629bbf4 Revert "Maintenance: break upload code into smaller modules -- realm syncing functions (#2872)"
This reverts commit 43f9520b86.
2025-04-29 16:53:25 +02:00
Amanda Bullington
43f9520b86 Maintenance: break upload code into smaller modules -- realm syncing functions (#2872) 2025-04-29 16:50:02 +02:00
Amanda Bullington
b362071b1b Change default explore view to observations map view (#2871)
* Set default explore view to observations

* Rearrange ObservationsViewBar buttons to always show grid first and map first in Explore

* Set initialRegion of Explore map to same zoom level as location picker, using delta

* Consolidate map code into MapView with ref forwarding to allow animation & initialRegion set

* Stop controlling the map region from zustand, since we're using initialRegion

* Make sure we're not double animating when navigating to a new place

* Use ref to only get map boundaries exactly when they're needed, instead of tracking in state

* Make sure current location button does the same as NEARBY button

* Update Explore integration tests to reflect observations view as first view

* Fix navigation Explore tests to reflect landing on observations view

* Update MapView unit tests

* Check location permissions in MapView on current location button

* Code cleanup

* Fix tests and add test for location permissions

* To Mob 720: add some types and null guards (#2878)

* Update Map with Region type

* Type initialRegion

* Guard against null

* Guard against undefined coordinates

* Center loading indicator but not fill space (#2880)

Move the loading indicator to the center of the parent (and back left and top for half its size).

---------

Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
2025-04-28 11:53:47 -07:00
budowski
af6ac3694a MOB703 - changes to obs edit screen identification section (#2865)
* MOB703 - changes to obs edit screen identification section

* Adjust size of magnifying glass icon

---------

Co-authored-by: Amanda Bullington <albullington@gmail.com>
2025-04-22 10:03:51 -07:00
Amanda Bullington
e5aa89815a Merge branch 'main' into mob-568-camera-location-fetching-should-happen-when-photo-taken-not-1 2025-03-31 13:14:01 -07:00
Johannes Klein
73b7c3282b Navigate based on setting in both cameras (#2814)
* Navigate based on setting in both cameras

* Update SuggestionsWithUnsyncedObs.test.js

* Update Suggestions.test.js

* Update AICamera.test.js
2025-03-31 11:59:55 -07:00
Amanda Bullington
915a2dd40f Fixes for e2e tests? 2025-03-31 10:48:21 -07:00
Amanda Bullington
0c033a6f6b Change mocks from useWatchPosition to fetchAccurateUserLocation 2025-03-27 14:32:29 -07:00
Amanda Bullington
213dc19dd0 Fetch location when observation processed; fetch separate location for geomodel without watch 2025-03-27 13:25:09 -07:00
Amanda Bullington
d782538109 Advanced settings UI updates (#2797)
* Open more options on long press

* Add tests for long press

* Rearranging Settings screen with new layout

* Add toggle for advanced settings in layout slice; fix default mode toggle

* Update settings with navigation flows

* Fix tests

* Change power mode switch for e2e test

* Fix settings test for green button toggle

* Fix advanced user toggle in e2e test (which hides pivot cards)

* Changes based on design convo; test fixes

* Fix e2e tests

* Follow user flow chart and update nav accordingly

* Rename function

* Fix test

* Can be null so check for false only

* Little less spacing between radio button rows

* Minor UI updates

* Remove check for previous setting in UI

* This is no longer used anywhere

* Update AICamera.test.js

* Update AICamera.test.js

* Update AICamera.test.js

* Update Suggestions.test.js

* Update Settings.test.js

* Update LanguageSettings.test.js

---------

Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
2025-03-27 17:36:36 +01:00
Amanda Bullington
be53f87537 Add long press to AICamera gradient button in default/advanced (#2793)
* Open more options on long press

* Add tests for long press
2025-03-24 12:33:57 -07:00
Amanda Bullington
70ffa9112a Make MyObservationsSimple the standard UI across default/advanced mode (#2788)
* Update TypeScript

* Fix some tests with new default MyObservationsSimple

* Show upload toolbar on MyObs advanced

* Update tests for simple mode

* Fix deletions popping back up on MyObs

* Fix e2e test, which also means fixing our deletion process

* Fix useSyncObservations test

* Requested changes to better fit latest designs

* Add tests to check for hidden upload banner
2025-03-20 17:04:31 -07:00
Johannes Klein
57dc1d226e Revert "Add a plus icon button to add all observation types to default mode header (#2734)" (#2754)
This reverts commit 37a9f6d58b.
2025-03-15 10:18:40 +01:00
Johannes Klein
e4e6baee1d Override show suggestions screen to always get there from AI camera (#2767)
* Override show suggestions screen to always get there from AI camera

* Update AICamera.test.js
2025-03-14 13:03:07 +01:00
Johannes Klein
69ada0812a Make app default to the suggestions-first mode (#2753)
* Move button to top

* Defaults to use suggestions as first screen

* Update tests
2025-03-13 09:40:45 +01:00
Johannes Klein
37a9f6d58b Add a plus icon button to add all observation types to default mode header (#2734)
* AddObsButton TS

* Add simple plus icon version of the AddObsButton to my obs list header

* Update imports
2025-03-10 11:52:00 +01:00
Johannes Klein
15c1946b71 Use default mode from first app install (#2733)
* Default mode used on app install

* Update integration tests
2025-03-10 09:47:47 +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
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
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
Johannes Klein
83bb3a88a6 Setting to control if screen after camera/library is suggestions (#2695) 2025-02-26 07:30:50 +01:00
Amanda Bullington
a25386169b Fix: scroll to activity item in default mode (#2698)
* Minimize the number of rerenders by splitting sheet logic into separate component

* Fix agree sheet

* Fix y offset for scrolling from notifications to activity item
2025-02-25 19:00:23 -08:00
Johannes Klein
bb03bb695a Change default MyObs layout to grid (#2686)
* Change default MyObs layout to grid

* Rename testID

* Update tests expecting to start with list view

* Reverse order of buttons in layout selector

* Fix layout bug of having empty boxes on explore
2025-02-21 18:50:14 +01:00