Commit Graph

65 Commits

Author SHA1 Message Date
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
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
budowski
716efc1a78 Change language from Settings while offline (#1423)
* Closes #83 - fetch and cache available locales for app; allow user to change app language
* Use different language chooser picker
2024-06-04 14:57:21 -07:00
Ken-ichi Ueda
b7a6693125 Minor logging cleanup
* Log the actual message we intended for JSON parsing errors
* Always use the configured tile URL instead of hard-coding it
* Use tiles.inaturalist.org whenever possible
2024-05-28 12:15:57 -07:00
Ken-ichi
7ea60f7b9b Add X-Installation-ID logging (#1608)
* Add X-Installation-ID logging
* Allow logged out logging
* Log whether user has enabled advanced add obs btn
2024-05-24 21:06:20 -07:00
Ken-ichi Ueda
63e9f47512 Stop logging INatApiErrors that might be handled; log JSON parse issues separately 2024-05-20 10:46:48 -07:00
Ken-ichi
08c04ad1ab Improved error reporting for logstash (#1529)
When an Error object is passed to logger.error() as the last arg, this change

* extracts error_type and backtrace
* reports a shorter message that should be searchable

Also:
* Avoid double logging errors; ErrorBoundary should log errors in a way we can parse
* Added restart button to default ErrorBoundary; globalized text
2024-05-13 18:28:56 -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
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
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
Angie
822909b002 1279 user profile UI changes for mvp (#1295)
* Follow Button changes

* Change non pressable count icons to gray, removed onPress, hide post mvp sections of userprofile

* createRelationships api call, follow/unfollow functionality

* Unfollow and follow button functionality, refactoring
2024-03-21 09:56:27 -07:00
Johannes Klein
48fcea1526 359 post logs to internal logging (#1256)
* Made react-native-logs post to API log endpoint

* Try to build a slightly more informative user agent

* Made react-native-logs post to API log endpoint

* Try to build a slightly more informative user agent

* Remove unused const

* Replace other usages of exported user agent

* Revert "Remove unused const"

This reverts commit 02389c8390.

* Revert removal of axios instance

* Strange order

* Remove device name from user agent

* Copy logstash transporter to new file and change to post

* Update import

* Remove comma

* Get the user jwt token as authorization for the log request

* Use anonymous token as app token

* Mock away logs config file because it now has a dependency on authentication

* Code style

* Typo

* Add timestamp field to form data, to show client_timestamp on the logs

* Add TODO

* Add a developer button to force a js-side error

* Add comments

---------

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2024-03-07 00:04:29 +01: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
budowski
02d8f16883 account settings webview
Replaces account settings with a small set of settings and a web view to show settings on the website.

Also

* Minor taxon detail fixes
* Display taxon name on observations according to the current user's
  preferences, not the observers

Closes #927

---------

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2024-02-28 19:34:57 -08:00
Johannes Klein
7bd5f32fd7 Changes to Sync button (#1166)
* Add string

* Add a state that signifies syncing in progress

* Rename state as it no longer only pertains to uploading

* Set flag on button press

* Fix bug with wrong number of obs to upload shown

* Update MyObservations.test.js

* Add 1 to param for human readability

* Update MyObservations.perf-test.js

* Update ToolbarContainer.test.js

* Reintroduce number of finished uploads

* Update comment

* Use animation for gallery loading screen
2024-02-23 16:39:47 +01:00
Ken-ichi
f45108036f Sound recording (#1164)
* Added basic navigation test for StandardCamera & SoundRecorder
* Abstracted camera nav buttons and used in SoundRecorder
* Show sounds in the MediaViewer
* Added sounds to ObsEdit, w/ MediaViewer support
* Ensure sounds get both uploaded and added to observations
* Local sound deletion
* Remote sound deletion
* Rudimentary and deeply unperformative sound visualization

Closes #869
2024-02-22 22:02:25 -08:00
Ken-ichi Ueda
c90acad6f0 Log stringified JSON errors 2024-02-12 12:52:56 -08:00
Angie
9de83f7fdf Unread notifications indicator in tab bar (#1101)
* Shows indicator in tab bar when you have new updates
* Should update every minute
* Make unread updates indicator go away when you view the updates

Closes #900

---------

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2024-02-08 13:22:05 -08:00
Johannes Klein
93061bf8de Set user-agent in global config (#1096)
* Update inatjs

* Globally set user-agent for inaturalist js usage

* Remove user-agent from announcements
2024-01-30 15:41:32 +01:00
Amanda Bullington
bb6a180527 Observation deletion on MyObservations (#1082)
* Delete local & remote observations on MyObs; show progress

* Update tests & add test for delete hook

* Fix test failures

* Add tests for deletion strings in Toolbar; add test for multiple deletion

* Clear deletion text on toolbar when user navigates away from MyObs

* Add a check in e2e test to make sure observation was deleted
2024-01-24 17:32:11 -08:00
Johannes Klein
47b3525228 Announcements (#1081)
* Update iNatjs

* Add webshell dependency

* Basic announcement fetching component

* Styling

* Dismiss function

* Error handling TODO

* Add param

* React to link presses

* Missing code

* Add unit test

* Add string

* Refactor search query and dismiss to use react-query

* Activity indicator when refetching

* Add query provider to test

* Mock component in other integration tests

* Move user agent to api

* Throw error instead of logging
2024-01-24 22:22:50 +01: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
b815f451ea Offline fixes (#1025)
* Changed the default React Query retry handler to be synchronous; being async
  meant it returned a promise, which React Query interpreted as true-ish,
  which meant it retried forever
* React Query retry handler should log info about its query key, which should
  make those problems a bit easier to debug given a log
* Prevent useObservationUpdates from throwing errors when network requests
  fail, which they always do while offline
* Added our own ErrorBoundary that shows a component trace
* Prevent several uses of useAuthenticatedRequest when not online
* Work around bug in vision-camera-plugin-inatvision where it can't get
  dimensions of photos in Android
* Actually throw errors when vision-camera-plugin-inatvision's predictImage
  throws unexpected errors
* Allow online suggestions while signed out using anonymous JWT
2024-01-11 17:18:04 -08:00
Amanda Bullington
f0aac96468 Agree button: match web functionality (#1009)
* Only show agree button on first taxon displayed; show on all ranks

* Show agree button only on first taxon displayed; show agree for ranks above species; closes #566

* Fix test
2024-01-09 12:39:58 -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
Amanda Bullington
1ba0494372 Establishment means, TaxonDetails (#986)
* Add establishment means with styling for link in fluent text

* Fix tests
2023-12-19 15:28:30 -08:00
Amanda Bullington
cd18e970d7 Taxonomy component, TaxonDetails (#978)
* Style taxonomy ancestors and current taxon

* Link to TaxonDetails pages

* Add children to TaxonDetails taxonomy

* Add children taxa toggle

* Display children after button tap

* Wrap text'

* Fix italic font size in DisplayTaxonName

* Add tests to Taxonomy component

* Change Taxonomy test
2023-12-19 11:04:30 -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
8119a3e5ca Taxon detail media viewer (#966)
* Access MediaViewer from TaxonDetails
* Added our own presets for ActivityIndicator
* TaxonDetail should show a local taxon if one is available
* Made it a little easier to import the custom logger
* Refactored MediaViewer to accept photo-like objects instead of URIs
* Added license / attribution button to MediaViewer
* Moved delete button into MainPhotoDisplay so each photo has its own button
  and it can be laid out relative to its photo
* Add custom header to MediaViewer when accessed from TaxonDetial
* Allow DisplayTaxonName to accept custom text components as props
* Added darker bg to photo on TaxonDetail to make title more legible
2023-12-14 17:18:41 -08:00
Amanda Bullington
f32a8812f5 Offline suggestions (#961)
* Use offline model for displaying sugggestions

* Simplify Suggestions/TaxonSearch screens using hooks

* Use updateObsKeys function from useStore

* Simplify code and fix unit tests

* Fix tests for offline predictions

* Fix faker urls

* Fetch remote taxa to display taxon photos in Suggestions

* Fix useTaxon code and test

* Use online vision results as backup for offline results

* Fix tests and add test for online predictions

* Use Flatlist for Suggestions and fix tests

* Move API call out of Attribution and fix test

* Fix tests

* Fix test warnings
2023-12-13 10:11:21 -08:00
Amanda Bullington
bded964b0a Add vision property to AR camera & suggestions for observation/id creation (#952)
* Add vision param to identification create; test vision false on TaxonSearch and true elsewhere

* Test that vision attribute is only used from Suggestions screen

* Add owners_identification_from_vision attribute to observations

* Fixes for vision attribute

* Make sure taxon is applied from Suggestions/TaxonSearch via ObsEdit

* Fix for ids vision

* Fix Suggestions tests
2023-12-07 11:07:47 -08:00
Ken-ichi Ueda
de3e73cb88 Ensure upload errors get shown to the user
This changes the default behavior for API errors such that they get thrown by
default, forcing code closer to the user to handle them. While we were set up
to catch errors in the upload process, we were supressing them so they
weren't bubbling up to that level. No more!

This also adds some additional handling for the occasionally zany shape of our
API error responses.
2023-11-29 22:46:32 -08:00
Amanda Bullington
a401854475 Sync deleted observations from server (#924)
* Realm updates for cascading deletions

* Delete local observations from remote list

* Add tests for deleting local obs which were deelted on server

* Fix: don't create embedded objects explicitly
2023-11-27 15:07:23 -08:00
Angie Ta
2983e05a08 ActivityHeaderKebabMenu component, removed flag functionality, WithdrawIDSheet component and tests 2023-11-13 22:49:16 -08:00
Amanda Bullington
7d20f6aa81 Suggestions (using server data) (#821)
* UI overhaul for Suggestions

* Updates to suggestions

* Update permissions library and Podfile

* Get tests passing

* Add tests for suggestions

* Update snapshot

* Add comment prompt & box to TaxonSearch

* Add empty state

* Nav and loading fixes

* Add more tests to Suggestions flow

* Fix tests

* Fix tests
2023-10-13 14:46:05 -07:00
Ken-ichi
b51d2983f9 Don't retry queries if the servers return 503 codes (#794) 2023-09-27 15:00:01 -07:00
Amanda Bullington
92fc62b5f8 Projects / ProjectDetails UI (#788)
* Start on project / details UI overhaul

* UI tweak

* Show HTML in ProjDetails; close search bar

* Add OverviewStats and relevant fetches to ProjectDetail

* Allow user to leave/join traditional projects

* Fix tests with mock react-native-paper
2023-09-20 13:09:31 -07:00
Angie Ta
24ba799b25 Merge branch 'main' into 739-obsdetails-activityitem-kebab-menu 2023-09-18 18:23:46 -07:00
Angie Ta
6cee6c4b35 Withdraw or restore ids, updateIdentification 2023-09-12 19:04:24 -07:00
Amanda Bullington
5647e3a902 Show icon in DisplayTaxon if no photo (#775)
* Show icon in DisplayTaxon if no photo; closes #769

* Update icons with correct mollusca name

* Fix tests

* Fix tests and add test for iconic taxon icon; fix API call for default photo
2023-09-11 09:57:27 -07:00
Angie Ta
8d5744be9a Delete and edit comments 2023-09-07 14:53:13 -07:00
Amanda Bullington
85f11fdf69 Add IconicTaxonChooser to ObsEdit (#733) 2023-08-10 18:01:24 -07:00
Amanda Bullington
20d8308e5f Explore UI (#731)
* Start building explore screen

* Header for Explore screen

* Fix button build

* Move ObsFlashList to shared components for use in Explore

* Fix background transparency on SegmentedButtons

* Use reusable components for map and ObservationLocation

* Use search observations API to show results in explore views

* Add infinite scroll hook to species, observers, and identifiers views

* Update snapshots and create ExploreFlashList for consistent header animation

* Float segmented buttons above observation lists in explore

* Use queryparams for API calls; add loading state to each view
2023-08-08 12:29:17 -07:00
Amanda Bullington
9c6106f5d0 Refactor tests to use minimum viable test factories (#681)
* Make minimum viable RemoteComment

* Minimum vialbe RemoteIdentification

* Minimum viable remote project, place, and messages

* Create minimum viable records for all remote factories

* Remove factories for local device data

* Minimum viable local taxon, comment, id

* Minimum viable for local observation photo (photo has no primary key)

* Minimum viable LocalUser

* Minimum viable record for LocalObservation
2023-06-27 17:06:01 -07:00
Angie Ta
ad1b09715f Refactor vote buttons, delete vote, vote button loading states 2023-05-30 18:16:52 -07:00
Angie Ta
0126210489 DQA Styling, inital voting/checks functionality 2023-05-18 10:54:30 -07:00
Amanda Bullington
0080f910e5 Update UserProfile to make UI closer to Figma (#601) 2023-04-27 15:13:49 -07:00
Angie
e14d620992 301 flag id functionality obsdetail (#333)
* Flag Id Modal created.

* Flag item modal radio buttons, styling, cancel button

* Flag Item Modal, Api Flags file created

* Added id field in Identifications realm schema, Flag Item Modal API call

* Clear form, toggle function, click title not just checkbox to toggle

* Fixed android checkbox toggle.

* Clean up. Flag ID ObsDetail. Closes #301.

* Flag realm model, flagged status shown on initial load

* Refresh observation after item flagged. In Progress.

* Remove console logs, add onError

* save button loading spinner

* Realm 31 migration for obsservation updated_at

* Flags test file

* FlagItemModal tests

* FlagItemModal tests

---------

Co-authored-by: Amanda Bullington <albullington@gmail.com>
2023-02-03 13:09:56 -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