Repository navigation
fix(android): discard audio prepared after leaving chat - #432
plotarmordev wants to merge 1 commit into
Conversation
[Low impact] The change is limited to Android audio cards in chat. The code change looks sound, but the required Android check against a real host must be completed before merging. Findings
SummaryType: bug fix | Areas: Android, web, docs | Priority: P2: medium Prevents Android audio from starting when preparation finishes after its card is released.
plotarmordev explicitly deferred the version bump and release-note files to release and supplied Android release-note bullets. Reviews (1) · Last reviewed commit: "fix(android): discard audio prepared aft..." · Reviewed by Greptile |
| @Test fun `a card released while its sound prepares releases it without playing`() = runBlocking { | ||
| val opening = CompletableDeferred<Unit>() | ||
| val prepared = CompletableDeferred<Sound>() | ||
| val audio = SharedAudio(load = { File("note.m4a") }, open = { _, _ -> | ||
| opening.complete(Unit) | ||
| prepared.await() | ||
| }) |
There was a problem hiding this comment.
Real playback remains unchecked
The new test covers the delayed return from open, but the PR reports no Android emulator run against a real host. The repository requires end-to-end checks on the affected client, not only unit tests.
Keep this deterministic regression test, then check normal playback and leaving the chat in the Android app against a real host. Add the results to Validation before merging. The emulator check does not need to reproduce the exact race.
Context Used: Codync is a monorepo: host/ (Rust host, owns the logic), apps/ios (SwiftUI), apps/android (Kotlin + Compose), apps/desktop (Electron + React), host/src/tui (terminal UI), relay/, cloud/, web/, docs/. Follow CLAUDE.md and AGENTS.md. Start the PR summ... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
A small follow-up to #364 (voice notes and audio in chat), Android only.
On Android, if you left a chat while a voice note was still loading, the player could finish preparing after its card was gone and start playing with nothing on screen to stop it.
SharedAudionow checks whether the card was released when the player comes back from preparing; if so, it releases that player right away and never starts it.SharedAudio.kt: release a player that finishes preparing after the card was released, instead of keeping and starting it.SharedAudioTest.kt: a regression test that releases a card while its sound prepares, then checks that the player is released, never plays, and that a second release does nothing.docs/features/file-attachments.mdand the user manual'sweb/content/docs/conversations.mdx.iPhone and desktop are unaffected: they already drop a note that loads after its card is gone, and #364's iPhone tests cover a card closed mid-load. The terminal UI doesn't play audio.
I left the version bump and the
WhatsNew.mdsections for you to add when you release; my release notes are below.Validation
:app:testDebugUnitTestpasses withSharedAudioTestat 10/10, including the new test.What's New: iPhone
zh-Hant
en-US
What's New: Android
zh-Hant
en-US