Commit Graph

18 Commits

Author SHA1 Message Date
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
Ken-ichi
c76be140b5 Fixes bug preventing photo uploads (#324)
Primary bug was that requests to POST /v2/observation_photos were using the
obs serial ID instead of the obs UUID.

Another major problem was that uploads always quit before the last observation
when there were multiple observations to upload, which I address by changing
the way we set `allObsToUpload` in `useLocalObservations`.
2022-12-31 09:46:50 -08:00
Amanda Bullington
ec0a686df6 Eslint: disallow console logs (#312)
* Remove console.logs; remote useLoggedIn hook and instead use useCurrentUser; closes #310

* Comment out locale test
2022-12-29 10:56:50 -08:00
Amanda Bullington
0c4b9a5158 Fixes for API calls, useCurrentUser hook, api token not being fetched (#309)
* Random code cleanup

* Simplify useCurrentUser hook; only fetch messages if current user; closes #272

* Fix padding around login prompt button

* Code cleanup

* Fix projects; display search and tabs separately

* Remove log
2022-12-21 13:35:41 -08:00
Amanda Bullington
66e888e787 Fix copyright in data tab of ObsDetail; improve data fetching (#303)
* Fix copyright in ObsDetail; improve data fetching from remote vs. local; closes #300

* Fix tests for obs detail

* Code cleanup; fix observation count
2022-12-19 11:22:00 -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
8a92fca2e8 Update obs list to use React Query, fetch observations via id_below (#273)
* Rewrite remote observation & update fetching using useQuery in ObsList
* Fix ObsList test by adding query provider
* Add padding to infinite scroll view indicator
* Only set next uuid for obslist if not still loading results from last api call
* Improve how ObsList works when observations don't fill screen
* Remove explore, explore provider, dropdown menu, and related screens; fix tests
* Move setIdBelow function into onEndReached
2022-12-09 12:17:26 -08:00
Amanda Bullington
b88030eab2 Allow existing id to be edited in ObsEdit (#242)
* Allow editing of existing id; remove unused id buttons; closes #230 and closes #231
* Remove unused text component & update IdentificationSection to tailwind css
* Remove unused obsEdit styles; convert styles to tailwind
* Remove unused bottom modal component and obsedit stylesheet
* Add comments to useEffect for opening local observation; convert realm object to JSON
* ObsEdit loads obs from db only when required
* Use observation update API call for observations already on the server
* Change wasSynced to instance method; only upload unsynced evidence
* Move keyboard aware scroll mock to jest.setup
* Await uploading evidence instead of returning a different response

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-12-03 15:32:44 -08:00
Amanda Bullington
c6361b022c Skeleton UI and server results for adding a comment in ObsDetail (#247)
* Show skeleton UI for comment and update with real comment from server
* Update styling in ActivityItem to use tailwind; fix code combining id and comment arrays
* Use tailwind styling in ObsDetails
* Styling updates; remove unneeded code from ObsDetails test
* Show loading wheel when comment submitted; clear comment box when backdrop tapped
* Remove console log
2022-11-23 16:08:22 -08:00
Amanda Bullington
7a72cfc3db Fix infinite loop in ObsDetail for local observations (#236)
* Fix infinite loop when setting ids; return error from api so useQuery doesn't produce an undefined error
* Add throw option to fetchRemoteObservation so error is thrown when uuid doesn't exist
2022-11-08 17:08:26 -08:00
Amanda Bullington
4d213bd4c6 Create / update / delete requests with useMutation (#206)
* Use authenticated query for search results
* Use search API for fetching places from Settings
* Use authenticated query for authorized applications
* Use authenticated query to fetch user.me
* Move fetch/search api calls into react query format, out of hooks
* Update with react query instead of hooks
* Fetch list of blocked and muted users with authenticated query
* Added Podfile postinstall block to get app running in a Simulator
* Use auth query in identify
* Upgrade @realm/react library to 0.4.0; fixes initialization error on android due to importing realm
* Use authquery for explore provider
* Use mutations for blocking/muting users, invalidating queries, and refetching settings data
* Add react mutation to create/update/delete api calls
* Use mutation for creating identification on identity/obs detail screens
* Use mutations to update and delete relationships
* Use mutation to revoke authorized apps
* Use mutation for updating user settings
* Fix ids on activity tab; fix safe area view; fix mark viewed
* Limit fields for remote observation api call

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-10-31 20:39:38 -07:00
Amanda Bullington
5456758f27 Move hooks into sharedHooks folder; reorganize Observations and models/ (#194)
* Rearrange hooks and observation component code
* Rename models/ to realmModels/ and use babel aliases

Closes #155

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-10-20 16:59:19 -07:00
Amanda Bullington
e81894d406 Use authenticated queries for fetch/search requests (#195)
* Use authenticated query for search results
* Use search API for fetching places from Settings
* Use authenticated query for authorized applications
* Use authenticated query to fetch user.me
* Move fetch/search api calls into react query format, out of hooks
* Update with react query instead of hooks
* Fetch list of blocked and muted users with authenticated query
* Added Podfile postinstall block to get app running in a Simulator
* Use auth query in identify
* Upgrade Realm to 11.0.0-rc.0, most recent version that will work with RN 0.68.2
* Upgrade @realm/react library to 0.4.0; fixes initialization error on android due to importing realm
* Use authquery for explore provider
* ObsDetail wasn't showing the edit button for obs created while signed out
* simplified ObsEditHeader so it takes a full observation instead of relying
  on the ObsEditContext
* ObsEdit now accepts an obs UUID as a param and loads that if the context
  doesn't have a current obs
* null checks for API methods, mostly to prevent requests that won't work b/c
  of missing params

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-10-19 13:01:04 -07:00
Amanda Bullington
c4d9cd4dc6 Use babel-plugin-module-resolver (#188)
* Add alias and update eslint/flow to resolve modules

* Update aliases for components and api

* Add other src directories to module resolver aliases
2022-10-07 10:20:55 -07:00
Amanda Bullington
d892d755a7 Use React Query to simplify API requests (#166)
* Start using React Query to make remote data requests
* Renaming, standardized error handling from API calls, moving code
* Fixed messages test; changed useQuery mocking approach
* React Query should only retry for network issues
* Tried using useAuthenticatedRequest on TaxonDetail
* Clear the React Query cache on sign out

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-09-01 18:43:52 -07:00