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

[SES-637] - Stop playing message if deleted #1487

Merged

Conversation

simophin
Copy link

@simophin simophin commented May 17, 2024

First time contributor checklist

Contributor checklist

  • I have tested my contribution on these devices:
  • Device A, Android X.Y.Z
  • Device B, Android Z.Y
  • Virtual device W, Android Y.Y.Z
  • My contribution is fully baked and ready to be merged as is
  • I ensure that all the open issues my contribution fixes are mentioned in the commit message of my first commit using the Fixes #1234 syntax

Description

@simophin simophin requested review from AL-Session and bemusementpark and removed request for AL-Session May 17, 2024 04:10
@@ -103,6 +103,7 @@ import org.thoughtcrime.securesms.ApplicationContext
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
import org.thoughtcrime.securesms.attachments.ScreenshotObserver
import org.thoughtcrime.securesms.audio.AudioRecorder
import org.thoughtcrime.securesms.audio.AudioSlidePlayer

Choose a reason for hiding this comment

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

revert?

Copy link
Author

Choose a reason for hiding this comment

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

Yep. We should def put in some automation for the code standard :-)

override fun onCleared() {
super.onCleared()

// Stop all voice message when existing the convo page

Choose a reason for hiding this comment

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

typo

Copy link
Author

Choose a reason for hiding this comment

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

Good catch!

message is MmsMessageRecord &&
message.slideDeck.audioSlide == audioSlide) {
player.stop()
}

Choose a reason for hiding this comment

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

May as well defer getInstance to when it is necessary as it's synchronized.

val mmsMessage = message as? MmsMessageRecord ?: return
val audioSlide = mmsMessage.slideDeck.audioSlide ?: return
AudioSlidePlayer.getInstance()?.takeIf { it.audioSlide == audioSlide }?.stop()

Copy link
Author

Choose a reason for hiding this comment

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

Sure let's do that

Copy link
Collaborator

@AL-Session AL-Session left a comment

Choose a reason for hiding this comment

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

All looks fine to me.

@ThomasSession ThomasSession merged commit 46358f4 into oxen-io:dev Jun 21, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants