21 Commits

Author SHA1 Message Date
Ryan Stelly
b78be9243d lint rule & autofix for "trailing comma" (#3299)
* (lint) MOB-1063 enforce trailing commas

* autofix trailing commas

* manually fix newly introduced maxlen violations

* add trailing comma convention to i18n build
2025-12-22 20:17:13 -06:00
Johannes Klein
49091f8fc4 Enable React Compiler (#3082)
* Update package.json

* Update package-lock.json

* Enable plugin

* Update package.json

* Update package-lock.json

* Update .eslintrc.js

* Create a new object instead of mutating the existing one

* Update SoundRecorder.js

* Do not mutate prop directly

* Do not mutate store value directly

* Disable compiler for zoom hook

Because it uses reanimated logic, and previous work laid out we should specifically disregard a rule of react here, unsure what to do here for now.

* Move array for tracking results into component

* Disable compiler for StandardCamera

* Do not mutate store value directly

* Disable compiler for FullPageWebView

* Do not mutate route param

* Remove unnecessary check if state is true before setting it to false

* Fix: user might be undefined

* Update reanimated usage with new compiler compliant API

* Fix: taxon might be undefined

* Fix: taxon might be undefined

* Fix: common pitfall of trying to render text outside of Text component

* Update interface

* Add package override

* Update package-lock.json

* Refactor updating of user preferences into User model

* Remove no memo directive from zoom

* Update file imports

* Migrate safeRealmWrite to TS

* Update interface and import path

* Update interface

* Refactor useLocaalObservation hook to not mutate return value of a function that should not be mutated

* Update tests to new return structure

* Remove useSafeRoute hook

We get the same information from error contexts and surrounding documents, and this hook was violating the rules of react by conditionally calling another hook.

* Use optional chaining

* Update TaxonNamesSetting.test.js

* Fix: use optional chaining

* Extend on RNTLs renderHook instead of re-implementing

* Remove unnecessary mock

* Remove unnecessary mock

* Remove unecessary mock

* Remove trailing spaces
2025-09-01 17:06:51 +02:00
Johannes Klein
d71ab7a358 Copy of: Maintenance: break upload code into smaller modules -- realm syncing functions (#2883)
* Create module for realm syncing and write unit tests before refactoring

* Refactor realmSync functions for readability & make sure realm errors aren't silently swallowed

---------

Co-authored-by: Amanda Bullington <albullington@gmail.com>
2025-04-29 16:48:50 +02:00
Amanda Bullington
2f94987b4c Whitney -> Lato font (#1407)
* Replace Whitney fonts with Lato

* Escape font family names so Lato works on iOS

* Update custom fonts

* Typography file cleanup

* Rename constants to appConstants

* Fix margins in AddObsModal
2024-04-17 11:30:55 -07:00
Johannes Klein
d6afb4b386 Upgrade to RN 0.73 (#1339)
* Upgrade to RN 0.73 with upgrade helper

* Upgrade testing-library

* Comment announcements

* Comment out UserProfle test

* Mock function used to calculate masonry layout

* There should not be a modal here

* There is actually also no modal here

* Use View if SafeAreaView is undefined

* Replace fast image library that was failing tests because of not being maintained

* Clear mocks in useTaxon test

* Remove legacy deps from testing flow

* Snapshot update

* Revert "Snapshot update"

This reverts commit bca8b296df.

* Update package-lock.json

* Clean-start

* Update project.pbxproj

* Reenable test that failed before updating dependency

* Reenable test that failed because of dependencies

* Remove comment
2024-04-08 15:28:06 +02:00
Johannes Klein
0e0a6560ac Vision camera v3 (#1121)
* Bump vision-camera

* Refactor patch

* Move patched orientation into patch functions file

* Update react-native-vision-camera+3.4.1.patch

* Switch to MacOS 13 runner

Vision camera requires XCode 15 to compile.

* Add step to specify XCode 15

* Higher level of logging

* Increase test timeout

* Add comment

* Remove navigation to obs without evidence for signed out user

* Patch for location permission not working on iOS

* Increase setup timeout

* Increase some more timeouts

* Revert back to less logging in CI

* Does it have to do with timeouts?

* Trace log level

* Update README.md

* Disable Homebrew’s auto update and install cleanup

* Setup ruby step

* Install pods only if not cached

* Revert "Install pods only if not cached"

This reverts commit 42a2ea02f9.

* Run simulator in headless mode, record all logs

* Increase timeouts again

* Revert "Remove navigation to obs without evidence for signed out user"

This reverts commit 2b4718f5ce.

* Add boolean to run use effect only once

* Did merge wrong code

* There is one more permission gate when entering obs edit now

* Add permission gate dismissal to signed out user test

* Add comment, rename state

* Lower action timeout

* Update react-native-vision-camera to 3.6, update Reanimated to v3 (#838)

* Bump camera and plugin

* Upgrade Reanimated and libs using it

* Update vision-camera mock

* Remove superfluous patch

* Fix type

* Add mocks for e2e tests because bottom sheet does not work on AOSP

* Update package-lock.json

* Update vision camera

* Bump vision camera

* Update vision camera patch version

* Remove superfluous patch

* Update vision camera

* Update vision-camera and plugin

* Use latest vision plugin = rebased v3

* Run npm clean-start

* No longer needed

* Duplicate prop

* Switch back to v3 code

* Upgrading Detox fixes issue with iOS tests failing

Because of previous lack of permissions.

* Update to latest detox version

* Npm i force

* Vision 3 e2e testing, (#1126)

* Remove jest detox config

* Revert e2e timeout increase

* Revert jest config timeout

* Use macos 14 runner which has XCode 15 per default

* Use latest bottom sheet

* Revert "Use latest bottom sheet"

This reverts commit c66cd09838.

* Adding comma back in

* Remove spaces

* Use latest vision-camera and plugin

* Use release version of vision-camera

* Remove force flag

* Update react-native-worklets-core

* Upgrade reanimated

* Update babel.config to allow nested worklets

* Run frame processor async

* Remove enableGpuBuffers flag

* Remove no longer needed comment

* Update comments about version

* Update vision-camera and plugin

* Code format

* Rename param

* Use latest-plugin

* Remove fps param from camera view

* Change confidenceThreshold to number

* API change for results structure

* Refactor fps to be checked inside hook

As of vision-camera 3.9.1 our camera feed is stuttering when calling the runAtTargetFps function inside the useFrameProcessor hook.
So, what I did here is to track the time and skip the frames that are received before the target fps is reached.

* Remove updates of non-camera related

* Update comment

* Code format

* Snapshot updates

* Revert changes to ios e2e

* Add a log for the average time it takes a frame to be processed

* Use release version of plugin

* Add a patch for runAsync to work in release builds

* Update react-native-worklets-core to 0.4.0

* Use latest plugin version

* Add a shift method to worklet arrays

* Use latest vision-plugin

This makes use of .shift() in worklet array and depends on the previous patch.

* Set result timestamp and show age of result in debug mode

* Fix an error with timestamp being undefined

* Remove log

* Use latest vision plugin

* Change result timestamp to pink

* Comment

---------

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2024-03-27 00:47:43 +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
Amanda Bullington
808cbee452 Replace ObsEditProvider with zustand for global state management (#948)
* Add zustand to app

* Begin replacing ObsEditProvider with zustand for global state

* Use store and add tests

* Fix bugs

* Add test to check for deleted photos in StandardCamera

* Make sure evidence is only added to current observation; submit comment with ID on ObsDetail

* Fix ObsEditWithoutProvider tests

* Move store to where it's needed

* Fix tests

* Await evidence being added to obsPhotos from camera

* Add a note about slices to useStore
2023-12-05 14:10:00 -08:00
Ken-ichi
6af81365d8 Restore tap-to-focus by reverting to react-native-vision-camera v2 (#923) 2023-11-20 14:49:30 -08:00
Amanda Bullington
5913fb511e Energy usage / performance improvements (#844)
* Remove console statements in production build

* Move uploadReducer into separate file

* Create reducer for creating obs; combine reducers

* Fixes with createObsReducer

* Move album, passes test states out of global context

* Bug fixes for ObsEdit flow

* Create photo gallery container

* Set accessibility test todo for PhotoGallery

* Improve FlashList performance MyObs

* Prevent flicker on modal close

* Create less rerenders in MyObservations

* Memoize drawer items for less rerendering

* Memoize custom tab bar

* Remove unused libraries and update snapshot

* Fix and prune dependencies

* Add AddObsModal tests

* Fix e2e test android by making comment confirm button visible
2023-11-02 11:03:48 -07:00
Johannes Klein
2baac4f9f8 Vision camera v3 (#819)
* Update vision camera

* Breaking change: camera device hook

* Breaking change: replace reanimated function calls

* Update vision plugin

* New take photo options

* Use changed props

* Remove undocumented prop

* Update test mocks for vision camera libraries

* Replace vision camera device orientation strings

* Add explanations to a central file for patches needed with the vision camera

* Some more patches
2023-10-12 11:38:17 +02:00
Johannes Klein
5f81c49f85 ARCamera MVP: Basic screen with full screen camera and prediction labels (#684) 2023-07-15 07:53:18 +02:00
Johannes Klein
b6ca6444f6 Change order of babel plugins 2022-12-02 14:08:05 +01: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
c740a06224 Start using Tailwind CSS (#185)
Starts changing styles over to tailwind via nativewind.

* Update node to 16.17.0
* Use styled() to ignore flow errors about className or tw props when styling components with nativewind
* Upgrade realm to make test suite run; set failing test in Explore as todo
* Add workaround for getting pods to run with XCode 14
* Fix for loading remote obs with infinite scroll
* Add styling section to README
* Use IconButton from rn-paper to make buttons more responsive to press
* Add caret next to camera roll album picker
* Fixed broken addition of gallery photos to existing observation
* Removed flatlist from scrollview on ProjectDetails (apparently not allowed?)
* Moved border style from Image to container in PhotoCarousel (border color
  not allowed for images?)

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-10-19 17:15:55 -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
1f2becdef6 Media Viewer (#107)
* Create basic media viewer with full sized image, selection, carousel, and header

* Create photo delete dialog component

* Wrap camera stack in Mortal component instead of resetting state on camera blur

* Use photo carousel in PhotoPreview for standardized photo sizes

* Make media viewer accessible from ObsEdit

* Remove evidencelist component and use photo carousel instead in ObsEdit/suggestions

* code tweaks

* Create realm ObsPhotos in standard camera for passing to media viewer, ObsEdit

* Move resize image function into Photo model

* Update photo preview to use delete photo functions from photo and obsphoto model

* Allow photo deletion in media viewer from ObsEdit, StandardCamera; switch to Modal view

* Swap in zoom functionality instead of carousel, media viewer

* Remove media viewer from nav, now that it's a modal

* Remove comment

* Update babel config with react-native-paper plugin for production

* Mock RN paper Portal component

* Media viewer takes photo uris; handles obsPhoto updates in ObsEdit and photo uri updates in StandardCamera

* Make sure tests pass with optional chaining for obsPhotos

* Update styling for StandardCamera

* Create obsPhotos attached to photos from camera

* Pass photos to StandardCamera from ObsEdit to reflect any changes made in MediaViewer

* Get tests passing

* Fix flow issues

* Change flow type for photoUris

* Add pre-commit hook for flow

* Fix flow erros
2022-06-01 11:10:03 -07:00
Amanda Bullington
5caaf58c0b Merge login changes for staging server (#49)
* Override base URL for AuthenticationService + some integration fixes for Android

* Update lock file

* Trying to get staging JWT working; allow navigation from Login screen

* Code cleanup

* More code cleanup

* Fix tests; set username

Co-authored-by: Yaron Budowski <budowski@gmail.com>
2022-02-15 12:51:13 -08:00
Yaron Budowski
2947bb6514 Merged; fixed issue with installCoreFunctions; tests to AuthenticationService 2022-01-30 23:47:42 +01:00
Amanda Bullington
a839f7867c Add eslint rules & make lint fixes 2021-09-15 11:16:47 -07:00
Amanda Bullington
d4adde847d Create RN repo with npx react-native init 2021-09-13 14:38:14 -07:00