Repository navigation
Conversation
Mobile comments can attach photos (library, multi-select) and PDFs (document picker), show uploads above the composer, and list a comment's files under it. The web upload pipeline is reused rather than reimplemented: an UploadSource seam (name/size/type/readChunk) replaces File in the uploader, read lazily inside the concurrency slot so native never holds more than MAX_CONCURRENT_CHUNKS chunks. Selection rules, attachment limits and upload-item state are shared by both legs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013LkamMd6XMPeYNHbAV1DZ9
🦋 Changeset detectedLatest commit: bd9c874 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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 |
|
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.



Summary
Mobile comments can now carry file attachments, like web: photos from the library (multi-select) and PDFs from the document picker, upload progress above the composer, and a comment's files listed under it (tap to open). The work reuses the web upload pipeline instead of building a second one. Only reading bytes from a file depends on the platform; everything else is shared.
Backend: N/A, frontend-only change (the files API, the
FilesInterfacefragments and the attach mutation are already on master).Template PR: https://bitbucket.org/silverlogic/baseapp-frontend-template/pull-requests/454. Merge this one first, then that one, which only bumps the submodule pointer.
What changed
files/common: shared pipelineUploadSource(name,size,type,readChunk(start, end), optionaldispose()) is the platform seam. Every upload entry point accepts a webFileor anUploadSource. AFileis wrapped automatically throughBlob.slice.uploadChunkshas a lazyreadChunkmode. A chunk is read only once it has a concurrency slot, so at mostMAX_CONCURRENT_CHUNKSchunks are in memory, and a retry reuses the bytes it already read.useChunkedUploaduses this mode for fresh uploads and for resume.clearScopeaborts the uploads it removes and disposes their sources.filterSelectedFiles/describeRejectedFiles: size, count and type (MIME wildcard or extension, with the same semantics as theacceptattribute).getUploadItemActions/getUploadPercent.getFileTypeLabel.files/native: new legcreateNativeUploadSourcereads each chunk through a short-lived expo-file-systemFileHandle. On Android, acontent://URI is first copied into the cache, becauseFileHandlecannot open content URIs.disposedeletes that copy.useNativeFilePickeropens two pickers and applies the shared rules, toasting what it dropped:expo-image-picker, multi-select, with HEIC converted to JPEG;File.pickFileAsync. This is expo-file-system's built-in picker, so no new native dependency.FileChip,UploadingFilesListandAttachedFilesList.Comments
COMMENT_FILE_ATTACHMENT_LIMITS(5 files, 100 MB, png/jpg/pdf) replaces the two copies in the web components and is used on mobile.useCommentComposer):useDeferredFileAttachments, the hook web uses: upload now,attachTo(commentId)after create;CommentFilesUpsertActions(native) adds photo and file buttons to the composer toolbar.CommentItemrendersAttachedFilesList. The fragment already spreadFilesList_target, so this adds no query change.Shared native composer
SocialInputtakesSocialUpsertActionsProps, matching web.SocialInputDrawer.Drawertakes aFooter, rendered above the input, and grows its snap points by the footer's measured height.Placeholdertakes the matchingfooterHeight.design-system: native
AttachmentIcon, ported from the web SVG.Test plan
Mobile host: any page with comments (
[...path]→PageComponent→Comments).Q: Can I attach photos to a new comment?
→ Two chips with progress bars show above the input, and the sheet grows to fit them. Send stays disabled until both finish. After sending, the new comment shows both files as chips with thumbnails.
Q: Do PDFs work, including Android
content://files (Drive, Downloads)?→ The PDF uploads and attaches. Tapping it opens the file URL in the system viewer. (Automated:
createNativeUploadSource.test.tscovers the content-URI copy and its cleanup.)Q: Are invalid picks refused the same way as on web?
1 file was not added (over 100.00 MB).filterSelectedFiles.test.ts,useNativeFilePicker.test.ts,useFileSelect.test.ts)Q: Can I cancel or retry?
Q: What happens in edit mode?
→ The attach icons are disabled and the pending-upload row is hidden. Draft files from a new comment stay in the composer and come back when the edit ends.
Q: Did web change?
acceptedFileTypesthat you force through the OS picker's "All files" option is now dropped. (Automated:useFileSelect.test.ts"drops files outside acceptedFileTypes…")Automated:
pnpm test:unit138/138 inpackages/components,tscclean, eslint clean on changed files,relay-compilerclean,ast-grepwith no new findings. No component tests: native has no Playwright/Storybook layer, so native coverage comes from the common unit tests plus the native util and hook tests above.Out of scope (do not flag)
maxFilesapplies per pick, the same as web today.Accepted tradeoffs (do not re-flag)
FileUploadProgress.fileis now typedUploadSource, because native has noFile. The changeset says what callers must change. If the team would rather call this minor, given the module only just shipped in 3.0.0, that is a one-word change.Uint8Arraybodies, so each 5 MB chunk costs a synchronous native read plus about 6.7 MB of base64, three chunks at a time. Expect some JS-thread jank on low-end Android during large uploads. Fixing this would need a native streaming upload, which is out of scope here.ScrollViewand needs a device check for swipe conflicts with the sheet's pan gesture.useViewPhotoLibrary, which is single-select and avatar-oriented, so it is not reused here.🤖 Generated with Claude Code
https://claude.ai/code/session_013LkamMd6XMPeYNHbAV1DZ9