refactor(ui): attachment upload and gallery improvements#2612
refactor(ui): attachment upload and gallery improvements#2612
Conversation
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
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Codecov Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
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.