Commit Graph

37 Commits

Author SHA1 Message Date
Johannes Klein
26f0863ec9 Fix: integration tests store setup when changing layout slice (#2932)
* Update MyObservations.test.js

* Remove comment

* Remove unnecessary setState

* Update MyObservationsLocalization.test.js

* Previous change can be more specific

* Update MyObservationsSimple.test.js

* Update AICamera.test.js

* Update Explore.test.js

* Update MyObservations.test.js

* Update ObsEdit.test.js

* Update SoundRecorder.test.js

* Update PhotoImport.test.js

* Update CustomTabBar.test.js

* Update SuggestionsWithUnsyncedObs.test.js

* Update SuggestionsWithSyncedObs.test.js

* Update PhotoDeletion.test.js

* Update Suggestions.test.js

* Update AddObsButton.test.js

* Update MediaViewer.test.js

* Update PhotoLibrary.test.js

* Update StandardCamera.test.js

* Update SimpleUploadBannerContainer.test.js

* This test needs to be in advanced mode

* Remove setState of shownOnce back to default

* Refactor store override calls into a helper function

* Update MyObservationsLocalization.test.js

* Update MyObservationsSimple.test.js

* Update PhotoDeletion.test.js

* Update PhotoImport.test.js

* Update SuggestionsWithSyncedObs.test.js

* Refactor to use helper

* Update SimpleUploadBannerContainer.test.js
2025-06-10 16:10:19 +02:00
Johannes Klein
3cff7326ae Change calculation of successful upload status stats (#2869)
* Show upload status also if we have no status but an error

E.g. if all uploads fail.

* Change number of successful upploads

Now to use number of attempts made minus number of failed uploads.

* Add unit tests

* Refactor state of successful uploads into store
2025-04-29 12:05:44 -07:00
Amanda Bullington
d782538109 Advanced settings UI updates (#2797)
* Open more options on long press

* Add tests for long press

* Rearranging Settings screen with new layout

* Add toggle for advanced settings in layout slice; fix default mode toggle

* Update settings with navigation flows

* Fix tests

* Change power mode switch for e2e test

* Fix settings test for green button toggle

* Fix advanced user toggle in e2e test (which hides pivot cards)

* Changes based on design convo; test fixes

* Fix e2e tests

* Follow user flow chart and update nav accordingly

* Rename function

* Fix test

* Can be null so check for false only

* Little less spacing between radio button rows

* Minor UI updates

* Remove check for previous setting in UI

* This is no longer used anywhere

* Update AICamera.test.js

* Update AICamera.test.js

* Update AICamera.test.js

* Update Suggestions.test.js

* Update Settings.test.js

* Update LanguageSettings.test.js

---------

Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
2025-03-27 17:36:36 +01:00
Amanda Bullington
70ffa9112a Make MyObservationsSimple the standard UI across default/advanced mode (#2788)
* Update TypeScript

* Fix some tests with new default MyObservationsSimple

* Show upload toolbar on MyObs advanced

* Update tests for simple mode

* Fix deletions popping back up on MyObs

* Fix e2e test, which also means fixing our deletion process

* Fix useSyncObservations test

* Requested changes to better fit latest designs

* Add tests to check for hidden upload banner
2025-03-20 17:04:31 -07:00
Johannes Klein
e5bbd6b873 Do not upload observations that have missing location or date when in default mode (#2750)
* Prop number in from direct and single HOC

* Prop num in from even higher

* Calculate number of unuploaded obs with missing basics

* Only show upload indicators when number of obs without missing basics is positive

* Send obs uuids with missing basics to button press handler

* Instead of reacting in useEffect call syncManually explicitly

* Accept array of uuids to skip and pass on to startUploadObservations

* If param given do not include some uuids when building upload queue

* Remove test

* Change param interface to options object

* Destructure only if param given
2025-03-12 16:18:37 -07:00
Johannes Klein
bb03bb695a Change default MyObs layout to grid (#2686)
* Change default MyObs layout to grid

* Rename testID

* Update tests expecting to start with list view

* Reverse order of buttons in layout selector

* Fix layout bug of having empty boxes on explore
2025-02-21 18:50:14 +01:00
Ken-ichi
25e50379bc fix: restore observation fetch when focusing on myobs (#2511) 2024-12-03 18:52:47 -08:00
Ken-ichi
10a768e8d0 fix: show onboarding content when signed in user has 0 observations (#2510)
Closes #2508
2024-12-03 17:47:34 -08:00
Amanda Bullington
69b1921119 Fetch observation after upload with authentication to show correct localization (#2420)
* Make sure API calls have options to fetch correct lexicons; separate capitalization logic for each lexicon

* Fix Explore nav test

* Use auth token to fetch observation after upload; simplify upserting in obs infinite scroll

* Fix useSyncObservations test
2024-11-12 19:46:14 -08:00
Amanda Bullington
75e5193ae7 Upload status fixes (#1979)
* Uploads start as expected from ObsEdit; error state not shown while syncing; closes #1954

* Fix MyObs test

* Fix toolbar test
2024-08-16 13:12:36 -07:00
Ken-ichi
bca4872def Ensure device stays awake during uploading can sleep after (#1939)
* Fix previous state in which it was never really allowed to sleep again after
  upload finished
* Rename `uploadObservations` to `startUploadObservations` to accurately
  describe what it does
* Minor improvements in ts typing
2024-08-08 14:46:18 -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
Johannes Klein
230646e2ae 1684 explore map null (#1760) 2024-07-03 16:33:08 +02:00
Amanda Bullington
771e5c810b Changes to syncing process (#1670)
* Refactor syncing code and add preUploadProgress checks

* Progress on sync button functionality

* Fix deletions progress and toolbar test

* Time out deletion complete if no uploads

* Delete and then upload from sync button

* Test cleanup

* try to fix tests

* Improvements to automatic and button sync logging

* Code cleanup

* Renaming and rewriting sync functionality

* Restore MyObs test

* Add tests for useSyncObservations

* Code cleanup

* Use unique realm instance in useSyncObservations test

* Fixes for e2e crash

* Fix deletions, tests, and deletion errors

* Show and clear deletions on toolbar

* Sleep longer before resetting toolbar

* Remove sleep to pass e2e test
2024-06-18 19:04:28 -07:00
Ken-ichi Ueda
4f01c08ca8 Upload fixes
* Rename numObservationsInQueue to initialNumObservationsInQueue for clarity
* Change upload timeout to 5 minutes (from 15 seconds)
* Mint a new abortController at the beginning of an upload queue, not for each
  observation
2024-06-07 12:57:18 -07:00
Ken-ichi
8dbbca04d9 Fail upload when network request failed (#1651)
* Fixed cancel upload button
* Uploads will timeout after 15s
* Moved MyObs tests unrelated to unsynced into the synced block
2024-06-04 18:23:59 -07:00
Amanda Bullington
aa167c669d Refactor upload functionality into hook/zustand (#1606)
* Refactor upload code into hook and zustand slice

* Create a single source of truth for toolbar and individual progress

* Fix unit tests

* Fix more tests

* Continue trying to simplify upload progress and status code

* Continued overhaul of upload code

* Fix exclamation point in Toolbar

* Fix total toolbar progress

* Fix tests

* Update snapshots

* Code cleanup

* Update MyObs test

* Fix most tests by not deleting realm

* Keep attempting to make toolbar text clear in subsequent tests

* Mock Zustand and reset state after all tests

In theory this should make testing with Zustand simpler. The real kicker is
that resetting state will fail if we're not careful about manually replacing
nested objects in Zustand state updates.

* Bugfix: removeAllFilesFromDirectory works with File objects, not raw paths

* Update status text when uploads canceled

* Only show red exclamation rotating icon after all uploads attempted

* Fix progress bar with zustand nested object

* Fix toolbar progress

---------

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2024-05-30 20:36:50 -07:00
Amanda Bullington
2d74c72e37 Fetch remotely deleted observations automatically (#1602)
* Start automatically syncing remotely deleted observations

* Fix query invalidation in ObsDetails

* Fix deletion process

* Call deletions once every time a user lands on MyObs

* Fix deletion tests

* Fix tests
2024-05-22 20:34:57 -07:00
Ken-ichi
84c3b3c96d Track number of failed uploads (#1601) 2024-05-22 17:40:06 -07:00
Ken-ichi
97fd4f2874 Try to catch and log errors during upload (#1283)
* Try to catch and log errors during upload
* Wraps some upload async methods with try/catch to attempt to log some
  potential bugs
* Adjusts upload param mappings
* Try to get upload status to more accurately reflect the upload state
* Consistent upload success messaging after single upload
2024-03-22 19:17:45 -07: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
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
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
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
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
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 Ueda
38e75d3cdf Remove some unecessary react-navigation mocks 2023-11-20 11:09:36 -08:00
Amanda Bullington
7de3790230 Performance: move upload reducer out of ObsEditProvider into MyObservationsContainer (#879)
* Move upload functionality into MyObservations, out of ObsEditProvider

* Move upload into helper function

* Fixes for ObsEdit -> MyObs flow

* Progress on making uploads faster

* Update performance test

* Fix toolbar progress

* Fix tests for observation upload flow

* Fixes from code review; fix e2e test for signed in user by bypassing permission gate

* Hide sign up test when keyboard visible; fixes Android e2e test

* Comment out permissions code in e2e test to see if it's only needed locally

* Comment out permissions gate for signed out user iOS

* Use focused hook to stop ObsEdit from rerendering while user is on other screens

* Restore reassure in branch

* e2e code cleanup
2023-11-15 11:40:11 -08:00
Amanda Bullington
d38720f9b2 Tests & fix for upload progress (#826)
* Add unit tests for Toolbar upload progress

* Tests and improvements to upload progress bars

* Fix tests

* Update type for showsExploreIcon

* Fix tests

* Clear realm before MyObs tests
2023-10-20 16:01:48 -07:00
Ken-ichi
f166131fe5 ObsGridItem layout fixes (#815)
* Fixed layout changes for ObsGriditem
* Added noevidence icon when no photos
* Added a few tests
* Minor cleanup
2023-10-05 11:22:03 -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
9a7529122a Ensure MyObs grid doesn't change column count on phone rotation (#664)
While continuing to allow it for tablets. Closes #661
2023-06-09 18:04:35 -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
Chris
6e133acbeb Use flash list obs page (#553)
* Convert to flash list on my obs page
* Use infinite scroll query

Closes #535
2023-03-29 14:56:17 -07:00
Johannes Klein
868c95ee13 494 activity count (#495)
* Refactor to boolean prop for white or gray

* Rename prop

* Add component for comments count

* Reorder strings

* Use CommentsCount

* Add identifications count component

* Add snapshot test for ActivityCount

* Add tests TODO for component

* Updated with new icons

* Add snapshot tests

* Update ActivityCount.test.js.snap

* Unit test for count text

* Remove testing comments count in ObsList test

* Update with changes from main

* Update IdentificationsCount.test.js.snap

* Remove components from ObsStatus
2023-03-17 11:55:29 -07:00
Amanda Bullington
bbc5b9d67d MyObservations refactor (#510)
* WIP: very rough start at pulling state up into a container for MyObservations

I made a parallel MyObservations component and container so ObservationViews
can still be used as a working reference, but the ultimate goal here is to
focus MyObservations on presentation, and pull state and other business logic
up into a container component. This should make MyObservations a bit more
testable and clean up a very large and confusing file.

I'm also trying to move away from a generalized representation of observations
on all screens, which is why I want to name it MyObservations and not
ObservationViews. MyObservations has a lot of unique functionality that we
won't need elsewhere, and we can modularize stuff when we need to use it in
multiple places.

* UI updates for header, toolbar, empty component

* Add pressable component and login sheet

* UI improvements; get infinite scroll working

* UI improvements & additions for empty screen & bottom sheet

* Show login sheet when a user presses sync but is not logged in

* Fix backdrop close for AddObsModal

* Move UI elements to MyObservations

* Fix unit tests for MyObservations

* Fix for login sheet

* Set header height to a different height on Android to account for safe area

* Fix failing tests & rerender of user icon in navbar

* Remove scientific name from DisplayTaxonName to match Figma UI

* Set height above toolbar dynamically for sticky toolbar

* Add prop to display or hide second name in DisplayTaxonName

* Use RN styling to style grid view for MyObs flatlist

* Fix failing project obs test

* Create separate ToolbarContainer to separate presentation from logic; fix upload count

* Merge main and show onboarding based on user's total obs count

* Fix display taxon name styling and remove header fade on iOS

* Add header text for 0 observations, logged out state

* Update infinite scroll to 50 obs at a time; make loading wheel show faster

* Add uploaded status to toolbar

* Apply bandaid fix to stop Android from crashing on start

* Start adding new icons to MyObs

* Add circular progress; show upload icons at correct times during upload

* Add disabled props for accessibility state

* Fix tests; update snapshots

* Code cleanup

* Code cleanup & add inaturalist icon

* Fix merge conflict and add icon

* Add inaturalist icon

* Fix navigation to obs list and toolbar status when upload completes

* Move showLoginSheet code to MyObsContainer

* Fix toolbar status text

* Sync toolbar with upload status progress

* Clear toolbar after nav

* Tests passing

* Update e2e test

* Target login button in e2e tests

* Fix failing e2e tests with new testID for login button

* Update button snapshot to include new testID

---------

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2023-03-14 10:54:33 -07:00