Commit Graph

35 Commits

Author SHA1 Message Date
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
Amanda Bullington
3c4ec368f5 Fix: isLoggedIn memory leak (#2952)
* Fix memory leak from isLoggedIn

* Fix tests with mocking for clearAuthCache

---------

Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
2025-06-11 10:04:54 -07: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
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
Amanda Bullington
a4d2c7ca24 Restore language chooser and queue offline locale changes (#2329)
Restore language chooser with system locale (signed out users), web locale (signed in users), or app locale (as selected by user)
2024-11-03 20:12:06 -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
267d8a58b6 fix: prevent length of undefined error when processing UTFGrid data (#2228)
Adds null checks for UTFGrid processing and tests

Closes #2205
2024-10-16 12:47:34 -07:00
Amanda Bullington
b5634a2de5 Navigate logged out users from join project > login screen (#2224)
* Logged out users who press join project nav to login flow; closes #2115

* Fix a11y test
2024-10-03 15:28:02 -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
960f3e3b67 Some typescript conversions in an attempt to improve CodeQL coverage (#1904) 2024-08-01 17:55:33 -07:00
Ken-ichi
5c6e88cbc1 Typescrpt path aliases (#1648)
* Typescrpt path aliases;
* Tried to resolve all ts errors in one file
2024-06-05 14:35:49 -07:00
Ken-ichi
0a1069fce9 Show notifications obs photos for remote obs (#1519)
---------

Co-authored-by: Angie Ta <angie@inaturalist.org>
2024-05-09 20:31:04 -07:00
Ken-ichi
a7a2e1c10f Show up-to-date metadata for observations immediately after upload (#1497)
This fetches a remote copy of each observation after upload to make sure the
client has the freshest copy of the data immediately.
2024-05-06 17:50:46 -07:00
Amanda Bullington
21b9cc6a97 Update Eslint to support TypeScript (#1419)
* Add typescript parser and fix Flow errors in JS files

* Uninstall packages from react-native/eslint-config

* Fix all flow errors (or ignore them for unknowns
2024-04-18 21:35:26 -07:00
Amanda Bullington
408f746701 More package updates (#1360)
* Package updates, including migration to v5 for react-query

* Fix string

* Fix test: ensure markViewed only called once

* Comment out tests
2024-04-05 14:49:42 -07:00
Ken-ichi
6fdf3d2faf Taxon result updates (#1254)
* Only requests remote taxon if local is missing or hasn't been synced in a
  week
* Returns a localized version of the remote taxon immediately without waiting
  to get a newly-created record from realm
* Expands tests to use a unique realm, integrate more of our code, and check
  to ensure the API gets called
* Show indicator while loading taxon on ARCamera
* Show iconic taxon found in model results if we can't load a remote taxon
* Show iconic taxon as backdrop for ObsImage whenever possible
2024-03-05 16:54:42 -08:00
Ken-ichi Ueda
096af978f0 Test fixes
* updated snapshots
* move timezone setup to globalSetup
* renamed old global setup file to reflect what it actually does, which is
  setup i18next
2024-02-21 10:47:31 -08: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
Ken-ichi Ueda
54f3f9eb47 Extracted unique Realm test setup code into a helper
There's still some required copy-pasting because jest is weird, but at least
there's less of it.
2024-02-14 15:40:35 -08:00
Amanda Bullington
8e6269c8d0 Wrap realm.write in safeRealmWrite transaction (#1123)
* Add a safeRealmWrite transaction for better logging around writes; code cleanup and realm update

* Add safeRealmWrite to tests and make sure action is called synchronously

* Fix final test

* Only write to realm when useObservationsUpdates data changes; code cleanup

* Code cleanup
2024-02-09 16:16:32 -08:00
Amanda Bullington
3a485f4d4b Load ObsDetails skeleton before observation data is ready (#1116)
* Load ObsDetail screen skeleton and loading wheels before observation is fetched; closes #1091

* Fix e2e test: make sure ActivityIndicator doesn't stay rendered
2024-02-06 17:09:51 -08:00
Ken-ichi
4e42ebc262 Community taxon opt out notice (#1060)
* Shows notice when user or obs is opted out of Community Taxon on ObsDetails
  (closes #882)
* Unifies mapApiToRealm methods around a single interface
* Ensure that the remote obs used on ObsDetail is normalized to look like a
  local obs
* Ensure some tests that use signIn() have isolated Realm instances
* Update current user's obs from ObsDetails (closes #1045) 
* Fixed CC0 license display on ObsDetails (was not actually related to
  updating the local copy of the obs
2024-01-18 20:16:30 -08:00
Ken-ichi
799e0f4c4f Restore tests removed in recent suggeston fixes (#1001)
* Restored Suggestions navigation tests
* Restored SuggestionsWithSyncedObs.test.js tests
* Mocked vision-camera-plugin-inatvision instead of useOfflineSuggestions
* Removed unnecessarily complex object from navigation params

There were a lot of issues here, but the main ones (I think) were related to
rendering all the navigators and waiting for asynchronous stuff to happen
before proceeding with the test.
2024-01-05 19:48:46 -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
d3f1f8ed6e View photos in MediaViewer from ObsDetail (#962)
* Unit tests for MediaViewer
* Added editable prop to MediaViewer
* MediaViewer navigation test
* Made MediaViewer a modal
2023-12-13 09:33:06 -08:00
Amanda Bullington
808cbee452 Replace ObsEditProvider with zustand for global state management (#948)
* Add zustand to app

* Begin replacing ObsEditProvider with zustand for global state

* Use store and add tests

* Fix bugs

* Add test to check for deleted photos in StandardCamera

* Make sure evidence is only added to current observation; submit comment with ID on ObsDetail

* Fix ObsEditWithoutProvider tests

* Move store to where it's needed

* Fix tests

* Await evidence being added to obsPhotos from camera

* Add a note about slices to useStore
2023-12-05 14:10:00 -08:00
budowski
58de692298 364 sharing photos to inat (#568)
Allows user to share photos from gallery apps to our app as new observations via react-native-share-menu. Also added patch-package and patched react-native-share-menu for Android prod builds. Patch addresses https://github.com/meedan/react-native-share-menu/issues/216

Closes #364

---------

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2023-05-17 13:24:38 -07:00
Chris
98a6663fe1 561 fix hidden bottom sheet (#563)
* Show bottom sheet over tab bar

* use present method

* Ensure bottom sheet works elsewhere

* Ensure bottom sheet works elsewhere

* Add provider to test

* lint

* Fix tests

* Merge fixes

---------

Co-authored-by: Amanda Bullington <35536439+albullington@users.noreply.github.com>
Co-authored-by: Amanda Bullington <albullington@gmail.com>
2023-04-04 12:30:07 -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
f8c403b9b1 353 retry with jwt (#382)
* Rename some functions and variables

* Rename function

* Revert to original timeout for tokens

* Get JWT for a 401 or 403 http errors in the react-query QueryClient retry handler

* Log API error to new logger

* Fetch token on every render in useApiToken hook

* Remove commented code

* Add comment

* Remove useEffect from useApiToken

* Revert "Remove useEffect from useApiToken"

This reverts commit 9cf1e0c0bc.
2023-01-29 10:09:50 +01:00
Amanda Bullington
28099b5922 Add test for checking locale changes from remote (#294)
Add test for checking locale changes from remote; closes #287

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2023-01-09 09:30:07 -08:00
Ken-ichi Ueda
f442603e7a Disable unnecessary API requests on My Obs when signed out
Also added a signOut test helper... and maybe have introduced some problems
with parallel test execution as a result, as parallel jest runs don't seem to
totally separate with regards to the in-memory realm db. Something to think
about.
2022-12-09 19:39:13 -08:00
Amanda Bullington
8d738d9d8c Delete observations from ObsEdit (#277)
* Remove delete option for observations not in realm
* Add mutation for delete observation
* Hide delete option for observations not persisted to realm
* Close kebab menu when item pressed; this allows dialog to respond to first user
   press

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-12-09 17:36:47 -08:00
Amanda Bullington
0d69fe1568 Fetch user locale from server and change language (#255)
* Fetch user from server, set locale in realm and change language with i18next
* Added some Spanish translations so I can see localization working
* config QueryClient with `cacheTime: Infinity` to deal with "Jest did not
  exit" errors

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-12-09 15:51:17 -08:00