fix(android): enforce single active voice player in chat info tab
Some checks failed
Android CI / android (push) Has started running
Android Release / release (push) Has been cancelled
CI / test (push) Has been cancelled

This commit is contained in:
Codex
2026-03-10 21:07:53 +03:00
parent 3844875d36
commit f8ed889170

View File

@@ -2996,6 +2996,8 @@ private fun ChatInfoTabContent(
return
}
if (tab == ChatInfoTab.Voice) {
var voiceTabActiveSourceId by remember(entries) { mutableStateOf<String?>(null) }
var voiceTabForceStopSourceId by remember(entries) { mutableStateOf<String?>(null) }
LazyColumn(
modifier = Modifier
.fillMaxWidth()
@@ -3052,11 +3054,28 @@ private fun ChatInfoTabContent(
playbackTitle = entry.title,
playbackSubtitle = entry.subtitle,
messageId = entry.sourceMessageId ?: entry.title.hashCode().toLong(),
onPlaybackChanged = {},
forceStopAudioSourceId = null,
onPlaybackChanged = { playback ->
if (playback.isPlaying) {
val previous = voiceTabActiveSourceId
if (previous != null && previous != playback.sourceId) {
voiceTabForceStopSourceId = previous
}
voiceTabActiveSourceId = playback.sourceId
} else if (voiceTabActiveSourceId == playback.sourceId) {
voiceTabActiveSourceId = null
}
},
forceStopAudioSourceId = voiceTabForceStopSourceId,
forceToggleAudioSourceId = null,
forceCycleSpeedAudioSourceId = null,
onForceStopAudioSourceHandled = {},
onForceStopAudioSourceHandled = { sourceId ->
if (voiceTabForceStopSourceId == sourceId) {
voiceTabForceStopSourceId = null
}
if (voiceTabActiveSourceId == sourceId) {
voiceTabActiveSourceId = null
}
},
onForceToggleAudioSourceHandled = {},
onForceCycleSpeedAudioSourceHandled = {},
)