inaturalist / iNaturalistReactNative

Cross-platform version of the iNat mobile app
MIT License
59 stars 19 forks source link

Online suggestions location permissions #1755

Closed albullington closed 1 month ago

albullington commented 2 months ago

More changes to the online suggestions screen.

This screen is the default state for all users when they first use the app - a user should not see any location permissions modals in the app without opting in (see https://github.com/inaturalist/iNaturalistReactNative/issues/1594)

This is split off from the bigger enhancement issue with changes to suggestions (https://github.com/inaturalist/iNaturalistReactNative/issues/1592) because it's dependent on the changes to permissions issue (https://github.com/inaturalist/iNaturalistReactNative/issues/1594). Once that is finished, we'll be able to prompt a user for location permissions on Suggestions when coming from the AICamera or StandardCamera.

jtklein commented 1 month ago

As exemplified here const { hasPermissions, renderPermissionsGate, requestPermissions } = useLocationPermission( ); I have added a hook to check for location permission now. You can use the hasPermissions variable for conditional rendering of components that should only show with or without location permission.

This line renders the PermissionGate, and you can add callbacks there if you have to react to the permission being granted for example. Example with callbacks here.