Commit Graph

149 Commits

Author SHA1 Message Date
Amanda Bullington
39fa3a9edb Handle capitalization for multiple lexicons (#2416)
* Make sure API calls have options to fetch correct lexicons; separate capitalization logic for each lexicon

* Fix Explore nav test
2024-11-12 18:18:14 -08:00
Ken-ichi
a02c7eb411 Clean out unused logging (#2417)
Closes #2155
2024-11-11 16:09:17 -08:00
Amanda Bullington
9e5f538494 Fix lagginess when tapping on Notifications in bottom tabs (#2391)
* Create performance tracking hook to see how long Notifications takes to load

* Move cache clearing to app start, out of MyObservations

* Remove isFocused hook from useLocalObservations

* Code cleanup

* Logging string cleanup

* Fix: bottom tabs are tappable when user scrolls past the top on iOS
2024-11-07 15:01:19 -08:00
Ken-ichi
64d07fad35 fix: only show onboarding once per install (#2390)
* refactor: give the install MMKV instance a more accurate name
* refactor: rename install data wrapper, verbify function names
2024-11-07 14:25:25 -08: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
Johannes Klein
5c8e3be12c test AI camera in e2e (#2188)
* Add a cameraZoomRange default
* Small detox version bump
* Add a mocked camera with a take photo button
* An e2e mock for the computer vision plugin predicting a frame
* Mock taking a photo by loading the first photo from the CameraRoll

Closes #1981
2024-11-01 10:38:37 -07:00
Amanda Bullington
ce8cf1b19f Internationalize and format dates displayed in project requirements (#2303)
* Display project months with correct formatting

* Format each type of project date displayed in project requirements

* Rename project start date key to fit fluent formatting
2024-10-25 21:16:10 -07: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
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
Ken-ichi Ueda
d3968ce2fd fix: layout, relative date, i18n changes
* ActivityHeader was not listing category
* ActivityHeader lacked space before date
* Combined duplicate strings, used more descriptive keys and comments
* Relative dates were showing fractional weeks
2024-10-02 14:08:32 -07:00
israr002
ded40ac0cb Stop Explore from defaulting to worldwide in Android (#2045)
* change geolocation config options to work around Android-specific bug
* apply maximumAge only on iOS to prevent errors on Android
* rename location hook to fetchCoarseUserLocation
* add comment to highlight current position issue for future reference

---------

Co-authored-by: israr-stc-dev <Israr.Khan@intigral.net>
2024-09-27 17:39:06 -07:00
Ken-ichi
a3a43c4e2c g11n audit (#2189)
* chore: validate and normalize translations in addition to src strings
* fix: globalize lat/lng/acc in LocationPicker
* refactor: extract language picker into component
* refactor: globalized text
* feat: added a script to i18ncli called "checkify" that generates
  localization files prepended with a checkmark to help see strings that are
  not globalized
* fix: localize date formatting (closes #1622)

Closes #2102
2024-09-26 22:33:23 -07:00
Johannes Klein
6f8f2ea926 1953 suggestion logged out (#2163)
* TaxonResult TS

* Suggestion TS

* Do not show checkmark for logged out online suggestions

* Update strings.ftl

* From suggestions show bottom sheet on taxon detail

* Refactor updateTaxon

* Add text

* Another text

* Two more texts

* Fix import

* Function stubs

* Use a bulleted text list

* Restyle entire bottom sheet

* Code reorder

* Refactor saveObservation function

* Navigate to login screen for Upload now button

* Add key

* Save obs on press and nav to list

* Code style

* Get updated currentObservation immediately to pass to saveObservation

* Test AICamera with current user

* Show the bottom sheet only for logged out users

* Mock useCurrentUser hook

* Mock useCurrentUser hook

* Mock user

* Mock user
2024-09-25 12:56:32 +02:00
Angie
2155b43966 Only display month and year for obscured and private geoprivacy (#2069) 2024-09-13 00:42:40 -07:00
Amanda Bullington
23baf5e207 Update exif-reader library (#2052)
* Update exif-reader library and don't convert to local timezone in this repo

* Use github tag for exif-reader
2024-09-09 15:12:55 -07:00
Amanda Bullington
ec83bc8c7b Set online/offline status via event listener in React Query (#2047)
* Make sure reactQueryRetry is used for all queries, including infinite queries

* Code cleanup
2024-09-05 16:38:40 -07:00
Ken-ichi
d3a3c60715 fix: ident bodies should not get set by obs descriptions (#2018)
* separates ident body editing into its own state and UI
* stop adding an entire Realm object to nav params, where it gets out of date and causes access bugs
* fixes bug where accessing ObsDetails from MyObs can cause you to return there when returning from TaxonDetails via Explore
* separates BottomSheet handleClose callback so it can respond differently to the sheet closing and the user intentionally closing the sheet
* Suggest ID and Agree bottom sheets both have buttons of equal width with a single primary action
* Disagree sheet prompt refers to the taxon being disagreed with, not the ident taxon
* save taxon to local db when viewed on TaxonDetails
* minor refactors for readability

Closes #2003
2024-08-29 11:50:47 -07:00
Ken-ichi Ueda
0ff55c14a2 fix: first obs button opens AI Camera, not advanced options
Also refactored email inbox opening to show errors and not rely on a 3rd
party.
2024-08-26 15:16:52 -07:00
Ken-ichi
de37440cf6 Aborting upload should not prevent future uploads (#1989)
Closers #1938
2024-08-20 16:21:50 -07:00
Amanda Bullington
5945ccc525 Fixes and error handling for API throttling (#1971)
* Add new error type for 429; remove unnecessary logs

* Batch API calls for SpeciesSeenCheckmark

* Remove SpeciesSeenCheckmark test

* Revert logging errors

* Use Set for observedTaxonIds

* Add comments around logger.info statements

* Merge linting update

* More fixes from code review

* Switch to non-authenticated useQuery for fetching taxon ids seen by X user id

* Fix tests
2024-08-14 22:08:03 -07:00
budowski
d67d0701a4 Show unsynced obs before all other obs (#1796)
* #1577 - show unsynced obs before all other obs - use a new built-in needs_sync property

* At the end of a sync, unmark the observation as needs_sync
2024-08-14 10:40:20 -07:00
Ken-ichi
e08cd83d6a Control web access (#1970)
* Convert web view components to typescript
* Basic tests for URL handling in FullPageWebView
* Allowlist of domains in FullPageWebView
* Open links in browser in most situations
* Allow FullPageWebView to handle mailto links
* Throw errors if FullPageWebView is about to leak a JWT
* Restore FullPageWebView functionality to signup screens

Closes #1803
Closes #1934
2024-08-13 14:45:37 -07:00
Amanda Bullington
81a5600296 Fetch location if camera photo does't have acc enough location; closes #1924 (#1946) 2024-08-09 17:30:12 -07:00
Amanda Bullington
eca656b984 Formatting in DatePicker, ObsEdit (#1945)
* Remove seconds from datetime picker dates; make formatting closer to Figma; closes #1920

* Add DatePicker tests

* Add test for no date given
2024-08-09 16:10:37 -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
Johannes Klein
c81201cffa 1843 offline taxon search (#1864)
* realm TS

* provider/contexts TS

* todo

* useIconicTaxa TS

* Refactor taxa list into component

* Use TaxaList for taxon search screen

* Refactor render decision

* Use flex 1 container instead of footer

* Show offline notice for query without results

Refetch taxa when going back online

* Update required because of useIsConnected

* Await typing in test

* Mock useIconicTaxa

* Add tests to taxon search

* emitUploadProgress TS

* createUTFPosition TS

* convertScores TS

* Add field type

* Fix imports
2024-08-03 15:13:13 +02:00
Ken-ichi Ueda
e1f381ab24 Bugfix: top suggestion threshold was at 0.78 when it should be at 78
Also

* split out human isolation into a more accurately-named helper
* ensure human isolation does not depend on production values
* add suggestion scores to debug display
2024-08-02 12:38:42 -07:00
Ken-ichi
960f3e3b67 Some typescript conversions in an attempt to improve CodeQL coverage (#1904) 2024-08-01 17:55:33 -07:00
Amanda Bullington
9b0029cb87 Stop location fetch when navigating to location picker (#1903)
* Stop location fetch when nav to location picker; let useWatchPosition handle acc

* Update pods

* Close delete obs sheet after single deletion

* Fix for e2e test: restore isFocused check

* Revert code
2024-07-31 18:45:43 -07:00
Amanda Bullington
65ea27c751 Clear user data on sign out (#1873)
* Clear documents directory & mmkv on signout

* Add code comment

* Rename userData.ts
2024-07-29 13:30:50 -07:00
Amanda Bullington
182196a205 Change url for connectivity check (#1868)
* Change connectivity url to ping inat; remove unnecessary useIsConnected hook; closes #1770

* Ensure inaturalist.org/ping is being pinged

* Fix e2e tests by using isConnected, not isInternetReachable
2024-07-26 20:16:32 -07:00
Ken-ichi
10bbea44c4 e2e mock for Geolocation.watchPosition to deflake tests (#1842) 2024-07-24 17:15:03 -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
Johannes Klein
a52996f535 Changes to the way permissions are asked for (#1793)
* Replace name in permission requests

* TakePhoto TS

* PermissionGate TS

* Type

* PermissionGateContainer TS

* Interface

* Types

* LocationGate TS

* Remove LocationPermissionGate from Camera

* Remove write only permission

* Type

* ObsPhotoSelectionList TS

* Code style

* Show the improve with location button

* Create useLocationPermission.tsx

* Use new hook on suggestions

* Doc comment

* Use new hook in camera view

* Add strings

* Refactor Explore main content

* Use permission hook on RootExplore

* Add no location permission component

* Rename function

* Prop request permissions and use with button

* Default to Nearby label

* Remove Node type

* Projects TS

* Use useLocationPermission hook in projects screen

* Add string

* Prop permission down

* Refactor list render

* Refactor tab id into enum

* Tab type

* On nearby tab if without permission show button to prompt

* Leftovers

* Remove location permission gate from ObsEdit

* Use location permission hook on evidence section

* SearchBar TS

* Do not autoFocus on search bar in location picker.

Closes #1743

* Update type

* LocationSearch TS

* Show location permission gate on location picker's mount

* Add location permission to CurrentLocationButton

* Remove unused props of Map

* Remove unused exports from useMapLocation

* Migration

* Revert "Show location permission gate on location picker's mount"

This reverts commit 30ff75698c53d54d0b14cd2bd629f7155b743bf8.

* Add callbacks to useLocationPermission hook

* Show location permission ask on Obs Edit

* Remove unused string

* Reset explore filters should set location always to worldwide

* Add helper function to show place text in Explore

* Remove unused state of filter modal

* Show place text in filters modal with helper

* Show location permission button only for Nearby explore state

* Add a placeMode state

* Do not send placeMode to API

* Also treat limited permission as yes

* useLocationPermission in ExploreLocationSearch

* Refactor to setting place mode

Instead of logic based on the translated text of the place_guess string that is stored in ExploreContext, we are switching to an enum state that signifies which mode to show on explore:
1.) Nearby: Filters explore results based on the user's location. This also has a state without location permission that does not query the API.
2.) Place: Filtering by a specific place (as retrieved by /places API).
3.) Worldwide: Retrieve worldwide results, i.e. not having a place filter set.
4.) Map area: Filtering explore results precisely to the map rectangle shown on the explore map.

* Remove import from test

* Remove export

* Use blocked title only for blocked permission asks

* Move gallery permission container to Tab navigator as are the others

* Add gallery save title

* Split location permission explanation into two

* Update strings.ftl

* Only nav to location picker if permission was not  granted

* Check permission on app being foregrounded

* The location permission part is handled by useLocationPermission

* Do not store permission result in hook

* Use hasPermission from permissions hook

* Update fetchUserLocation.e2e-mock

* Move hook one higher

* Show user location if permission is given

* PermissionGate callbacks should use useCallback

* Add permission hook to map usage

* Fix test

* Update layout to be asserted

* Add location permission hook to Explore

* Remove console.log

* Few TS fixes

* Indentation

* Remove superficial check

* Update Podfile.lock
2024-07-12 11:00:24 +02: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
Ken-ichi
464899f111 Restore removal of synced photos (#1768)
Closes #1741
2024-07-04 13:25:04 -07:00
Johannes Klein
230646e2ae 1684 explore map null (#1760) 2024-07-03 16:33:08 +02:00
Johannes Klein
09f4abdf9b Revert "Vision camera update with orientation support (#1713)"
This reverts commit de36644fe8.
2024-06-29 16:01:46 +02:00
Johannes Klein
103db8b99a Revert "Fix rotation value (#1714)"
This reverts commit ecde900a9e.
2024-06-29 16:01:26 +02:00
Ken-ichi
effbb01fd9 Try to ensure we send a valid URI to getPredictionsForImage() (#1724)
Closes #1715
2024-06-28 20:13:55 -07:00
Johannes Klein
ecde900a9e Fix rotation value (#1714) 2024-06-27 10:15:15 +02:00
Johannes Klein
de36644fe8 Vision camera update with orientation support (#1713)
* Update vision camera

* Remove no longer needed VeryBadIpadRotator

* Remove orientation prop

* Update vision plugin

* Remove frame processor patch

* Remove unused import

* Update rotation patch

* Remove unused param
2024-06-26 12:01:10 +02:00
Ken-ichi Ueda
917894068d Try to handle an edge case with API errors 2024-06-25 14:19:27 -07:00
Amanda Bullington
d9d7a6ff06 Suggestions screen UI fixes, location toggle, and offline reloading state (#1708)
* UI changes to suggestions screen

* Update offline suggestions UI and allow refetch

* Allow user to search online suggestions with and without evidence location

* Add improve location button and refactor header

* Use loading screen correctly between location/ignore location

* Hide location permission button and code cleanup

* Fix test for suggestions changes
2024-06-24 16:26:40 -07:00
Ken-ichi
835b3ecb1f Location fixes (#1691)
* Try to avoid stale coordinates when fetching from cameras by removing the location in state when the screen blurs... I think. This might not be working. The other approach I tried was to wrap the Camera in Mortal, but that led to test problems. Might be worth revisiting if this approach doesn't work
* Bugfix: shared photos w/o coords were fetching current location
* Restored relative path to get fetchUserLocation.e2e-mock working again
2024-06-18 11:40:30 -07:00
Ken-ichi Ueda
bc44cf61e9 Try to log around bug uploading photos 2024-06-17 16:29:52 -07:00
Johannes Klein
7c91bdf950 Obsedit add photo with StandardCamera, two fixes (#1677)
* Reorder hooks dependencies

* Return uri from take photo hook

* Keep state of photos added in this instance of the camera

* List2 TS

* INatIconButton TS

* Refactor useBackPress to show discard modal only if photos taken during this instance of the camera

* Remove newPhotoCount var

* TS refactors

* fetchUserLocation TS

* Increase timeout

* Fix error

* Hoist deletePhotoByUri

* Delete photos on discard

* Reorder code

* Set saving photo on checkmark press

Closes #1556

* Update snapshots

* Remove delete test

* Create StandardCamera.test.js

* Check if image is there before deletion

* Update react-native-share-menu+6.0.0.patch

* Update e2e_ios.yml

* Update some types
2024-06-14 14:04:24 +02:00
Ken-ichi
f3bcec2d2e Continuous location fetch in the cameras (#1673)
* Fetch location continuously in cameras until accuracy falls below threshold
* Unit test for useUserLocation
* Added untilAcc option to useUserLocation
* Bugfix: ObsEdit was not always fetching location for new camera photos

Closes #1340
2024-06-12 11:18:12 -07:00