Use the sensors in your mobile devices to perform science experiments. Science doesn’t just happen in the classroom or lab—tools like Science Journal let you see how the world works with just your phone.
The app asks for camera permission after starting a recording for the first time. As it's not the right time to do that I made a refactor to fix it.
Description
The current implementation asks for camera permission just to know if the camera access is available. I split the two use cases in CameraAccessHandler:
static var hasGrantedAccess: Bool
returns the state without asking for the permission the first time.
Checklist
Motivation and Context
The app asks for camera permission after starting a recording for the first time. As it's not the right time to do that I made a refactor to fix it.
Description
The current implementation asks for camera permission just to know if the camera access is available. I split the two use cases in
CameraAccessHandler
:returns the state without asking for the permission the first time.
checks the permission state and request for it if it's
.notDetermined
. The result is handled via a callback that can be asynchronous.Then I modified all the points in the app where these APIs were used.