Skip to content
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

Single source of truth for camera settings #122

Merged
merged 6 commits into from
Feb 29, 2024

Conversation

temcguir
Copy link
Collaborator

@temcguir temcguir commented Feb 23, 2024

  • Update CameraUseCase to reactive model
  • CameraUseCase is only place where default settings will be applied
  • PreviewViewModel should not edit CameraAppState
  • Setting aspect ratio and flipping camera no longer restarts camera job

 CameraUseCase (and CameraXCameraUseCase implementation) will now hold on
 to CameraAppSettings and react to changes in those settings which are
 initiated through the CameraUseCase API.
 CameraAppState is now owned by CameraUseCase. It will have the single source of
 truth, and PreviewViewModel will only communicate changes through PreviewUiState,
 it will not edit CameraAppState directly.
 The camera job is started once by runCamera(), any changes that restart
 the camera will happen contained inside this coroutine. We no longer need
 to explicitly stop the camera before applying changes that would normally
 restart the camera.
 Also changes FakeCameraUseCase to use a similar reactive model
 to CameraXCameraUseCase
@temcguir temcguir merged commit 3ef520a into main Feb 29, 2024
4 checks passed
@temcguir temcguir deleted the temcguir/consistent_camera_settings branch February 29, 2024 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Camera switches direction when switching to single-stream mode and flip camera button fails on first attempt
3 participants