Fix: use a unique filename for iOS shared images to fix stale receipt preview#97038
Fix: use a unique filename for iOS shared images to fix stale receipt preview#97038MelvinBot wants to merge 1 commit into
Conversation
…cache Co-authored-by: Chavda Sachin <ChavdaSachin@users.noreply.github.com>
|
I created this PR from an upstream branch since I don't have push access to your fork. To take ownership of this branch and be able to push updates, run: Then you can close this PR and open a new one from your fork.
|
|
I looked into the failing checks. The only one that's actually failing is PR Author Checklist / checklist — every other check is passing, skipping, or still pending. That failure isn't a code problem, so there's nothing for me to push. It fails because the author checklist boxes aren't ticked:
How to clear it: the human co-author needs to review and check the boxes in the PR Author Checklist section of the PR description, and fill out the I intentionally didn't modify code here — the checklist is a manual gate, not a bug in the change. |
Explanation of Change
On iOS, the Share Extension writes every incoming image (screenshots / gallery photos arrive as a
UIImageand go throughhandleImageData) to disk under a constant filename,shared_image.png. Even thoughsetupSharedFolderwipes and rewrites that file on each share, the absolute path — and therefore thefile://…/sharedFiles/shared_image.pngcontentURI handed to JS — is byte-for-byte identical every time. The receipt preview binds to that URI, and the image layer (expo-image) keys its cache on the URI, so it keeps serving the first decoded receipt on every subsequent share.This change gives each shared image a unique filename (
shared_image_<UUID>.png) so the resultingcontentURI differs per share. That single change is the convergence point — the nativecontent, the previewsource, and the upload path all derive from this filename — so a distinct URI busts the cache and the newly selected receipt is decoded and shown, with no JS changes. The extension already clearssharedFileson each run, so unique names never accumulate on disk.Fixed Issues
$ #95075
PROPOSAL: #95075 (comment)
Tests
// TODO: The human co-author must fill out the tests performed before marking this PR as "ready for review".
Suggested manual test (iOS Native):
Offline tests
N/A — native share-file handling; not network dependent.
QA Steps
// TODO: The human co-author must fill out the QA steps before marking this PR as "ready for review".
Same as Tests above.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, 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.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