Commit Graph

19 Commits

Author SHA1 Message Date
Amanda Bullington
a25386169b Fix: scroll to activity item in default mode (#2698)
* Minimize the number of rerenders by splitting sheet logic into separate component

* Fix agree sheet

* Fix y offset for scrolling from notifications to activity item
2025-02-25 19:00:23 -08:00
Ken-ichi
fc07e53adc test: run same suite of tests for ObsDetails and its default mode equivalent (#2619)
Closes MOB-333
2025-01-17 12:01:41 -08:00
Amanda Bullington
0916da7787 Remove @ symbol from usernames (#2339)
* Remove @ symbol from user handle

* Remove @ symbol from e2e test

---------

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2024-11-06 10:03:09 -08:00
Amanda Bullington
b12057cbc3 Clear synced photoUploads paths (#1527)
* Clear synced photoUploads paths

* Add mock for useQuery
2024-05-10 16:30:49 -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
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
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
b18fd0408b Crash when uploading after deleting unsynced observation (#1010)
Syncing was broken when an unsynced obs was deleted

The main problem here was that MyObs state has a list of observations that
need upload, but since it was a plain array of Realm objects it crashed when
one of those objects was invalid, which happened after deletion. This fix
isn't great: it just makes it so the thing in state is a Realm.Results
object, which will update dynamically when its underlying data changes. We
could also JSONify what we have in state, but then you get into problems of
nested objects and deep JSONification.

Also
* Delete local obs if remote doesn't exist
* Bugfix: ObsDetail tried to mark non-existent remote obs as viewed
* Tried to handle react query retries better
2024-01-09 14:47:07 -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
Ken-ichi
0c7c807b56 Realm & other bugfixes (#950)
* Updated faker; fixed bug w/ DisplayTaxonName trying to modify a Realm object
* Fixed crash going from ObsDetail to ObsEdit
* Fixed bug fetching observation dates (not clear how this didn't instantly crash_
* Bugfix: MyObs observation fetch was failing on taxa w/ float rank_level
2023-12-04 13:47:00 -08:00
Amanda Bullington
1a27ef68cb Upgrade to Realm 12 (#925)
* Update to realm 12

* Remove unused mocks to fix some tests

* Fix test by unmocking ObsEditProvider

* Fix more tests by removing mocks/changing when tests write to realm

* Remove mocks on ObsEdit component test and fix accessibility labels

* Fix hooks tests with realm

* Set test path for realm; finish fixing tests

* Small tweak

* Upgrade realm/react library

* Migrate schema
2023-11-22 13:01:59 -08:00
Amanda Bullington
361ad1d1f5 Performance: simplify ObsEditProvider (#908)
* Simplify ObsEditProvider by moving functions into local state & calling reducer less frequently

* Fix delete all observations

* Fixes

* Move index selection to MediaViewer via params

* Access ObsEditContext on top level of ObsEdit and pass props

* Move context to top level screen components

* Fix tests

* Use waitFor to fix ObsDetails integration test

* Alphabetize props; remove realm check; refactor new Id method

---------

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2023-11-17 12:35:29 -08:00
Ken-ichi Ueda
6d03980a2c Restore canGoBack in BackButton 2023-09-19 16:58:48 -07:00
Amanda Bullington
5bfa7940e1 Refactor ObsDetails and show ID after agree button pressed (#738) 2023-08-16 16:09:46 -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
Ken-ichi
00ae38ddda Standard camera photo delete (#615)
* Ensure layout of the PhotoCarousel photos doesn't change in delete mode
* Stop conflating screen-size layout differences with tablet layout differences
* Bugfix: deleting one photo in the StandardCamera removed all photos
* Animated rotation of rotatable elements on StandardCamera
* Ensure loading status shows while first photo is being taken
* Tried to remove some open handles and shore up some unhappy tests
2023-05-19 13:16:32 -07:00
Johannes Klein
e1a7a4383d 549 filled activity icons (#574)
* Refactor ObsStatus, add filled property

* Remove viewed prop from observation

* Update properties for ObsDetail mark viewed

* Use separate fields for comments and ids for ObsStatus

* Add hook for fetching updates

* Unit tests for the updates hook

* Unit tests for different paths for updating the realm observation when using the hook

* Update MyObservations.test.js

* Add integration test if updates has been called in my observations

* Update Podfile.lock

* Update observation to not viewed if the keys have not been initialized

* Add test case if observation fields are not initialized

* Add test case

* Refetch stale data on coming back from the background

* Subscribe to observation updates also in ObsDetail screen

This also invalidates and refetches the data after a successful mutation of the id or comment being viewed.

* Refetch observation updates data on sync button press

* Throw error in updates query

* Return refetch function from hook

* Add mock to ObsDetails

* Remove unused var

* Update useObservationsUpdates.test.js

* Reset realm viewed state to true ...

for all observations on app mount and coming to the foreground.

* Reorder function calls

* Change hook to use boolean as enabled param

* Create ObsDetails.test.js

* Update date handle tests to make sure Remote data classes have parseable date

* Add test case for comment and identification

* Update ObsDetails.test.js

* Also check for user in ObsDetails

* Refactored into separate hook for App.js

* Unit and integration test for new hook

* Rename const

* Rename field

* Rename field

* Export query key from hook

* Refactor true check

* Additional methods for obs being viewed or not

* Changed test description

* Add per_page to observations updated
2023-05-11 16:33:37 +02:00