-
Notifications
You must be signed in to change notification settings - Fork 28
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
fix: audio message filter toggle (WPB-6406) #2847
Conversation
…ould apply effects changes from checkbox and play audio when needed
… to fully test the viewModel
@@ -118,7 +118,7 @@ class RecordAudioMessagePlayer @Inject constructor( | |||
suspend fun playAudio( | |||
audioFile: File | |||
) { | |||
if (currentAudioFile != null) { | |||
if (currentAudioFile != null && audioFile.name == currentAudioFile?.name) { |
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.
If current file name is different from what we receive, then we reset the media player and continue with the new received file
fun setApplyEffectsAndPlayAudio(enabled: Boolean) { | ||
setShouldApplyEffects(enabled = enabled) | ||
if (state.audioState.audioMediaPlayingState is AudioMediaPlayingState.Playing) { | ||
onPlayAudio() | ||
} | ||
} |
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.
Created in order to continue playing the audio if it was being played before, otherwise we just ignore the player and just update the checkbox value
if (state.shouldApplyEffects) { | ||
val result = AudioEffect(context) | ||
.applyEffectM4A( | ||
state.originalOutputFile!!.path, | ||
state.effectsOutputFile!!.path, | ||
AudioEffect.AVS_AUDIO_EFFECT_VOCODER_MED, | ||
true | ||
) | ||
|
||
if (result > -1) { | ||
appLogger.i("[$tag] -> Audio file with effects generated successfully.") | ||
} else { | ||
appLogger.w("[$tag] -> There was an issue with generating audio file with effects.") | ||
} | ||
} |
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.
moved to usecase so this viewmodel could continue being tested throughout, as we can't mock AVS AudioEffect
Test Results878 tests 878 ✅ 12m 10s ⏱️ Results for commit 18e8368. ♻️ This comment has been updated with latest results. |
APKs built during tests are available here. Scroll down to Artifacts! |
Build 3907 succeeded. The build produced the following APK's: |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2847 +/- ##
===========================================
+ Coverage 43.73% 43.76% +0.03%
===========================================
Files 422 423 +1
Lines 14086 14066 -20
Branches 2544 2501 -43
===========================================
- Hits 6160 6156 -4
+ Misses 7203 7193 -10
+ Partials 723 717 -6
... and 12 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Build 3916 succeeded. The build produced the following APK's: |
APKs built during tests are available here. Scroll down to Artifacts! |
PR Submission Checklist for internal contributors
The PR Title
SQPIT-764
The PR Description
What's new in this PR?
Issues
Wrong handling of checkbox to apply filters
Causes (Optional)
Misunderstood of ACs caught only after design review
Solutions
AudioEffect.applyEffectM4A(..)
to a separate use case in order to fully test the view model (as we cannot mock/test this class)Testing
Test Coverage (Optional)
How to Test
Note: audio will continue from last position when selecting/unselecting the checkbox (meaning if audio is 50% listen and checkbox is selected, then it will continue from 50% of it)