Commit Graph

339 Commits

Author SHA1 Message Date
Johannes Klein
aff8959ca2 Remove mock of deleted component 2024-02-27 09:56:51 +01:00
Johannes Klein
e4c86a6de7 Add About screen (#1178) 2024-02-26 16:43:50 +01:00
Ken-ichi
4ccf9e750b Explore fixes (#1169)
* Separate zoom to user loc from nearby; fix Android map crash; disable map pitch and rotate
* Ensure Explore shows nearby observations after permission granted
* Ensure Explore shows nearby observations even when defaulting to grid/list
  view
* Don't default the map to showing verifiable obs (this isn't the map's
  responsibility, sometimes we want to map casual obs)
* Remove extraneous current location button on map (closes #941)
* Bugfix: Explore user filter didn't let you choose a user
* Remove place params for bounding box searches and vice versa
* Prevent Explore list and map from re-rendering every time you come back to Explore
* Fixed Explore header count overflow style
* Bugfix: Explore filters weren't 100% width on iPad
* More layout fixes; fixed bug w/ UserProfile when zero idents
2024-02-23 19:55:25 -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
Johannes Klein
74479d7d7f Navigate to Media viewer from suggestions (#1162)
* Add method to get innerPhotos array

* Rename component

* Get list pf photos in suggestions

* Add Media viewer modal

* Rename prop

* Update MediaViewer.test.js

* Update test IDs
2024-02-22 15:20:19 +01:00
Ken-ichi Ueda
dca5b4235f Numerous eslint fixes 2024-02-21 10:49:08 -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
Johannes Klein
45dfb12824 Snapshot test updates 2024-02-21 16:54:55 +01: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
Amanda Bullington
53d5527c1c Fix for Android crash: minZoomLevel must be 0, not null 2024-02-16 14:02:55 -08:00
Johannes Klein
2d44fb9aac Explore filters, one more date range, two bugfixes (#1154)
* Update strings.ftl

* Add date range option to Date Uploaded filter

* Use more precise type for mapBoundaries

* Close date time picker on confirm button pressed

* Add TODO

* Prop isChecked into CheckBox component

Closes #1153

* Update Checkbox test

* Add another snapshot
2024-02-16 08:55:00 +01:00
Amanda Bullington
d147ac5d54 Explore defaults to viewer's location (#1157)
* Show observations by defaulting to user location

* Remove log

* Create useHeaderCount hook to load user location count before global count

* Header count and location permission fixes

* Remove log

* Fix Explore tests

* Test fixes and add blocked/denied state
2024-02-15 18:28:33 -08:00
Ken-ichi
012814d9a3 Fix MyObs test flakiness by waiting for app to settle before closing realm (#1156)
* Fix MyObs test flakiness by waiting for app to settle before closing realm
* Moved currentUser down into the Announcements component
2024-02-15 14:47:33 -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
d160083177 Redo search in map, Explore (#1151)
* Add tests for redo search button

* Update tiles, observation, and count with map area query params
2024-02-14 13:37:28 -08:00
Ken-ichi
ef1db46bae Bugfix: withdrawing ID was deleting the ID body (#1150)
Additionally,

* Adds tests for ID withdraw and restore
* Renames withdrawOrRestoreIdentification function for clarity
* Adds some accessibility labels for testing and accessibility

Closes #1129
2024-02-14 11:22:13 -08:00
budowski
f5fbc3ce11 Return to original screen after canceling photo import
Closes #1051

---------

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2024-02-13 16:59:11 -08:00
Amanda Bullington
eb7f9d28e4 Add navigation links to explore views (#1146)
* Add navigation links to species, observer, identifier view items

* Add tests to check for navigation; closes #1054
2024-02-13 16:52:11 -08:00
Ken-ichi Ueda
7c347faabf Fixed ObsMedia test 2024-02-12 14:44:05 -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
Johannes Klein
5d3e4f3a9e Revert "Replace reanimated jest setup"
This reverts commit 1348387c57.
2024-02-09 22:45:29 +01:00
Johannes Klein
1348387c57 Replace reanimated jest setup 2024-02-09 22:08:36 +01: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
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
Amanda Bullington
2bce3aa784 Prevent PhotoCount from rendering with no count on scroll (#1112)
* Remove ForeignObject from SVG to prevent PhotoCount from rendering blank; closes #1073

* Update snapshot

* Fix styling for photo count large sizes

* Update snapshots
2024-02-05 14:12:02 -08:00
Amanda Bullington
a3b1371682 Fix agree button taxon id (#1105)
* Fix agree button taxon_id and write test; closes #1036

* Code cleanup
2024-02-01 20:58:29 -08:00
Amanda Bullington
b69e5a9923 Reset IconicTaxonChooser when navigating multiple observations (#1100)
* Reset IconicTaxonChooser when navigating multiple observations; closes #1092

* Fix test undefined key error

* Remove console log
2024-01-31 15:42:22 -08:00
Amanda Bullington
ededfe82d1 Show ObsStatus in correct position after animating, ObsGridItem (#1099)
* Show ObsStatus in correct position after animating upload; closes #1056

* Update snapshots
2024-01-31 10:06:58 -08:00
Johannes Klein
49e9339c51 ObsDetail media masonry layout (#1085)
* Simple masonry layout

* Scrollable masonry

* Render SoundSlide in Masonry

* Fix previos commit

* Fix param name

* Optional style for photo slide

* Rename

* Use photo slide

* Open media viewer on press

* Rename components

* Rename component

* Add test for tablet obs media
2024-01-26 11:57:42 +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
Johannes Klein
60de855f6b Explore filters (#1067)
* Remove Explore Filters screen

* State for Explore filters modal

* Accept modal state in Header to open modal

* Basic explore filters modal

* Save taxon object to explore state on update

* Update types expected

* Pass state and update function into filters modal

* Receive new props

* Destructure taxon from props

* Restyle header View

* Add main Heading

* Add taxon section

* Restyle modal header

* Add numbers badge component

* TaxonResult add prop for general on press

* Make TaxonResult checkmark optional

* DisplayTaxon can receive children as right-side component

* Refactor ExploreFilters component tree

* Move header out of scroll view

* Update ExploreFilters.js

* Update ExploreFilters.js

* Add icon to display taxon

* Update ExploreFilters.js

* Add basic taxon search screen

* Use taxon result without checkmark, send taxon to Explore screen

* Add string

* Accept taxon on explore screen

* Add a dummy screen for explore location search

* Add type

* Store place in state when received as route param

* Basic explore filters location section

* Add strings

* Move filter modal to separate component, add sort by props

* Add screen for testing purposes

Because atm we can not have two modals open at the same time, I move filters to a separate screen for testing the other modals.

* Add initial filter params and do not pass down undefined ones

* Pass function to update sort by down

* Create SortBySheet.js

* Navigate to test screen instead

* Sort by button text

* Add default filters definition

* Call reset function if filters are not default

* Add prop and function to reset

* Add user search screen

* Move search screens

* Move references

* Replace list with flash list

* Add item separator

* Remove footer

* Return user to Explore

* On press handle for user list item

* Fix wrong imports

* If a user is in prop show user icon and edit button instead

* Refactor display taxon to be inside a Pressable

* Missing import

* Receive user in explore rout params

* Quality grade section header

* Placeholder

* Add TODO

* Calculate number of filters set

* Only send user id to explore screen

* Do send back user object, filter out user_id

* Add project section

* Refactor project list item into standalone component

* Change initial value to undefined

* Add project search screen

* Remove loading state

* Show project in filter modal

* If project is in param set it to state

* Add Checkboxes to filter modal

* Remove comment

* Taxonomic Ranks section UI

* Use props for checkboxes

* Update ExploreContainer.js

* Calculate actual query param

* Is Most Faved possible?

* Actually set sort by query params

* Save hrank and lrank to explore state, prop down

* Update ExploreContainer.js

* Show ranks in button text

* Radio modal to test taxonomic ranks

* Add sticky toolbar

* Update strings.ftl

* Date observed section bottom sheet

* Date observed prop

* Change padding

* Date observed all UI

* Taxonomic ranks section

* Add todo

* Refactor open sheets state

* Update button

* Add exact date picker sections

* Store dates in state

* Update strings.ftl

* Refactor function name

* Refactor constants

* Reset date states on mode change

* Set new months to state on change

* Configuration for showing months checkboxes

* Receive and update months with checkboxes

* Refactor RadioButton sheet to export radio button row

* Add Media section UI

* Add media state to Explore

* Start with Establishment Means section

* Add checkbox texts

* Add states

* Functions to update state

* Add sort by param for most faved

* Spacing for checkboxes

* Wild Status section UI

* Wild status state

* Reviewed UI section

* Reviewed state

* Set current user id as viewer_id for review true to work

* Remove testing code

* Photo licensing UI section

* Photo license state

* Prop down photo license update, use param in search

Forgotten in previous commit

* Unused prop

* Add noStatus state

* Change Establishment Means status to TODO

* Add TODO text

* Console log for testing params

* After rebase from main this was necessary

* Simple switch between two UIs

* Simple explore context

* Lift Provider one up

* Copy over photo license to new provider

* Copy over review filter

* Refactor to use enum

* Copy over wild status, and enum refactors

* Refactor some more state

* Remove unused navigation

* Refactor one state

* Refactor some more state

* Refactor some more state

* Remove testing screen

* Refactor some more state and derived state

* Do send over project as param from Project Details

* Update FilterModal.js

* Rename components

* Remove unused param handling

* Add keys

* Remove substring for key

* lrank and hrank combined counts as one only

* Use the correct constants

* Add key

* Fix issue with button text

* Add View Wrapper for filters section

* UI cosmetics

* Compare current filters state to a snapshot

* Change button level to focus

* Add context action to revert to snapshot

* Confirmation dialog strings

* Add confirmation sheet

* Send current user along to Explore from Home Header

Closes #887

* Date bottom sheets texts

* Show texts in modal

* Set search to worldwide on param received

* Send taxon as param to Explore from Taxon details screen

Closes #889

* Show all observations worldwide of project

* On species view pressed should navigate to explore species view

Closes #893

* Go to explore from users profile

* Navigate to species view from user profile

Closes #894

* Enable unclear filters

* Add taxon to context

* Use context for explore params further down the tree

* Refactor one state

* Remove unused action

* Remove unused state

* Refactor function

* Refactor state

* Refactor place_id, which concludes reducer refactor

* Refactor names

* Do not use key inside context's state

* Add a11y label

* Remove duplicate test ID

* Remove superfluous component

* Create ProjectListItem.test.js

* Add failing filter modal test

* Remove log

* Rename function

* Months strings

* Remove todo

* A11y labels

* Remove TODOs

* A11y label

* A11y label

* Refactor taxon search hook

* Update FilterModal.js

* A11y labels

* A11y not possible in react-native-paper lead to test fails

* Update TaxonSearch.test.js

* Add dropshadow

* Another dropshadow

* Add TODO text to UI elements that are not finished

* Reverse order

* Refactor constants

* Revert "Refactor constants"

This reverts commit 2f52e936d6.

* Refactor to use constants

* Refactor constants use

* Refactor constant use

* Refactor constants use

* Refactor constants use

* Refactor constants use

* Refactor code

* Add validation of date format

* Correct type for snapshot action

* Add taxonomic rank enum

* Taxon can be undefined

* More precise type

* Fix wrong string usage

* Refactor radio button row component

* Refactor ProjectListItem import

* Example usage of new ui elements

* Pull sort by sheet back inside filter modal

* Rename params

* Add useEffect dependency

* Rename param

* Fix broken function
2024-01-23 18:08:36 +01:00
Ken-ichi
e6b5cb8aa6 Obs details sounds (#1062)
* Extracted non-photo stuff from PhotoDisplay
* Separate component for FaveButton
* Prevent faves while signed out
* Separate component for nav header
* Stick nav header while scrolling until tabs
* Nav header has slight gradient for visibility over white content
* Renamed ObsDetails media components so they're not focused on photos
* Data and layout changes leading up to sound player on ObsDetail
* Add sound player to ObsDetails
* Swiping away while playing should pause playback
* Swiping back to sound and playing again should resume where you left off
* Allow viewing media while offline (images may be cached)
* Stop playback when navigating away from ObsDetails
* Fetch sounds in Explore so we can show sound icon
* Map all observation objects in explore with Realm-ish attributes
2024-01-22 13:12:01 -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 Ueda
6b37ca1d2b Several minor fixes
* use showSwitchMapTypeButton option in Location Picker and ObsDetails map
* title of comment bottom sheet to "Add Comment"
* fixed position of current location button on map
* text of geoprivacy on ObsDetails to "Geoprivacy: Open"
* don't load offline suggestions while loading online
2024-01-16 17:52:23 -08:00
Amanda Bullington
51a3d171b2 Limit display taxon name on ObsGridItem (#1042)
* Ellipsize long common name text, ObsGridItem; closes #913

* Update snapshots
2024-01-16 16:52:10 -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
3e62df7bd4 Render correct photo count when combining multiple photos (#1024)
* Update PhotoCount component so correct count renders in GroupPhotos; closes #1015

* Add tests for combining photos in group photos container

* Add test for separating photos

* Add comment to PhotoCount component
2024-01-11 16:31:21 -08:00
Amanda Bullington
30a5a9fbec Use safe area insets to style tab bar padding (#1021)
* Use safe area insets to style tab bar padding; closes #945

* Update snapshot
2024-01-11 10:57:54 -08:00
Angie
379a8747b2 Merge pull request #1020 from inaturalist/770-dqa-screen-shows-an-error-modal-on-navigating-there
770 dqa screen shows an error modal on navigating there
2024-01-10 19:21:25 -08:00
Amanda Bullington
09b225a1e6 Pause button dark mode until post-MVP (#1019)
* Pause button dark mode until post-MVP; closes #994

* Update snapshots
2024-01-10 17:07:36 -08:00
Angie Ta
75c3894531 Merge branch 'main' into 770-dqa-screen-shows-an-error-modal-on-navigating-there 2024-01-10 16:41:31 -08:00
Amanda Bullington
7f6a25fa9f Show person icon as fallback when user is offline; closes #946 (#1017) 2024-01-10 14:34:10 -08:00
Amanda Bullington
d0cf6751cf Render loading wheel until data is available for FlashList (#1016)
* Render loading wheel until data is available for FlashList; closes #756

* Fix: show loading wheel in Explore before data rendered

* Fix test
2024-01-10 14:33:59 -08:00
Angie Ta
c5a0b9db64 Bug fix and cleanup code into DQAContainer, update tests 2024-01-09 22:25:33 -08:00
Amanda Bullington
1d23c1f1fa Make entire dropdown for notes tappable; closes #860 (#1012) 2024-01-09 18:30:29 -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
ae9b2d2040 Minor style fixes for ObsDetails (#1011)
* Renamed CommunityTaxon to ObsDetailsHeader since it has more info than just the community taxon
* Made tabs stick on scroll instead of header
* Removed weird spacer element at the bottom of the activity
2024-01-09 13:45:29 -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