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

Adding support for voice drafts #4558

Merged
merged 2 commits into from
Nov 30, 2021
Merged

Adding support for voice drafts #4558

merged 2 commits into from
Nov 30, 2021

Conversation

ouchadam
Copy link
Contributor

@ouchadam ouchadam commented Nov 24, 2021

Fixes #3922 Continuation of @onurays #4237 rebased and squashed with all of the refactors around the VoiceMessageRecorderView and MessageComposerViewModel refactors (and also #4527)

  • Introduces a UserDraft.Voice and SendMode.Voice in order to differentiate between audio messages
  • Handles drafts as part of the moving to background flow (when not rotating)
  • Adds an initialisation step to preload the voice recorder
  • Simplifies the VoiceRecordingView callbacks to have explicit actions instead of exposing internal RecordingUiStates
BEFORE AFTER
before-voice-draft after-voice-draft

data class Quote(val linkedEventId: String, val content: String) : UserDraft
data class Edit(val linkedEventId: String, val content: String) : UserDraft
data class Reply(val linkedEventId: String, val content: String) : UserDraft
data class Voice(val content: String) : UserDraft
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Voice has been added, the other diff changes are caused by text being renamed to content

private fun handlePauseRecordingVoiceMessage() {
voiceMessageHelper.pauseRecording()
}

private fun handleEntersBackground(composerText: String) {
val isVoiceRecording = com.airbnb.mvrx.withState(this) { it.isVoiceRecording }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we want the synchronous state reading here as we need to act during onPause and clear any view state (clearTracker) whilst on the main thread

if we do this async then we can end up removing the waveforms due to clearTracker triggering after the reinitialising the views

@github-actions
Copy link

github-actions bot commented Nov 24, 2021

Unit Test Results

  66 files  ±0    66 suites  ±0   1m 0s ⏱️ +11s
135 tests ±0  135 ✔️ ±0  0 💤 ±0  0 ±0 
418 runs  ±0  418 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit aaba628. ± Comparison against base commit 8fd5e42.

♻️ This comment has been updated with latest results.

@ouchadam ouchadam changed the base branch from feature/adm/voice-base to develop November 29, 2021 10:45
- introduces a new Voice draft and sender mode type
- initializes the voice recorder with a previously recorded file (the draft)
- renames RecordingUiStates to map to their actual UI states
@ouchadam ouchadam force-pushed the feature/adm/voice-draft branch from c69fa49 to aaba628 Compare November 30, 2021 10:27
Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks. I will do more test once merged on develop.

@bmarty bmarty merged commit 3a8fd42 into develop Nov 30, 2021
@bmarty bmarty deleted the feature/adm/voice-draft branch November 30, 2021 19:44
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.

Voice messages: Persist drafts of voice messages when navigating between rooms
2 participants