Repository navigation
[CP Staging] fix: Downscale oversized in-app camera photos before use - #104979
AndrewGable merged 2 commits into
Conversation
|
@MelvinBot review |
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
ReviewThe approach looks right, and I found nothing blocking. I have two suggestions and one housekeeping item:
Other checks
|
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5add194d34
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| } | ||
|
|
||
| // The manipulator applies the file's rotation metadata while decoding, so resize in the display frame `photo` reports. | ||
| const context = ImageManipulator.manipulate(getPhotoSource(photo.path)).resize(size); |
There was a problem hiding this comment.
Route synchronous resize errors through the fallback
When ImageManipulator.manipulate() or the synchronous .resize() call throws (for example, during native context initialization), downscalePhoto() exits before returning a Promise. The .catch() in AttachmentCamera.tsx therefore cannot apply its "use the original" fallback; the error reaches the outer capture catch, displays a camera failure, and leaves the valid original capture unused and undeleted. Wrap this setup in a Promise or try so these failures reject through the resize fallback.
Useful? React with 👍 / 👎.
b483d97 to
7414598
Compare
|
🚧 MonilBhavsar has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroid.2.mp4Android: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
Regression checkI found no regressions at
Scope: every "Take a photo" flow that goes through Web is not affected. Every changed file is reachable only from native code, so I did not run a web test. Minor side effects (not blockers)
|
AndrewGable
left a comment
There was a problem hiding this comment.
This fixes the blocker: #104941 (comment)
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
…ent-camera-downscale [CP Staging] fix: Downscale oversized in-app camera photos before use (cherry picked from commit fbb7858) (cherry-picked to staging by AndrewGable)
|
🚧 AndrewGable has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🔁 Filed a Staging retest request for deploy blockers #104941 after this PR was cherry-picked to staging. |
|
🚀 Cherry-picked to staging by https://github.com/AndrewGable in version: 9.5.20-3 🚀
|
|
No help site update is needed: this bug fix makes in-app camera photos work in the avatar flow as users already expect, and it doesn't change any feature, label, or size limit that an article describes. |
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.5.20-5 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Cherry-picked to staging by https://github.com/AndrewGable in version: 9.5.21-0 🚀
|
|
No help site update is needed: this bug fix makes in-app camera photos work in the avatar flow as users already expect, and it doesn't change any feature, label, or size limit that an article describes. |
|
🚀 Cherry-picked to staging by https://github.com/AndrewGable in version: 9.5.23-0 🚀
|
|
No help site update is needed: this bug fix makes in-app camera photos work in the avatar flow as users already expect, and it doesn't change any feature, label, or size limit that an article describes. The PR's files haven't changed since my earlier review, so that answer still stands. |
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.5.23-3 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
After the VisionCamera v5 upgrade (#102898), the photo resolution we request (2880×2160) is only a hint, and CameraX may return a full-sensor photo. On some Android devices (Samsung S23 FE / S25 FE), the photo taken with "Take a photo" from the attachment picker is then over
AVATAR_MAX_ATTACHMENT_SIZE(6 MiB), so the avatar flow rejects it with "Size exceeded" before cropping.This PR adds
downscalePhoto, which runs inAttachmentCameraright after capture:JPEG_QUALITY. The full-size original is deleted.Fixed Issues
$ #104941
PROPOSAL:
Tests
Offline tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari