Skip to content

refactor(ui): attachment upload and gallery improvements#2612

Open
xsahil03x wants to merge 4 commits intov10.0.0from
refactor/attachment-gallery
Open

refactor(ui): attachment upload and gallery improvements#2612
xsahil03x wants to merge 4 commits intov10.0.0from
refactor/attachment-gallery

Conversation

@xsahil03x
Copy link
Copy Markdown
Member

Description of the pull request

  • Fix attachment upload failure on iOS: The picker close animation (introduced in feat(ui): animate attachment picker + close on back press #2588) deferred listener cleanup by 200ms, causing _syncMessageToPicker to fire during controller.reset() in sendMessage(). This deleted cached attachment files from disk before the upload could read them, resulting in PathNotFoundException. Fixed by splitting picker lifecycle into _startPickerSync / _stopPickerSync / _disposePickerController and detaching sync listeners immediately in _hidePicker.

  • Make toMultipartFile resilient to missing paths: Try path-based MultipartFile creation first, fall back to bytes when the path is inaccessible (e.g. short-lived iOS photo library exports). Throws a descriptive StateError if both are unavailable.

  • Simplify gallery layout for two attachments: Use a strict 50/50 width split for mixed-orientation and both-portrait image pairs instead of the previous 2:1 ratio.

  • Make maxAttachmentCount optional: A null value means no limit is enforced, removing the kDefaultMaxAttachmentCount constant and the ternary branch in _showPicker.

Try path-based MultipartFile creation first, falling back to bytes
when the path is inaccessible (e.g. short-lived iOS photo library
exports). Throws a descriptive StateError if both are unavailable.

Made-with: Cursor
A null maxAttachmentCount means no limit is enforced. This removes
the kDefaultMaxAttachmentCount constant and simplifies the API so
callers no longer need to branch on whether a limit is set.

Made-with: Cursor
The picker animation deferred listener cleanup, causing
_syncMessageToPicker to fire on controller.reset() and delete
cached attachment files before upload could read them.

Split picker lifecycle into _startPickerSync / _stopPickerSync /
_disposePickerController and detach sync listeners immediately in
_hidePicker. Also simplifies _showPicker by removing the ternary
branch for maxAttachmentCount.

Made-with: Cursor
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a6d7aa8e-3ddb-41dd-92fe-24918fca2bda

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/attachment-gallery

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@xsahil03x xsahil03x changed the title Refactor/attachment gallery refactor(ui): attachment upload and gallery improvements Apr 10, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2026

Codecov Report

❌ Patch coverage is 33.33333% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.55%. Comparing base (4428a96) to head (c486adb).

Files with missing lines Patch % Lines
...er/lib/src/message_input/stream_message_input.dart 25.00% 12 Missing ⚠️
...ream_chat/lib/src/core/models/attachment_file.dart 50.00% 4 Missing ⚠️
...nt_picker/stream_attachment_picker_controller.dart 33.33% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           v10.0.0    #2612      +/-   ##
===========================================
+ Coverage    65.54%   65.55%   +0.01%     
===========================================
  Files          427      427              
  Lines        26274    26269       -5     
===========================================
  Hits         17221    17221              
+ Misses        9053     9048       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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