* Update react-native-safe-area-context-to >4.10.1
Version 4.10.1 adds support for react native 0.74.
* Re-establish mock after it was reset
I think the better way forward would be to restructure these tests, so that we don't need to resetAllMocks in between the two describe blocks, but I don't want to increase the scope of this PR.
* Split apart observation & media uploaders & add unit tests
* Use typescript
* Return only media items needed
* Fix tests related to uploading vs. uploaded status
* Remove undefined from union for observationUUID
Above and below in the callstack of those functions the type is only string, so that change seems to be fine for me to make directly on your PR.
* Extract an Operation interface (#2904)
* Type updates
* Update mapped param types
---------
Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
* prevent multiple taps on ai camera button
* remove console log
* Add PressableWithDebounce component
* Add accessibilityState
* Change podfile lock to use same cocoapods as gemfile
* remove useeffect
* Change file extension
* Indentation
* Update type
* Extend PropsWithChildren
* Import type
* Add function param type
* use useFocusEffect instead of PressableWithDebounce in TakePhoto
* adding blur listener instead of using PressableWithDebounce
* Remove unused props
* Adapt to existing code style
* Move blur effect to CameraContainer (#2899)
* Move blur effect to CameraContainer
We can reuse the already existing `takingPhoto` state to disable the camera UI until the user navigates away.
* Also disable photo library on tablets
---------
Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
* Add Boolean to control button being shown
Same Button component, only with changed indentation
* Apply margin between buttons to hide button instead
* Move left margin to container
Because ID button is now optional but container is not.
* Increase margin between buttons
Not part of the ticket, but it was not according to designs.
* Use existing state for the button
* Update integration test
* Update duplicate testID
* Add unit test for showing button behaviour based on photos
* Rename file
* Use PressableProps interface for PressableWithTracking
* Remove TODO
* Update handleLayout types
* Update allowed prop type
If SuggestionsResult can have ApiTaxon | RealmTaxon, we have to enable it in DisplayTaxonName as well, and rank_level can be undefined according to this union.
* Allow null
accessibleTaxonName uses currentUser directly from useCurrentUser which can be null.
* Use as to declare which type is used
* Source might be null
* Rename file
* Migrate flow to TS
* Update type
* Update type
* Rename file
* Update useTranslation.ts
* Check if instanceof Error
* Update imports
* Update type
* Rename file
* Migrate translatedRank to TS
* Migrate DisplayTaxonName to TS
* Also accept number for taxonId
* Those types are currently not optional
* Revert "Migrate translatedRank to TS"
This reverts commit c69cc18061.
* Rename taxon.js
* Add interfaces and types
* Remove adding a key to the function param
* Move fetchTaxonAndSave back to original file
* Move interface
* Update import
* Update types
* Rename some variables for clarity
* This is how it currently props down from only HOC
* Update imports
* Rename file
* Add param interface
* Update imports
* Revert "Move fetchTaxonAndSave back to original file"
This reverts commit 981ce228e8.
* Move fetchTaxonAndSave to own file
* Type inference is easiest way for React components
* Rename file
* Remove unused props
* Add types
* Update type
* Infer return type
* Update import
* Add interface
* Rename const and interface
* Update import (Merge conflict)
* MOB-708 - suggestions screen - show percentages instead of confidence dots
* Code review fixes
* Remove confidencePercentage from condition
* Reuse existing string from Match screen header
---------
Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
* Create module for realm syncing and write unit tests before refactoring
* Refactor realmSync functions for readability & make sure realm errors aren't silently swallowed
* unit tests
* Update tests to use factory functions for media
* Update tests to use factory
* Remove sanitize function since it's redundant with mapping; move mapping & add unit tests
---------
Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
* Create module for realm syncing and write unit tests before refactoring
* Refactor realmSync functions for readability & make sure realm errors aren't silently swallowed
* Move error handling to its own module and add unit tests
---------
Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
* Create module for realm syncing and write unit tests before refactoring
* Refactor realmSync functions for readability & make sure realm errors aren't silently swallowed
* Break progress tracking out into module with unit tests
* Add context to announcements API calls handleError
* Add context to handleError for calls in comments
* Add context to handleError for calls in computerVision
* Add context to handleError for calls in flags
* Add context to handleError for calls in identifications
* Add context to handleError for calls in messages
* Add context to handleError for calls in observations
* Add context to handleError for calls in observationSounds
* Add context to handleError for calls in places
* Add context to handleError for calls in projects
* Add context to handleError for calls in qualityMetrics
* Add context to handleError for calls in relationships
* Add context to handleError for calls in taxa
* Add context to handleError for calls in translations
* Add context to handleError for calls in users
* Move creation of error context to the handleError function
Also spread any other context that was passed into this function in the new context.
* Move logger for 429 errors to the handleError function
There are two codepaths that an error of 429 can follow here. Errors thrown from reactQueryRetry have a .status field whereas errors thrown from inaturalistjs have a .response.status field (and not the other in both cases).
I don't want to update the handleError function for now but instead keep its codepaths the same, so I added logging for both paths.
* Remove nullish values (null or undefined) from context
* 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
* Set default explore view to observations
* Rearrange ObservationsViewBar buttons to always show grid first and map first in Explore
* Set initialRegion of Explore map to same zoom level as location picker, using delta
* Consolidate map code into MapView with ref forwarding to allow animation & initialRegion set
* Stop controlling the map region from zustand, since we're using initialRegion
* Make sure we're not double animating when navigating to a new place
* Use ref to only get map boundaries exactly when they're needed, instead of tracking in state
* Make sure current location button does the same as NEARBY button
* Update Explore integration tests to reflect observations view as first view
* Fix navigation Explore tests to reflect landing on observations view
* Update MapView unit tests
* Check location permissions in MapView on current location button
* Code cleanup
* Fix tests and add test for location permissions
* To Mob 720: add some types and null guards (#2878)
* Update Map with Region type
* Type initialRegion
* Guard against null
* Guard against undefined coordinates
* Center loading indicator but not fill space (#2880)
Move the loading indicator to the center of the parent (and back left and top for half its size).
---------
Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
* Prevent lots of extra renders from useTaxonSearch; prevent TaxonResult from refetching remote taxon
* Add debounce to SearchBar to prevent unnecessary API calls
* Reset local value when clearing search
* Change text on Match loading screen (#2838) (#2841)
* Change copy for Match header & omit check for already seen species (#2837) (#2840)
* Fix: prevent multiple taps on Buttons like Suggest Id (#2833)
* Add debounce to Button to make sure users can't double tap any buttons / navigate twice
* Fix tests by mocking the Button component with a quick debounce
* Remove useEffect
* Remove unsupported taxonomic rank
* Explicitly set state back to null
* Replace "NONE" with "ALL"
This also closes MOB-642
* Revert "Replace "NONE" with "ALL""
This reverts commit cf819acfc3.