Handle raw Data type in iOS share extension for screenshot sharing#84387
Draft
Handle raw Data type in iOS share extension for screenshot sharing#84387
Conversation
When sharing a screenshot directly from the iOS screenshot preview, iOS provides the image as raw Data bytes rather than a NSURL or UIImage. The share extension's handleData method was missing a case for this type, causing the data to silently fall through to the error handler. This meant the app would open but no file was saved to the shared container. Add a Data handler that first attempts to decode the bytes as a UIImage (the common case for screenshots) and falls back to saving as a generic file for other data types. Co-authored-by: Georgia Monahan <grgia@users.noreply.github.com>
Contributor
|
🚧 @grgia has triggered a test Expensify/App build. You can view the workflow run here. |
Contributor
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
Contributor
|
@MelvinBot I tested this build on an IOS device and it does not fix the issue |
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.
Explanation of Change
When sharing a screenshot directly from the iOS screenshot preview (the thumbnail that appears after taking a screenshot), iOS provides the image as raw
Databytes rather than anNSURLorUIImage. The share extension'shandleDatamethod inShareViewController.swiftwas missing a case for this type, so the data silently fell through to the error handler. The app would still open (becauseopenMainApp()is called regardless of errors inprocessAttachments) but no file was saved to the shared container, resulting in nothing happening.This adds a
Datahandler that first attempts to decode the bytes as aUIImage(the common case for screenshots) and falls back to saving as a generic file for other data types.Fixed Issues
$ https://github.com/Expensify/Expensify/issues/606736
Tests
Offline tests
N/A — the share extension operates on local data before opening the app.
QA Steps
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
N/A — iOS-only change
Android: mWeb Chrome
N/A — iOS-only change
iOS: Native
Requires manual testing on a physical iOS device with the share extension.
iOS: mWeb Safari
N/A — iOS-only change
MacOS: Chrome / Safari
N/A — iOS-only change