mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-10 19:27:08 +00:00
da9b69ca0b
* android, desktop: open correct image in fullscreen viewer Fullscreen image viewer occasionally opened a different image than the one clicked. Root cause: when the LaunchedEffect probe at ImageFullScreenView.kt:48-55 calls getMedia(initialIndex - 1) to check whether a previous media item exists, getMedia returns null for both "no item" and "item found but failed to load" (e.g. undecodable bytes, missing file, crypto error). The probe treated null as "no previous item" and called scrollToStart(), which rewrote initialChatId to the chat's oldest media item - making the viewer display that oldest item instead of the clicked one. Fix: scrollToStart() no longer rewrites initialChatId. The pager is still repositioned to page 0; getMedia(0) resolves against the already-set initialChatId (the clicked item) and renders it correctly. * android, desktop: regression test for fullscreen viewer anchor preservation Drives the public providerForGallery interface: moves the anchor away from cItemId via currentPageChanged, calls scrollToStart, then reads the anchor back through onDismiss's scrollTo callback. The pre-fix code rewrote initialChatId to the chat's oldest showable, which would surface as scrollTo(2); the fix preserves the anchor and produces scrollTo(1). * plan: design doc for fullscreen viewer wrong-image fix Documents the pager state model, the root cause of the wrong-image bug, why the one-line deletion in scrollToStart fixes it for both call sites, and why the wider getMedia null-overload refactor is deliberately out of scope for this fix.