Skip to content

Fix camera permission refresh - #20

Merged
krishna3554 merged 1 commit into
mainfrom
codex/fix-camera-access-detection-issue
May 14, 2026
Merged

krishna3554 merged 1 commit into
mainfrom
codex/fix-camera-access-detection-issue

Conversation

@krishna3554

Copy link
Copy Markdown
Owner

Motivation

  • The camera preview could remain stuck on the permission gate even after the user granted access, because the app relied on an initial permissionsGranted value and did not re-check camera access at runtime.
  • Microphone/location permission requests could block startup camera initialization; the intent is to allow the camera to initialize when camera access is granted and avoid unrelated permission failures preventing detection.

Description

  • Change AppPermissionHandler.requestAllPermissions to return success based on the camera grant and request location with locationWhenInUse instead of locationAlways, and add hasCameraPermission() for status checks.
  • Add runtime camera-permission handling to the camera UI by introducing _hasCameraPermission, _checkCameraPermissionAndInit() and _requestCameraPermission() in CameraScreen, and show the permission UI until camera access is available.
  • Catch CameraException access-denied codes and flip to the permission UI so the app no longer stays in the same state when access is denied or later granted.
  • Initialize the CameraController with enableAudio: false and trigger a permission re-check and camera initialization in didChangeAppLifecycleState when the app resumes, and use openAppSettings() only for permanently denied/restricted camera states.

Testing

  • Ran git diff --check to verify no whitespace/errors reported; this passed.
  • Attempted dart format lib/core/utils/permission_handler.dart lib/features/camera/screen/camera_screen.dart but the dart tool is not available in this environment so formatting was not executed.
  • No automated Flutter unit/widget tests were run in this environment.

Codex Task

@krishna3554
krishna3554 merged commit 4c53672 into main May 14, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant