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

Enable seeking a recorded voice message #1758

Merged
merged 1 commit into from
Nov 10, 2023
Merged

Conversation

jonnyandrew
Copy link
Contributor

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Enable seeking the voice message player after recording a voice message.

Motivation and context

Screenshots / GIFs

Screen_recording_20231107_162647.webm

Tests

  • Record a voice message
  • Seek the preview player by tapping the waveform
  • Play a timeline voice message
  • Try seeking the preview player again in the same way

Tested devices

  • Physical
  • Emulator
  • OS version(s): 13

Checklist

@@ -323,6 +340,7 @@ class VoiceMessageComposerPresenterTest {
awaitItem().eventSink(VoiceMessageComposerEvents.PlayerEvent(VoiceMessagePlayerEvent.Play))
awaitItem().eventSink(VoiceMessageComposerEvents.SendVoiceMessage)
assertThat(awaitItem().voiceMessageState).isEqualTo(aPlayingState().toSendingState())
skipItems(1) // Duplicate sending state
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I needed to add this after this change but couldn't get to the bottom of why. The state flow still emits the exact same values in this test.

@jonnyandrew jonnyandrew marked this pull request as ready for review November 7, 2023 16:31
@jonnyandrew jonnyandrew requested a review from a team as a code owner November 7, 2023 16:31
@jonnyandrew jonnyandrew requested review from julioromano and removed request for a team November 7, 2023 16:31
Copy link
Contributor

github-actions bot commented Nov 7, 2023

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/gS8gHB

Copy link

@julioromano julioromano left a comment

Choose a reason for hiding this comment

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

Sorry if I'm being pedantic with changes to MediaPlayer.
The intent is to try to keep it as slim and simple as possible because that's the part which interfaces with the ExoPlayer beast which is missing tests.
So the more stuff we add here the more undetected issues we might have in the future.
We should probably think of building some tests so we can more freely enhance MediaPlayer but it is potentially cumbersome (currently in the tech debt list).

Copy link

codecov bot commented Nov 8, 2023

Codecov Report

Attention: 16 lines in your changes are missing coverage. Please review.

Comparison is base (5d2770a) 63.36% compared to head (93cb444) 63.40%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1758      +/-   ##
===========================================
+ Coverage    63.36%   63.40%   +0.03%     
===========================================
  Files         1292     1292              
  Lines        33502    33568      +66     
  Branches      6971     6981      +10     
===========================================
+ Hits         21230    21284      +54     
- Misses        9086     9088       +2     
- Partials      3186     3196      +10     
Files Coverage Δ
.../impl/voicemessages/timeline/VoiceMessagePlayer.kt 72.91% <100.00%> (ø)
...ies/textcomposer/components/VoiceMessagePreview.kt 74.32% <100.00%> (ø)
.../libraries/voicerecorder/api/VoiceRecorderState.kt 100.00% <ø> (ø)
...messages/composer/VoiceMessageComposerPresenter.kt 86.90% <90.90%> (-7.84%) ⬇️
...icemessages/composer/VoiceMessageComposerPlayer.kt 85.10% <83.90%> (+7.32%) ⬆️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jonnyandrew jonnyandrew force-pushed the jonny/vm-seek-preview branch from 94a9efa to 93cb444 Compare November 9, 2023 16:52
Copy link

sonarqubecloud bot commented Nov 9, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

import java.io.File
import kotlin.time.Duration

@Immutable

Choose a reason for hiding this comment

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

Just for my info: What does this do? I mean, what wasn't working well before that prompted you to add this?

Copy link
Contributor Author

@jonnyandrew jonnyandrew Nov 10, 2023

Choose a reason for hiding this comment

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

IIRC it was flagged as a problem when I added VoiceRecorderState as a parameter to a composable function here. It's a class from another module that wasn't built with the compose compiler so the stability couldn't be inferred (see here for more info).


private suspend fun MediaPlayer.ensureMediaReady(mediaPath: String): MediaPlayer.State {
val state = state.value
if (state.mediaId == mediaPath && state.isReady) {

Choose a reason for hiding this comment

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

Sorry about not checking for this properly in the MediaPlayer. I've opened this: #1783

@jonnyandrew jonnyandrew merged commit 14be887 into develop Nov 10, 2023
19 checks passed
@jonnyandrew jonnyandrew deleted the jonny/vm-seek-preview branch November 10, 2023 09:18
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.

2 participants