Commit Graph

114 Commits

Author SHA1 Message Date
Abbey Campbell
e2346888fb mock only screenOptions 2026-03-25 12:18:36 -07:00
Abbey Campbell
a19fb0541c add polyfill for idleCallback 2026-03-23 23:46:37 -07:00
Johannes Klein
c7b596a519 Update react-native-logs jest mock (#3450)
* Update jest.setup.js

* Let's log all args instead
2026-03-19 09:34:53 +01:00
Abbey Campbell
41f66ecf3c Merge pull request #3427 from inaturalist/mob-1234-upgrade-react-native-reanimated-to-latest-version-and-fix
Mob 1234 upgrade react native reanimated to latest version and fix
2026-03-12 16:22:43 -07:00
Abbey Campbell
1a7faba1d9 remove eslint-disables 2026-03-12 15:15:08 -07:00
Abbey Campbell
a7f262d9d6 add mock for worklets and update snapshots 2026-03-11 13:06:09 -07:00
sepeterson
b3ec2788a6 MOB-1182: mocks for unit tests 2026-02-26 11:10:42 -06:00
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
Abbey Campbell
f05d79be24 remove isTest flag, override bottom-tabs animation in jest setup, add comments to detox fix 2025-12-09 18:48:17 -08:00
sepeterson
403be86702 MOB-991 fix perf jest mock 2025-11-25 08:05:31 -06:00
sepeterson
fb4a994dd0 MOB-991 add jest mock for perf 2025-11-12 16:15:36 -06:00
Johannes Klein
bad9c5a4d8 Add firebase dependency, and basic logging (#3127)
* Update package.json

* Update AppDelegate.mm

* Update Podfile

* Update .gitignore

* Update link-inat-model-files.sh

* Add plist file to project

* Update project.pbxproj

* Add analytics package

* Update project.pbxproj

* Update PrivacyInfo.xcprivacy

* Basic screen tracking

* Basic button press logging to firebase

* Update package-lock.json

* Update Podfile.lock

* Add Android setup

* Update .gitignore

* Add analytics mock

* Ignore rubocop warning here

* Create GoogleService-Info.example.plist

* Create google-services.example.json

* Add instructions to set up Firebase configs

* Update e2e_ios.yml

* Update e2e_android.yml

* Better plural

* Use specific XCode version in e2e CI

* Update GoogleService-Info.example.plist

* Revert "Update GoogleService-Info.example.plist"

This reverts commit 0bc0ed4862.

* We need an actual real app id or we get a crash during app start

* My bad, we do need both files for building

* Also set API key

* Add comments

* Add comment

* Update Podfile.lock

* Revert "Use specific XCode version in e2e CI"

This reverts commit cbd63d1b5d.
2025-10-16 13:15:10 +02: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
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
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
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
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
Amanda Bullington
0a7ae03832 Fix attempt: Signal 11 crash on install (#2676)
* Split up all the custom hooks in App.js; begin to only run things when they're needed

* Code cleanup
2025-02-19 19:18:08 -08:00
Ken-ichi
21a66c8580 fix: make UUIDs more random (#2629)
Replaces react-native-uuid with uuid, which might do a better job making UUIDs random
2025-01-21 15:23:15 -08:00
budowski
f89736188c feat: use physical volume buttons to capture photo (#2495)
* Fix #2212 - use physical volume buttons to capture photo

* Fixed tests (mocking VolumeManager)

* Fixed tests (mocking VolumeManager)

* #2212 - physical volume buttons for camera capture - also in AI camera

* #2212 - additional fixes for AI camera

* Update pods

* Update pods

---------

Co-authored-by: Amanda Bullington <albullington@gmail.com>
2024-12-17 16:40:26 -08:00
Ken-ichi Ueda
9bd33b4176 test: mock installData helper 2024-11-11 10:34:37 -08:00
budowski
7b8c88c84d feat: add onboarding carousel (#2285)
Note that offsetting the onboarding images ended up being a bit hard. We're
mostly doing so with a cropped version of one of the images.

Closes #1906

Also tried to de-flake some tests:

* Use fake timers when possible
* Ensure time travel helper doesn't un-fake our timers
* Wait for time travel helper to finish so changes don't happen outside of
  act
* Stop mocking useCurrentUser in integration tests; that's app code and should
  not be mocked when integrating all parts of the app; instead use signIn /
  signOut helpers
* Remove unnecessary direct uses of act()
* Mocked some inatjs calls to prevent React Query complaints about undefined
  query return values
* Close onboarding before all e2e tests

---------

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2024-11-04 12:03:55 -08:00
Ken-ichi
88c7d778c5 feat: set app locale on install, sign in, and sign out (#2294)
* Use system locale on install
* Check for system locale when app comes to foreground (required in Android
  b/c app doesn't get restarted when system locale changes)
* Create a constant of SUPPORTED_LOCALES in loadTranslations.js
* Restart app on sign out
* Use existing transaction when writing to Realm if available (might also
  consider an approach that waits for the existing transaction to complete)
* Make value returned by useCurrentUser actually reactive

Closes #2243
2024-10-25 09:39:50 -07:00
Ken-ichi
ddca126ed5 refactor: log around repeat errors (#2293)
* Catch and squelch "Network request failed" errors that happen during logging itself (#1639)
* Log around RNSI access to resolve when/where those errors occur (#1639)
* Log around JWT retrieval to resolve when/where JWT missing errors occur (#2155)
2024-10-22 15:41:54 -07:00
Amanda Bullington
67dffdcf28 Screen transitions with fade animation (#2284)
* Disable animations on tab bar screens

* Fade in pages accessible from the tab bar

* Add fade in view to stack navigator screens

* Use time travel to step through frames of animation for SoundRecorder

* Use time travel to fix all tests with fade in navigation

* Nav fix
2024-10-20 14:45:31 -07:00
Amanda Bullington
cf70a4358a Move modules from jest setup to __mocks__ (#1949)
* Get a few mocks working in __mocks__ folder

* Move more mocks into __mocks__

* Move mocks

* Move zustand mock

* Add more mocks to __mocks__

* More mocks

* Move more files to __mocks__ and audit existing mocks

* Mock react navigation in __mocks__

* Restore test to help with imports after jest env torn down

* Add fake timer to integration test with userEvent

* Add RN paper mock
2024-08-11 11:27:52 -07:00
Amanda Bullington
cf896a3a17 Toolbar upload status refreshes when user returns to MyObs (#1942)
* Write some failing navigation tests for MyObs navigation

* Add one more failing test to check for empty screen after all obs are deleted

* Update what happens on blur

* Changes to focus effect

* Revert "Changes to focus effect"

This reverts commit c779504cdf.

* Test: toolbar status reset when user leaves screen

* Unmock useFocusEffect in Jest; fix tests

* Minor nav mocking updates

* Fix import
2024-08-09 11:21:25 -07:00
Ken-ichi
ea0afb87a9 Don't restart location fetch when view blurred (#1936)
* Don't restart location fetch when view blurred
* Removed what looked like an unnecessary callback in DisplayTaxonName
* Refactored tests
2024-08-07 17:33:22 -07:00
Amanda Bullington
b8c08ae2d4 Reassure tests (#1914)
* Basic performance tests for key components

* Fix MyObs integration test with fake timers and less rerendering
2024-08-02 19:07:41 -07:00
Amanda Bullington
9a0581670f Consolidate key-value stores (#1879)
* Switch to zustand mmkv storage instead of async storage

* Update hooks using async storage

* Remove asyncstorage

* Remove LocalPreferences

* Prevent collision upserting from infinite scroll & sync remote obs
2024-07-30 09:12:26 -07:00
Amanda Bullington
c3c98deeda Create new obs when backing out to AICamera (#1832)
* Write test to confirm only one obs photo added when backing out of AICamera

* Create new obs when backing out to AICamera; closes #1822
2024-07-19 09:57:16 -07:00
Amanda Bullington
92cafdde83 Land user on Suggestions when one photo imported (#1824)
* Create navigation test for PhotoGallery

* Code and test land user on Suggestions when one photo imported
2024-07-16 14:47:02 -07:00
Amanda Bullington
abd4bcee23 Refactored location fetching for accurate locations (#1788)
* Refactor to use watchPosition

* Update useWatchPosition with permissions/retry

* Replace useUserLocation with useWatchPosition and fix tests; return userLocation from watch position hook

* Only update observation keys when there's an observation

* Improve TypeScript definitions

* Revert TypeScript commit

* Revert "Only update observation keys when there's an observation"

This reverts commit a4cd17a513.

* Code cleanup: make useWatchPosition more modular

* Code cleanup; location permission in ObsEdit instead of subcomponent

* Use correct accuracy in Camera photos

* Camera fixes

* Fixes to watching position in ObsEdit

* Fix useWatchPosition tests

* Fix tests

* Make sure state updates when renavigating to OsEdit; test fixes
2024-07-16 09:23:09 -07:00
Ken-ichi
fe0229291e Restore photo deletion (#1789)
* Restore photo deletion
* Rename methods for accessing media files
* Added integration test for photo deletion
* Cleaned up some accessibility labels

Closes #1429
2024-07-10 15:23:53 -07:00
Ken-ichi
50d9d1e60c Media clearing (#1771)
* (Re-)Fix bug where shared photo got deleted before it could be used
* Only run cleanup when MyObs has focus
* Only run cleanup once a minute
* Only delete files that are a day old or more
2024-07-05 21:33:52 -07:00
Amanda Bullington
452ebcbdf4 Navigate user correctly with selected ID when coming from TaxonDetails (#1766) 2024-07-03 16:29:46 -07:00
Ken-ichi Ueda
6788601751 Bugfix: first photo was not getting saved to gallery from StandardCamera 2024-06-14 10:44:15 -07:00
Amanda Bullington
aa167c669d Refactor upload functionality into hook/zustand (#1606)
* Refactor upload code into hook and zustand slice

* Create a single source of truth for toolbar and individual progress

* Fix unit tests

* Fix more tests

* Continue trying to simplify upload progress and status code

* Continued overhaul of upload code

* Fix exclamation point in Toolbar

* Fix total toolbar progress

* Fix tests

* Update snapshots

* Code cleanup

* Update MyObs test

* Fix most tests by not deleting realm

* Keep attempting to make toolbar text clear in subsequent tests

* Mock Zustand and reset state after all tests

In theory this should make testing with Zustand simpler. The real kicker is
that resetting state will fail if we're not careful about manually replacing
nested objects in Zustand state updates.

* Bugfix: removeAllFilesFromDirectory works with File objects, not raw paths

* Update status text when uploads canceled

* Only show red exclamation rotating icon after all uploads attempted

* Fix progress bar with zustand nested object

* Fix toolbar progress

---------

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2024-05-30 20:36:50 -07:00
Ken-ichi Ueda
1aed88b9f9 Several attempts at error handling
* Catch 401 errors when we try to fetch remotely deleted obs for signed out
  users
* Skip the check to see if a user is a friend on UserProfile when signed out
* Replace uses of RNFS.unlink() with a wrapper that ignores errors about files
  not existing
* Tried to get safeRealmWrite to preserve error type before re-throwing
2024-05-29 17:32:43 -07:00
Amanda Bullington
917f9da7be Clear cached photos for computervision/score_image (#1518)
* Refactor image-resizer into helper function for easy logging

* Create a folder for computerVisionSuggestions

* Display iNat app directories in Debug

* Delete old images from computerVisionSuggestions/ when navigating away from Suggestions

* Fix online suggestions API call

* Fix tests

* Clear computer vision directory when landing on Suggestions screen
2024-05-09 13:32:52 -07:00
Johannes Klein
ea6539e35a Vision camera v4.0.3 (#1515)
* Upgrade vision-camera, worklets and plugin

* Update Podfile.lock

* Update runAsync patch

* Update comment

* Update jest.setup.js
2024-05-08 13:48:16 +02:00
Johannes Klein
05b6309307 Vision camera 4.0.1 (#1437)
* Update camera and plugin packages

* Remove one patch

* Replace deprecated function

* Update runAsync patch

Removing this patch leads to non-functioning frame processors in release builds. Contrary to what the original issue's solution states.
2024-04-23 14:27:27 +02:00
Johannes Klein
84d506f184 Mock format 2024-04-22 13:36:04 +02:00
Johannes Klein
700990ba0b 1305 Remove predictions state on blur and focus (#1402)
* Remove predictions state on blur and focus

* Mock for plugin function

* Fix mock

* Update mock

* Rename ARCamera test files
2024-04-17 12:32:53 +02:00
Johannes Klein
d6afb4b386 Upgrade to RN 0.73 (#1339)
* Upgrade to RN 0.73 with upgrade helper

* Upgrade testing-library

* Comment announcements

* Comment out UserProfle test

* Mock function used to calculate masonry layout

* There should not be a modal here

* There is actually also no modal here

* Use View if SafeAreaView is undefined

* Replace fast image library that was failing tests because of not being maintained

* Clear mocks in useTaxon test

* Remove legacy deps from testing flow

* Snapshot update

* Revert "Snapshot update"

This reverts commit bca8b296df.

* Update package-lock.json

* Clean-start

* Update project.pbxproj

* Reenable test that failed before updating dependency

* Reenable test that failed because of dependencies

* Remove comment
2024-04-08 15:28:06 +02:00
Amanda Bullington
bc4d0bc661 Package upgrades (#1361)
* Upgrade more packages and include new localize mock

* Update patch for vision camera
2024-04-05 15:59:35 -07:00
Amanda Bullington
63484b1330 Package updates (#1357)
* Package updates

* Add mocks and update snapshot
2024-04-04 20:57:09 -07:00
Amanda Bullington
837e5fad8f Update jwt library (#1349)
* Run npm audit to fix vulnerabilities

* Fix jwt security vulnerability

* Remove jwt-io mock

* Mock jwt library

* Substring sanitization
2024-04-03 22:30:07 -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