Commit Graph

628 Commits

Author SHA1 Message Date
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
a5c359ea44 Show only date picker first and add time picker as second step (#3093) 2025-09-05 13:49:25 +02:00
Johannes Klein
0f6aa5b11d Migrate BackButton to TS (#3092)
* Migrate to TS

* Update imports
2025-09-05 13:31:40 +02:00
Johannes Klein
f5e9a6d812 Migrate to react-native-vector-icons 12.x (#3091)
* Update package.json

* Update package-lock.json

* Update Podfile

* Update build.gradle

* Update Podfile.lock

* Update INatIcon.ts
2025-09-01 22:46:03 +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
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
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
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
5dd6ab1593 Add small timeout to modal showing (#3021) 2025-07-16 09:01:31 +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
Amanda Bullington
f8bce67501 Creative day: drawer and tab navigator dark mode (#2945)
* Add dark mode to tab and drawer navigation

* Remove log

* Add color for darkModeGray and make dark mode debug only
2025-06-25 10:00:01 +02:00
Johannes Klein
15d634340b Migrate ExploreLocationSearch to TS (#2959) 2025-06-14 17:30:46 +02:00
Amanda Bullington
a049d5022d Remove default props for RN upgrades (#2953) 2025-06-11 09:53:11 -07:00
Johannes Klein
d034e15eea Update vision camera and plugin (#2949)
* Update package.json

* Update package-lock.json

* Update Podfile.lock

* Update vision camera patch (that removes branded metadate)

* Remove camera orientation prop and patch

* Remove frame processor orientation patch

No longer needed, and accepted by the vision-plugin

* Remove rotationLocalPhotoPatch as it is not used

* Do not rotate freshly taken photos anymore to save in a temporary folder

I have not yet removed the actual making of a copy of the photo into the temp folder. It is only no longer rotated.

* Remove unused deviceOrientation param

* Rename file

* Change function name as it no longer rotates

* Move image resize logic to the existing helper function

Instead of calling it a "patch"

* Move helper function to the only file it is imported into

* Latest camera library versions

* Revert "Latest camera library versions"

This reverts commit da6b2f7c28.

* Remove iPad camera orientation patch

* Update import

* Update Podfile.lock
2025-06-11 08:15:01 +02:00
Johannes Klein
2e3db6cd54 Migrate FloatingActionBar to TS (#2944)
* Rename file without changes

* Migrate to TS
2025-06-07 20:47:40 +02:00
Amanda Bullington
3dab6305ae Performance: speed up API calls in MyObs by limiting fields (#2919)
* Show average scroll time

* Track fetching and scrolling performance, MyObs

* Limit default mode fields

* Update fields

* Make sure pagination and loading wheel work

* Limit the API requests we're making to what advanced users need

* Tweaks to add fetching metrics

* Remove one more field and console log

* Minimize unnecessary changes

* Keep debug mode scheme

* Fixes for ids, comments, and belongs to user

* Fix: Fetch data on infinite scroll using last observation id (#2930)

* Fetch using last observation ID when user reaches bottom of list

* Don't change momentum scroll which fetches updates to existing data
2025-06-04 10:11:28 -07:00
Amanda Bullington
502393a5d1 Dev experience: linting for TypeScript (#2933)
* Change TS warning about unused variables to error & support _unused in catch blocks

* Use TS recommended object instead of Object

* Set Function issues to warnings in TS files for later fixing
2025-06-02 09:47:29 -07: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
95151e065b Remove unused code and packages, add eslint package for TS, suppress TS errors (#2924) 2025-05-28 17:01:10 -07:00
Amanda Bullington
f5239881dd 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>
2025-05-21 14:40:54 -07:00
Angie
40da621f9b AI camera shutter button not tappable after first press (#2848)
* prevent multiple taps on ai camera button

* remove console log

* Add PressableWithDebounce component

* Add accessibilityState

* Change podfile lock to use same cocoapods as gemfile

* remove useeffect

* Change file extension

* Indentation

* Update type

* Extend PropsWithChildren

* Import type

* Add function param type

* use useFocusEffect instead of PressableWithDebounce in TakePhoto

* adding blur listener instead of using PressableWithDebounce

* Remove unused props

* Adapt to existing code style

* Move blur effect to CameraContainer (#2899)

* Move blur effect to CameraContainer

We can reuse the already existing `takingPhoto` state to disable the camera UI until the user navigates away.

* Also disable photo library on tablets

---------

Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
2025-05-16 10:04:04 -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
Angie
cd6d6543f1 Add login button where logout button is on menu (#2891)
* Add login button in menu where the logout button is

* Update snapshots

* Changes to fit design
2025-05-14 10:00:04 -07: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
budowski
9aa5fe46d1 MOB-708 - suggestions screen - show percentages instead of confidence dots (#2888)
* MOB-708 - suggestions screen - show percentages instead of confidence dots

* Code review fixes

* Remove confidencePercentage from condition

* Reuse existing string from Match screen header

---------

Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
2025-05-12 12:17:46 -07:00
Angie
8b47eb329c show obs status after upload only in list view advanced mode (#2881) 2025-04-29 12:45:51 -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
Amanda Bullington
6e87dafae4 Limit 429 errors in Explore taxa search (#2867)
* Prevent lots of extra renders from useTaxonSearch; prevent TaxonResult from refetching remote taxon

* Add debounce to SearchBar to prevent unnecessary API calls

* Reset local value when clearing search
2025-04-24 07:00:24 -07:00
Amanda Bullington
5d01431578 Prevent multiple taps on all Button components (#2844)
* Change text on Match loading screen (#2838) (#2841)

* Change copy for Match header & omit check for already seen species (#2837) (#2840)

* Fix: prevent multiple taps on Buttons like Suggest Id (#2833)

* Add debounce to Button to make sure users can't double tap any buttons / navigate twice

* Fix tests by mocking the Button component with a quick debounce

* Remove useEffect
2025-04-24 07:00:08 -07:00
Angie
6a61c3340d Decrease TaxonDetailHeader size to match ObsDetails header size (#2863)
* Decrease TaxonDetailHeader size to match ObsDetails header size

* Adjust taxondetails header to match obsdetails header
2025-04-22 09:57:12 -07:00
Amanda Bullington
332f419c98 Add tracking for Pressable and INatIconButton taps (#2855)
* Add tracking for Button taps

* Use PressableWithTracking and handlePress in INatIconButton to track all pressables with a testID

* Import as UnstyledPressableWithTracking for consistency
2025-04-16 08:54:41 -07:00
Johannes Klein
1dd114f96a Consistent margin around user profile stats (#2856)
* Increase margin top of user count buttons

* Use 30px of margin instead

* Do not show an empty container with margin when unable to Follow
2025-04-16 11:05:52 +02:00
Amanda Bullington
043ea1cf46 Fix: prevent multiple taps on Buttons like Suggest Id (#2833)
* Add debounce to Button to make sure users can't double tap any buttons / navigate twice

* Fix tests by mocking the Button component with a quick debounce
2025-04-08 12:46:01 -07:00
Kirk van Gorkom
7d125044a2 Merge pull request #2806 from inaturalist/mob-568-camera-location-fetching-should-happen-when-photo-taken-not-1
Fetch accurate camera location when shutter button / checkmark pressed
2025-04-04 18:06:27 -07:00
Amanda Bullington
84cb088949 Fix: limit API calls in AICamera to avoid delay in advancing navigation (#2820)
* Limit iconic taxa and fetchTaxa API calls

* Add timeout to geocoder

* Revert useTaxonSearch
2025-04-03 08:07:07 -07:00
Amanda Bullington
787410876f Update AICamera icon (#2815) 2025-03-31 13:55:04 -07:00
Amanda Bullington
915a2dd40f Fixes for e2e tests? 2025-03-31 10:48:21 -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
Johannes Klein
a6b8a50425 Show a simple unviewed-activity-indicator for default obs list (#2801) 2025-03-26 09:05:02 +01: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
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
4bd212813e Update ai camera icon (#2792)
* First attempt, but need to replace SVGs

* Icons

* Update aicamera across app with Figma sizing
2025-03-21 13:16:25 -07:00
Angie
146886fbeb Increase tappable area of back button, remove console logs (#2787)
Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
2025-03-20 10:02:00 +01:00
Johannes Klein
647aaf5457 Hide subscribe button from kebab menu when logged out (#2780)
* KebabMenu TS

* Hide subscribe button from kebab menu when logged out

Closes MOB-591

* Update import
2025-03-17 22:30:18 +01:00
Amanda Bullington
6f5d24df66 Zoom map in further when tapping current location button (#2774) 2025-03-14 17:14:17 -07:00
Amanda Bullington
2be121d1a8 Fade out MyObs checkmark without fading into ObsStatus (#2763)
* Don't fade into ObsStatus in MyObservations

* Update snapshot
2025-03-13 18:33:17 -07:00
Johannes Klein
b35952481f Make any CustomFlashList scrollable with Voice Over (#2756)
* Do not make FlashList wrapper accessible

Because it takes away a11y from the single items, and makes the list unscrollable with a11y commands.

* Remove a11y label

This was read without the actual param passed in so made no sense. Removing it for now. In that way at least the actual ID text is read.

* Make bottom sheet container not accesible
2025-03-13 11:26:46 +01:00