Repository navigation
apple: send photos and videos sized by content without metadata, with Send as Original per item - #164
Merged
Merged
Conversation
Photos are prepared once at attach, off the main thread, by one shared preparer: camera photos at 1600 px, screenshots and other images at 2560 px, JPEG 0.8, PNG only when a pixel is transparent. Pixels are written upright with no location, camera or time, and the color profile is kept. The upload path checks the file again, so older drafts are cleaned too. Camera video goes at 720p and 3 Mbps, screen recordings at 1080p up to 5 Mbps; H.264 within those limits is remuxed, and exports drop location and device. Nothing falls back to the raw file: a photo that can't be prepared goes as a file, a video that can't be prepared fails. The untouched original behind each attachment is kept for 3 days so the composer's Original toggle can send it as a document, metadata included. Replaces ImageCompression.
…e main thread An Original chip leads the attachment strip when photos or videos are attached. With it on, each one is sent as its untouched file, and it resets after the send. Picked photos are read from their files so camera details choose the size and the original is kept; paste, recent photos and the camera prepare in the background. The unused photo preview screens are gone, and the share extension uses the shared photo and video preparation.
An Original checkbox ends the media row when photos or videos are attached, for messages and new threads. With it on, each one is sent as its untouched file, and it resets after the send. Images from a file are prepared from that file, the media picker builds a small preview instead of decoding the full image on the main thread, and GIFs keep their animation.
- Send as Original is now a conversion. switchedForOriginal turns a photo or video into a document of its kept original, and an image or video document back into a compressed photo or video. discardUnsent removes whichever form isn't kept. - canSwitchOriginal covers photos, videos and image or video files (not GIF or SVG). The menu summary reads size and location for files too. - A switched file joins the album after its photos and videos, as album sends already order files. - Drafts2.replaceAttachment keeps an attachment's place when it switches. - Removes the send-time swap (withOriginals, replacedWithOriginalDocument).
- Removes the Original chip from the attachment strip. - Photo, video and image or video file tiles get a long-press menu: Send as Original (checked on files, with size and location) and Remove. Choosing it switches the item in place, with a spinner and a crossfade. - The strip shows attachments in send order, photos and videos before files. Document tiles with a thumbnail show their extension. - A marked-up photo is prepared like any photo, and its edited file is kept as its original (savePhoto no longer takes optimize).
- Removes the Original checkbox from the media row. - Photo and video tiles and image or video file rows get Send as Original in their menu (video tiles gain a menu with Remove). Switching replaces the draft attachment and moves it between the media row and the file list, in Glass, Legacy and new-thread compose. - Sends no longer swap in originals at send time.
…nal, keep a gif's original, and re-prepare uploads staged by older builds - a photo that goes as a file because it is too thin to show or couldn't be prepared keeps its own bytes only when they carry no camera, place or time details; otherwise it goes as a full-resolution copy without them, or not at all. a video that couldn't be prepared and carries a location is refused instead of sent untouched. - a staged photo body is reused only when it is already prepared, and video staging descriptors carry a version. anything an older build staged (which could be the untouched original) is discarded with its sidecars, so the upload starts over from a prepared body under a new identity. - an animation converted from a gif keeps the gif as its original, so send as original sends the gif instead of the converted video; a gif file switches back to an animation.
…for photos being prepared - send waits while an item switches between photo and original, so it never goes in the form being left (an original carries its location). a failed switch cancels the waiting send. - pasted, dropped and recent-strip photos hold a pending tile before they are prepared, so a send waits for them and they land in this draft instead of the next one. photos are prepared two at a time, and the library picker loads two items at a time. - the share extension sends a photo that goes as a file without its camera, place or time details.
send would go with the form being left, and an original carries its location.
Contributor
Author
|
Pushed the review fixes (d15655d apple, a0de573 ios, 5d2f56d macos):
InlineKit tests cover a located photo sent as a file (the sent bytes have no GPS or camera tags), the GIF original, GIF eligibility and old video descriptors. Not yet tried on a device. |
…d video that may carry details from the pre-merge review: - a photo whose upload had to prepare it is staged in its prepared format. a retry that reuses that body now sends the same name and type, which the server checks against the same upload; it used to send the caller's (a png name for a staged jpeg) and every retry failed the create. - a video that couldn't be prepared goes as its untouched file only when its metadata can be read and carries no camera, place or time details; one that can't be read is refused too. - originals left by unsent drafts are swept when a video is attached as well.
…n images with a file behind them - a row configured again built a new menu and inserted the same menu item, which appkit refuses while the item is still in the old menu. the item now leaves its old menu first. - an image too thin or tiny to show as a photo, with a file behind it, now goes through the draft's photo preparation, which sends it as a file without camera, place or time details instead of the untouched file.
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.
Photos and videos now leave the Apple clients compressed, sized for what they are, and without location or camera details. Send as Original sends one item's exact file instead, chosen from that item's menu.
Sending
Send as Original
Not changed
No protocol, database or draft-format changes. Phase 2 (a clean server copy for non-Apple senders) and phase 3 (the receive side) are separate.
Validation
Known tradeoffs
🤖 Generated with Claude Code