Commit Graph

81 Commits

Author SHA1 Message Date
Johannes Klein
6ac6f88662 Merge branch 'main' into 250-e2e-init 2023-01-02 19:25:58 +01:00
Amanda Bullington
310d2e743d Add eslint rules for React Query (#319)
* Use eslint rules to clean up useQuery code

* Code cleanup for useAuthenticatedMutation

* Add realm deletion and clear mock before each test in DeleteObservationDialog
2022-12-30 13:30:07 -08:00
Johannes Klein
425d4f730b Update package.json 2022-12-17 13:02:09 +01:00
Johannes Klein
2da8c26376 Change e2e ios test to debug config 2022-12-16 23:05:53 +01:00
Amanda Bullington
5061812b89 Fix: observed on date in ObsEdit (#286)
* Fix exif test

* Make sure camera/no evidence still create a new observed_on_string

* Fix failing test with observed_on_string in fake LocalObs; closes #259

* Parse date into local timezone
2022-12-16 10:13:15 -08:00
Johannes Klein
67a4d39968 Create keystore for release build 2022-12-15 23:58:13 +01:00
Johannes Klein
fc14657ed2 Remove concurrently 2022-12-15 17:39:34 +01:00
Johannes Klein
8540947307 Add concurrently 2022-12-15 15:44:10 +01:00
Johannes Klein
e7310c5fa9 Use debug build for Android 2022-12-15 13:24:00 +01:00
Johannes Klein
4a20d8c9cc Remove patch-package dependency 2022-12-14 09:42:45 +01:00
Johannes Klein
d362e897eb Revert "Add patch-package to postinstall"
This reverts commit ca07bd18d6.
2022-12-14 09:40:27 +01:00
Johannes Klein
7324117869 266 flash icon change (#271)
* Add script to clean start
* Add function to camera mock
* Basic StandardCamera test setup
* Display flash off icon in camera
* Add accessibility labels to strings
* Change to use testID for tests
* Rename package script
* Update vision-camera mock
2022-12-13 15:41:46 -08:00
Ken-ichi Ueda
8a1733a9b3 Merge branch '250-e2e-init' of github.com:inaturalist/iNaturalistReactNative into 250-e2e-init 2022-12-13 15:07:58 -08:00
Ken-ichi Ueda
8dd57b01fe Removed react-native-exif, which is vestigial and causing Android test build failure 2022-12-13 15:07:37 -08:00
Johannes Klein
ca07bd18d6 Add patch-package to postinstall 2022-12-13 22:55:17 +01:00
Johannes Klein
eb81453e60 Merge branch 'main' into 250-e2e-init 2022-12-13 22:31:58 +01:00
Johannes Klein
6f100a728b Add Android scripts 2022-12-12 16:28:27 +01:00
Johannes Klein
b30c6f14bb Fix typo 2022-12-12 15:25:37 +01:00
Johannes Klein
108b7bcae1 Add patch-package dependency 2022-12-12 15:23:51 +01:00
Amanda Bullington
8a92fca2e8 Update obs list to use React Query, fetch observations via id_below (#273)
* Rewrite remote observation & update fetching using useQuery in ObsList
* Fix ObsList test by adding query provider
* Add padding to infinite scroll view indicator
* Only set next uuid for obslist if not still loading results from last api call
* Improve how ObsList works when observations don't fill screen
* Remove explore, explore provider, dropdown menu, and related screens; fix tests
* Move setIdBelow function into onEndReached
2022-12-09 12:17:26 -08:00
Amanda Bullington
8b7c98d04b Fully delete photos from ObsEditContext when adding evidence (#248)
* Remove photos from all relevant contexts when adding evidence and then deleting photos
* Update permissions library to fix iOS build errors:
* Use RN modal to gain access to context; move delete functionality into ObsEditProvider
2022-12-05 17:13:31 -08:00
Johannes Klein
8575d7fdc1 Rename scripts 2022-12-05 14:05:05 +01:00
Johannes Klein
0aab6108d9 Merge pull request #260 from inaturalist/e2e-init
E2e init
2022-12-04 18:57:42 +01:00
Johannes Klein
57142e0fa8 Remove Android configuration, not working 2022-12-04 18:55:36 +01:00
Johannes Klein
29580bba59 Add scripts 2022-12-04 18:51:49 +01:00
Johannes Klein
d783a6a4d4 Revert to jasmine2 test-runner for not e2e 2022-12-03 13:33:46 +01:00
Johannes Klein
005bbe8f01 Add detox and jest-circus 2022-12-03 13:16:08 +01:00
Johannes Klein
2533f94e08 Revert "Add detox and jest-circus"
This reverts commit 439f1dc994.
2022-12-03 13:13:59 +01:00
Johannes Klein
439f1dc994 Add detox and jest-circus 2022-12-03 02:16:57 +01:00
Johannes Klein
33df5a4eb0 Add react-native-gesture-handler test setup file 2022-12-02 23:13:41 +01:00
Amanda Bullington
e57ed1fdee Move notes input field above keyboard on focus (#252)
* Move optional notes text field above keyboard on focus
* Fix test with keyboard-aware mock
2022-11-30 14:14:26 -08:00
Angie
c1e845c620 198 usertext component (#237)
* UserText component. Closes #198.
* Replaced ActivityItem comment body with UserText. Wrote tests for UserText.

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-11-29 21:49:36 -08:00
budowski
4e5481a607 144 import photo exif (#168)
* #144 - when creating new observation, import first photo EXIF data for location + date
* #144 - usePhotoExif - read partial file data; added testing for usePhotoExif hook
* #144 - import photo exif - use our own react-native-exif-reader library + other fixes (not to automatically fetch location, save original uri)
* Do not save original photo URI in DB, only pass it along to obs edit screen for EXIF parsing
* Upgraded testing library version to support renderHook

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-11-28 20:58:34 -08:00
Amanda Bullington
3fbf6cff7c Fix obs detail comment input (#228)
* Separate AddCommentModal into its own component
* Use defaultValue instead of setting TextInput with value from state; styling fixes
* Fix for android build in build.gradle
* Styling fixes for text inputs
* Update bottom sheet mock to get tests passing
* Restore notes to same code as in main branch
2022-11-08 16:52:32 -08:00
Johannes Klein
99d306cd24 Realm 11 (#208)
This also upgrades us to React Native 0.70.4 and adds a number of files that get us ready for the New Architecture.

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-11-07 14:13:13 -08: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
e81894d406 Use authenticated queries for fetch/search requests (#195)
* Use authenticated query for search results
* Use search API for fetching places from Settings
* Use authenticated query for authorized applications
* Use authenticated query to fetch user.me
* Move fetch/search api calls into react query format, out of hooks
* Update with react query instead of hooks
* Fetch list of blocked and muted users with authenticated query
* Added Podfile postinstall block to get app running in a Simulator
* Use auth query in identify
* Upgrade Realm to 11.0.0-rc.0, most recent version that will work with RN 0.68.2
* Upgrade @realm/react library to 0.4.0; fixes initialization error on android due to importing realm
* Use authquery for explore provider
* ObsDetail wasn't showing the edit button for obs created while signed out
* simplified ObsEditHeader so it takes a full observation instead of relying
  on the ObsEditContext
* ObsEdit now accepts an obs UUID as a param and loads that if the context
  doesn't have a current obs
* null checks for API methods, mostly to prevent requests that won't work b/c
  of missing params

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-10-19 13:01:04 -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
Ken-ichi
c22d0fe79a Use RealmProvider (#183)
This attempts to remove the necessity of opening and closing Realm
connections, which can lead to stale connections and invalidated objects. I
did not try to remove direct access to realm from AuthenticatedService,
which exists outside of the component hierarchy and can't really access
context, but I think eventually we may want to bring all that functionality
within the component hierarchy so there really is only one Realm connection
in the app.

Probably still some bugs here. One major problem is that deleting the Realm
file does not seem to trigger a re-render of the RealmProvider. My workaround
was to delete all the data in RealmProvider connection to Realm before
deleting the file, but it seems kind of redundant.

Some other changes

* Updated react-native-image-resizer and worked around some regressions
* Needed to use Array.from on Realm collections in many places;
  map( o => o ) doesn't seem to work for creating POJOs from realm objects any more
* React Native Paper provider needs to be inside the Realm provider for any
  realm stuff to happen with rn paper modals
* Several workarounds for the fact that Realm objects don't behave like POJOs
* Added useApiToken hook (#158)
* Renamed the useUser hook to useRemoteUser, since that's what it was doing
2022-10-06 16:15:22 -07:00
Amanda Bullington
af8f17190d Keep toolbar sticky & collapse header on ObsList scroll (#182)
* Change bottom sheet modal to bottom sheet
* Give flatlist container a minHeight to make bottom sheet snap correctly when flatlist has few items
* Make entire header sticky above FlatList
* Hide header on scroll while keeping toolbar sticky on scroll
* Allow flatlist to scroll while bottom sheet modal up
* Use animated event on scroll with interpolation and stickyheaderindices to keep toolbar sticky while animating header
* Add accessibility label to logged out card

Closes #175
2022-09-27 16:20:13 -07:00
Amanda Bullington
337d812ab9 UI updates to bottom sheet (#181)
* Changes My Observations upload bottom sheet from modal to non-modal
* Give flatlist container a minHeight to make bottom sheet snap correctly when flatlist has few items
* Mock useLoggedIn hook in tests
* Move useCurrentUser to sharedHooks/ and mock in ObsList test
* Mock useUser hook
* Use useCurrentUser hook on user profile
* Downgrade gesture handler
2022-09-19 14:40:26 -07:00
Amanda Bullington
d892d755a7 Use React Query to simplify API requests (#166)
* Start using React Query to make remote data requests
* Renaming, standardized error handling from API calls, moving code
* Fixed messages test; changed useQuery mocking approach
* React Query should only retry for network issues
* Tried using useAuthenticatedRequest on TaxonDetail
* Clear the React Query cache on sign out

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-09-01 18:43:52 -07:00
Corey Farwell
4e054cf134 Fix NPM package version conflicts. (#172)
Prior to this commit, if I were to run `npm install` twice, I would get
this error:

```
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: inaturalistreactnative@0.1.1
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   react@"17.0.2" from the root project
npm ERR!   peer react@">= 16.8.0" from react-spring@8.0.27
npm ERR!   node_modules/react-spring
npm ERR!     react-spring@"^8.0.27" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^18.2.0" from react-dom@18.2.0
npm ERR! node_modules/react-dom
npm ERR!   peer react-dom@">= 16.8.0" from react-spring@8.0.27
npm ERR!   node_modules/react-spring
npm ERR!     react-spring@"^8.0.27" from the root project
```

Because `react-dom` was eagerly trying to upgrade `react-dom` to version
18, but we want to lock it to 17 to match our React version.
2022-08-30 17:58:55 -07:00
budowski
6e65faab64 Obs Detail comment input in bottom sheet modal
Closes #105

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-08-16 18:50:20 -07:00
Amanda Bullington
3d65b1e294 UI updates to bulk uploader (#128)
* UI updates to photo gallery

* Add filter icons to group photos

* Styling for carets, multiple ObsEdit

* Standardize kebab menu in shared component

* Fix bug in removePhotos; change selection to kebab menu

* Create delete obs dialog which deletes obs from bulk uploader obs edit

* UI tweaks; closes #100

* Add precommit hook to translate strings

* Fix styling for obs edit header; add fonts to xcode

* Fix lint errors

* Add safe area provider to test & app

* Fix tests
2022-07-18 14:44:20 -07:00
Ken-ichi
e929764c25 Adopted and enforced code style from other iNat Javascript projects
These rules are largely based on the AirBnB ones, which are not quite standard
for the React Native world, where Prettier seems to be more common, but I
think they add a lot of useful checks, and unlike Prettier we can customize
them. This also just makes it easier for people on the iNat team to work on
the mobile app.

Some specific changes:

* Added eslint-plugin-react-hooks to eslint rules
* Added eslint-plugin-simple-import-sort to eslint rules
* Bugfix: could not import photo from gallery
* Added support for react-native/no-inline-styles eslint rule
* useUser should not bother fetching a user for a blank userId
2022-07-13 13:55:59 -07:00
Amanda Bullington
3c7ac52eec Logged out state for MyObservations (#119)
* Show logged out green card at top of my obs screen when user logged out
* Allow user to save obs locally without being signed in; show number of unuploaded obs in top banner:
* Show login prompt in bottom sheet; hide sync button when logged out
* Upload prompt uses same styling as login prompt
* Delete realm file if user is installing app after deletion
* Code cleanup; add comment to checkForSignedInUser; closes #98
* Update eslint-config package
* Update RN maps
* Update styling for empty list
* Use third-party bottom sheet modal for login prompt & upload prompt
* Get tests passing via transformIgnorePatterns
2022-07-09 15:21:10 -07:00
Ken-ichi
90ff7a59c0 Fastlane setup for tagging, releasing, and internal testing (#118)
Configures fastlane to automate our current release process of making a git tag, making a git release, building, and pushing to the Play Store internal track and Testflight. See README.md for details on setup and usage.

Co-authored-by: Amanda Bullington <albullington@gmail.com>
2022-07-05 18:19:41 -07:00
budowski
4b4b0f9244 Add ID - initial commit (#103) (#113)
* Adds a component for adding identifications, both from Obs Detail and Obs Edit
* Minor style and eslint change to disallow all-caps string literals

Closes #103 

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-07-02 16:01:48 -07:00
Amanda Bullington
2e184b97f4 Enforce globalized text with eslint plugin (#120)
Add plugin to enforce globalized text with warnings; globalize some strings; closes #93
2022-07-01 12:42:24 -07:00