-
Notifications
You must be signed in to change notification settings - Fork 171
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
[SES-637] - Stop playing message if deleted #1487
Conversation
@@ -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 |
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.
revert?
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.
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 |
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.
typo
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.
Good catch!
message is MmsMessageRecord && | ||
message.slideDeck.audioSlide == audioSlide) { | ||
player.stop() | ||
} |
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.
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()
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.
Sure let's do that
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.
All looks fine to me.
First time contributor checklist
Contributor checklist
Fixes #1234
syntaxDescription