Skip to content

feat(share_plus): AirDrop a link that opens the app - #3978

Open
milhomem-tshirt wants to merge 1 commit into
fluttercommunity:mainfrom
milhomem-tshirt:feat/share-plus-airdrop-as-url
Open

milhomem-tshirt wants to merge 1 commit into
fluttercommunity:mainfrom
milhomem-tshirt:feat/share-plus-airdrop-as-url

Conversation

@milhomem-tshirt

@milhomem-tshirt milhomem-tshirt commented Sep 23, 2026 •

Copy link
Copy Markdown

Description

Sharing a link through the iOS share sheet does not give AirDrop something the other device can open as a URL. The payload lands in Notes, so a deep link never launches the app.

ShareParams(uri:, title:, text:, airDrop: ShareAirDropAs.url) fixes that. AirDrop receives a real NSURL. The other device opens that URL, and iOS follows the universal link or deep link into the app. Messages, Mail, and other text destinations still get the sentence in text. The sheet header stays the host app icon.

ShareAirDropAs.inherit (the default) keeps today's raw-NSURL share, including the Safari page preview. Android has no AirDrop. A titled URI already goes out as EXTRA_TEXT / EXTRA_TITLE.

Why the code changes

  • ShareAirDropAs (inherit, url, text) is the opt-in. url is the AirDrop-as-link path. text sends the URI string as plain text. The method channel only sends airDrop when it is not inherit, so existing calls stay the same.
  • uri and text together are allowed only when airDrop is url. That split is the whole point: AirDrop gets the URL, Messages and Mail get the sentence. Every other combination still throws.
  • iOS SharePlusData for a titled URI keeps the placeholder as text, so the sheet does not switch to a Safari preview. itemForActivityType: returns the NSURL only for UIActivityTypeAirDrop. Every other destination, including Messages and Mail, gets text (falling back to the title, then the URI).
  • File captions use the same item source with messageAndMailOnly. The placeholder and file destinations (Save to Files, AirDrop, Copy, Print, Books, Camera Roll, Markup as PDF) get nil, not NSNull, so the header stays the file and those apps do not receive a second Plain Text item. Notes and other text or multimedia extensions still get the caption.
  • Android prefers text over uri in EXTRA_TEXT when both are set, so the sentence is what gets shared. title stays EXTRA_TITLE.
  • Web shares text and title when a URI is paired with both. There is no AirDrop there.
  • Tests cover the new uri + text + airDrop: url call and the method-channel payload.

Related Issues

None.

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I titled the PR using Conventional Commits.
  • I did not modify the CHANGELOG.md nor the plugin version in pubspec.yaml files.
  • All existing and new tests are passing.
  • The analyzer (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?

  • Yes, this is a breaking change (please indicate that with a ! in the title as explained in Conventional Commits).
  • No, this is not a breaking change.

Test plan

  • iOS: ShareParams(uri:, text:, title:, airDrop: ShareAirDropAs.url) shows the host app icon. Messages gets the sentence. AirDrop opens the URL so the deep link launches the app.
  • iOS: omit airDrop (inherit) and the share is still the raw URI with the Safari page preview.
  • iOS: a file plus text reaches Messages, Mail, and Notes. Save to Files, AirDrop, and the sheet header stay the file only.
  • Android: uri + text + title shares the sentence as EXTRA_TEXT and the title as EXTRA_TITLE.

Sharing a URI through the iOS sheet currently hands AirDrop a payload the
other device opens in Notes, so a super link or deep link never reaches
the app. Callers can now set ShareAirDropAs.url and AirDrop receives a
real NSURL. The receiving device opens that URL, which is what launches
the app through the universal link or deep link.

The sheet placeholder stays plain text so the header keeps the host app
icon instead of a Safari page preview. Messages, Mail, and other text
destinations still get ShareParams.text, which is why uri and text are
allowed together only for this mode. Android has no AirDrop, so the
message body wins over the bare URI in EXTRA_TEXT and the title stays
EXTRA_TITLE. File captions return nil for the placeholder and for file
destinations (Save to Files, AirDrop, Copy, and the rest) so they do not
show up as a second item or get sent as a text file. inherit keeps the
old raw-NSURL share, and the channel omits airDrop unless the caller
opts in.

Co-authored-by: Cursor <cursoragent@cursor.com>
@milhomem-tshirt
milhomem-tshirt force-pushed the feat/share-plus-airdrop-as-url branch from 521ff06 to 88f78af Compare September 24, 2026 00:58
@milhomem-tshirt milhomem-tshirt changed the title feat(share_plus): deliver titled URIs over AirDrop as a link feat(share_plus): AirDrop a link that opens the app Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant