Repository navigation
fix(share_plus): share uri as URL on macOS so AirDrop is offered - #4024
Open
panfilov-vladislav wants to merge 1 commit into
Open
panfilov-vladislav wants to merge 1 commit into
panfilov-vladislav wants to merge 1 commit into
Conversation
On macOS the `uri` argument was read as a String and passed to NSSharingServicePicker as-is. The picker offers services based on the item type, so a String is treated as plain text and link-aware services such as AirDrop were not listed. Convert `uri` to a URL before sharing, as is already done for `paths`, and fall back to the original String if it cannot be parsed. Fixes fluttercommunity#4023
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.
Description
On macOS, the
uriargument ofShareParamswas read as aStringand passed toNSSharingServicePickeras-is. The picker chooses which services to offer from the type of the items, so aStringis treated as plain text and link-aware services such as AirDrop were not listed. Thepathsbranch already shares URLs; theuribranch did not, souribehaved liketext.This PR converts
urito aURLbefore sharing, and falls back to the originalStringif it cannot be parsed as a URL, so existing behavior is kept for malformed input.Tested with the
share_plusexample app on macOS 27.2.1 (Flutter 3.47.8), enteringhttps://example.com/testin "Share uri":Related Issues
Checklist
CHANGELOG.mdnor the plugin version inpubspec.yamlfiles.flutter analyze) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?
!in the title as explained in Conventional Commits).