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

Fixes broken resumePlayback for Message LongPress #13913

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ class VoiceNoteMediaController(val activity: FragmentActivity, private var postp
inner class PlaybackStateListener : Player.Listener {
override fun onEvents(player: Player, events: Player.Events) {
super.onEvents(player, events)
if (events.contains(Player.EVENT_PLAYBACK_STATE_CHANGED)) {
if (events.contains(Player.EVENT_PLAYBACK_STATE_CHANGED) || events.contains(Player.EVENT_IS_PLAYING_CHANGED)) {
if (!isActivityResumed()) {
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3237,7 +3237,7 @@ class ConversationFragment :

binding.conversationItemRecycler.suppressLayout(false)
if (selectedConversationModel.audioUri != null) {
getVoiceNoteMediaController().resumePlayback(selectedConversationModel.audioUri, messageRecord.getId())
getVoiceNoteMediaController().resumePlayback(selectedConversationModel.audioUri, messageRecord.id)
}

WindowUtil.setLightStatusBarFromTheme(requireActivity())
Expand Down Expand Up @@ -3307,12 +3307,12 @@ class ConversationFragment :
}

private fun MessageRecord.getAudioUriForLongClick(): Uri? {
val playbackState = getVoiceNoteMediaController().voiceNotePlaybackState.value
if (playbackState == null || !playbackState.isPlaying) {
if (!hasAudio()) {
return null
}

if (hasAudio() || !isMms) {
val playbackState = getVoiceNoteMediaController().voiceNotePlaybackState.value
if (playbackState == null || !playbackState.isPlaying) {
return null
}

Expand Down