-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: CameraX AndroidView + PreviewView -> Composable CameraXViewfinder로 전환 #265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
…CameraXViewfinder로 전환
WalkthroughCameraX 통합 방식을 AndroidView 기반 CameraController에서 Compose 기반 ProcessCameraProvider로 마이그레이션했습니다. 의존성 선언을 업데이트하고 카메라 프리뷰 구현을 CameraXViewfinder로 변경했으며, 이미지 캡처 로직을 조정했습니다. Changes
Sequence Diagram(s)sequenceDiagram
participant App as 앱
participant Provider as ProcessCameraProvider
participant Preview as Preview
participant Capture as ImageCapture
participant Viewfinder as CameraXViewfinder
App->>Provider: awaitInstance() 요청
Provider-->>App: Provider 반환
App->>Preview: Preview 생성
App->>Capture: ImageCapture 생성
App->>App: surfaceRequest 상태 업데이트
Viewfinder->>App: surfaceRequest 구독
App->>Provider: Preview + ImageCapture 바인딩
Provider-->>Preview: 카메라 프레임 제공
Preview-->>Viewfinder: 프레임 렌더링
App->>Capture: takePicture() 호출
Capture-->>App: 캡처 완료 콜백
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
feature/record/build.gradle.kts (1)
13-23:⚠️ Potential issue | 🟡 Minorfeature 모듈에 camera-compose 직접 선언은 타당합니다.
카메라 Compose 전환에 맞춘 적절한 의존성 추가이며, camera-compose는 1.5.1부터 안정화되었습니다. 다만 버전을 현재 최신 안정화 버전인 1.5.3(2026년 1월 28일 릴리스)으로 업데이트하는 것을 권장합니다. 1.5.3에는 ExifInterface 관련 JPEG 파싱 문제 수정이 포함되어 있습니다.
🧹 Nitpick comments (1)
feature/record/src/main/kotlin/com/ninecraft/booket/feature/record/ocr/content/OcrCameraContent.kt (1)
133-144: 카메라 바인딩 실패 시 에러 처리가 누락되었습니다.
bindToLifecycle이 실패할 경우(예: 카메라가 다른 앱에서 사용 중이거나 하드웨어 오류) 예외가 발생할 수 있습니다. try-catch로 감싸서 사용자에게 적절한 피드백을 제공하는 것을 권장합니다.♻️ 에러 처리 추가 제안
LaunchedEffect(isGranted) { if (!isGranted) return@LaunchedEffect - ProcessCameraProvider.awaitInstance(context).apply { - unbindAll() - bindToLifecycle( - lifecycleOwner, - CameraSelector.DEFAULT_BACK_CAMERA, - preview, - imageCapture, - ) + try { + ProcessCameraProvider.awaitInstance(context).apply { + unbindAll() + bindToLifecycle( + lifecycleOwner, + CameraSelector.DEFAULT_BACK_CAMERA, + preview, + imageCapture, + ) + } + } catch (e: Exception) { + // 카메라 바인딩 실패 처리 (예: 에러 이벤트 전송) + // state.eventSink(OcrUiEvent.OnCameraBindingFailed(e)) } }
🔗 관련 이슈
📙 작업 설명
🧪 테스트 내역 (선택)
💬 추가 설명 or 리뷰 포인트 (선택)
lifecycle에 바인딩하는 역할
Composable에 전달하는 역할
reference)
Compose-Native CameraX Is Now Stable: End-to-End Guide for Jetpack Compose
[Android/Compose] CameraX 사용해서 QR 코드 스캔하기
Summary by CodeRabbit