Skip to content

fix: image upload stalls and edit-listing keyboard flicker - #105

Merged
DCT-Berinyuy merged 2 commits into
devfrom
fix/image-upload-compression
Oct 26, 2026
Merged

DCT-Berinyuy merged 2 commits into
devfrom
fix/image-upload-compression

Conversation

@DCT-Berinyuy

Copy link
Copy Markdown
Collaborator

Summary

Fixes two problems reported by Play testers:

  1. Image uploads stuck on the spinner. Listing photos were uploaded at full camera size. On 2026-10-09 they averaged about 8.5 MB, and the largest was 11.7 MB. Uploads of that size stall on mobile data, and the old code had no timeout, so the spinner never stopped. When these photos are shown full-size in the feed, they also pushed the Supabase free-plan cached egress quota to 115% (5.74 / 5 GB).
  2. Edit-listing keyboard flicker / white screen. My Books and Listing details opened the editor with context.push('/sell', extra: listing). /sell is a route inside the bottom-nav shell, and pushing it from a root-level screen duplicates the shell navigator's page keys. When the keyboard opens, the router rebuilds and the form is remounted. The field loses focus, so the keyboard closes, and sometimes the screen goes blank. A widget test reproduced this as the navigator assertion !keyReservation.contains(key).

Closes #

Changes

  • sell_viewmodel.dart: picked photos from the gallery or camera are resized to at most 1600 px at JPEG quality 70. These are the same settings ID verification already uses.
  • supabase_storage_data_source.dart:
    • Book and profile uploads time out after 60 s.
    • TimeoutException, SocketException and ClientException now map to clear "timed out" or "no connection" messages.
    • The book upload uses the injected client instead of Supabase.instance.
  • listing_card.dart and listing_image_carousel.dart: images load through cached_network_image, a new dependency, which caches them on disk. Cards decode at 600 px.
  • router.dart: new root-level /edit-listing route (it redirects to /my-books if there is no listing) and /new-listing route.
    • Listing details and My Books now use these routes.
    • The FAB's /sell push from inside the shell was tested and is unaffected, so it is unchanged.

Test plan

  • flutter analyze: no new issues. It still exits 1 on 3 existing issues in supabase_auth_data_source.dart and main.dart, which this PR does not touch.
  • flutter test: 316 tests passed.
    • New: test/features/listings/data/datasources/supabase_storage_data_source_test.dart covers upload success, the timeout, and DNS/socket failures.
    • New: test/config/root_form_routes_test.dart checks that the form keeps focus and is not remounted when the keyboard opens.
  • cargo fmt, cargo clippy, and cargo test pass (Rust core changes): N/A
  • New migrations are idempotent and tested against a local or branch database: N/A
  • Not yet tested on a device. Smoke test on Android: upload a camera photo, edit a listing, and type in each field.

Checklist

  • Targets dev, not main
  • No secrets, keys, or personal data in code, logs, or screenshots
  • User input is validated; new tables have RLS policies (no new tables)
  • User-facing strings added to both EN and FR ARB files. The new upload error messages are English-only in the data layer, like the existing "Upload failed" messages.
  • Docs updated if behavior changed (route comments)

Screenshots

N/A

DCT-Berinyuy and others added 2 commits October 11, 2026 00:54
Phone cameras produce 8-12 MB photos that stalled uploads on mobile data
and drained the cached-egress quota when shown full-size in the feed.

- Resize picked photos to 1600px at JPEG quality 70
- Time out uploads after 60s and map network failures to clear messages
- Show feed and carousel images through a disk cache

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
My Books and Listing details pushed the shell's /sell route from outside
the shell, duplicating navigator page keys. Opening the keyboard then
remounted the form (keyboard closed) or blanked the screen. Use new
root-level /edit-listing and /new-listing routes instead.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@vercel

vercel Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
book-bridge Ready Ready Preview Oct 10, 2026 11:55pm UTC

@DCT-Berinyuy
DCT-Berinyuy merged commit bd565fb into dev Oct 26, 2026
3 checks passed
This was referenced Oct 26, 2026

This branch was successfully deployed

1 active deployment
Preview — db7d090c Deployed Oct 10, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant