Move viewfinder to ViewModel - #715
Merged
thestinger merged 28 commits intoSep 22, 2026
Merged
thestinger merged 28 commits into
thestinger merged 28 commits into
Conversation
m4pl
force-pushed
the
task/709-viewfinder-to-viewmodel
branch
2 times, most recently
from
September 15, 2026 19:53
b99448b to
4781576
Compare
m4pl
marked this pull request as ready for review
September 15, 2026 21:40
m4pl
marked this pull request as draft
September 16, 2026 22:10
m4pl
marked this pull request as ready for review
September 17, 2026 10:20
sdsantos
approved these changes
Sep 17, 2026
| } else { | ||
| View.GONE | ||
| } | ||
| if (!mActivity.videoCapturer.includeAudio) { |
There was a problem hiding this comment.
I can't reach this state to test, the settings toggle looks to be disabled when recording. But I guess this can just be a double-check.
m4pl
force-pushed
the
task/709-viewfinder-to-viewmodel
branch
from
September 17, 2026 20:57
22521a0 to
493840f
Compare
thestinger
force-pushed
the
compose-prototype
branch
from
September 22, 2026 13:36
8c53a77 to
312374f
Compare
RankoR
suggested changes
Sep 22, 2026
|
|
||
| isRecording = false | ||
|
|
||
| viewfinder.onAction(CaptureAction.RecordingStopped) |
Contributor
There was a problem hiding this comment.
A destroyed Activity can overwrite the replacement Activity's recording state
- Activity A starts recording A.
- Configuration recreation calls
onStop(), requesting A's recording to stop. - Activity B attaches to the retained ViewModel and starts recording B.
- A's asynchronous
Finalizecallback reaches VideoCapturer.kt:227. - The old capturer sends an unqualified
RecordingStoppedaction into the shared ViewModel. - B continues recording, but the UI is reset to “Start recording” and “Flip camera”; the video-only gallery button can also reappear.
Need to allow finalization and media cleanup to finish, but reject UI/state notifications from destroyed or detached Activity owners
| scope.launch { | ||
| applicationScope.launch(defaultDispatcher) { | ||
| try { | ||
| capturedItemRepository.saveLastCapturedItem(item) |
Contributor
There was a problem hiding this comment.
Should be single-threaded, otherwise an older one can overwrite a newer one.
m4pl
force-pushed
the
task/709-viewfinder-to-viewmodel
branch
from
September 22, 2026 18:29
493840f to
e442ee3
Compare
m4pl
force-pushed
the
task/709-viewfinder-to-viewmodel
branch
from
September 22, 2026 18:42
e442ee3 to
5317f4d
Compare
m4pl
force-pushed
the
task/709-viewfinder-to-viewmodel
branch
from
September 22, 2026 18:47
5317f4d to
ef55f96
Compare
RankoR
approved these changes
Sep 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #709