Repository navigation
fix(media): open the attachment that was tapped - #17
Merged
Merged
Conversation
The viewer and the chat-info gallery both build their list from `viewableMedia`, which required `downloadStatus == ready`. Attachments that carry a stale failed/expired flag (left behind by the old re-download bug) were therefore missing from both lists, while the bubbles drew them from their local file anyway. Tapping such a bubble looked up an index in a list that did not contain it, fell back to 0 and opened the newest attachment in the conversation — often a video. The same filter is why those attachments never showed up under shared media. A local file is what makes an attachment viewable now; the status only decides what to show while there is none. That also covers album items. The viewer stops guessing as well: when the tapped attachment is not in the list it shows that attachment alone instead of page 0. Verified on the running debug build: the chat-info grid went from one tile to seven for the same conversation, an image tile opens an image and the video tile opens the video player.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Symptom: tapping an attachment opened a different one (a video in the razj chat), and those attachments were missing from chat info → shared media.
Root cause: the viewer and the shared-media grid both build their list from
viewableMedia, which requireddownloadStatus == ready. Attachments carrying a stale failed/expired flag — left behind by the re-download bug fixed in #15 — were dropped from both lists while the bubbles kept drawing them from their local file. Tapping such a bubble looked up its index in a list that did not contain it, fell back to 0 and opened the newest attachment in the conversation, which happened to be a video.Fix:
Verified on the running debug build (Android emulator, Flutter MCP toolkit + hot reload):
imagepage, tapping the video tile opens the video player (00:04 / 00:04controls).Verification:
flutter analyze --no-fatal-infosclean,flutter test153/153.