Skip to content

fix(share_plus): preserve iOS URI preview titles and subjects - #4025

Open
HowardTangOvO wants to merge 1 commit into
fluttercommunity:mainfrom
HowardTangOvO:feature/share-plus-ios-link-metadata
Open

HowardTangOvO wants to merge 1 commit into
fluttercommunity:mainfrom
HowardTangOvO:feature/share-plus-ios-link-metadata

Conversation

@HowardTangOvO

Copy link
Copy Markdown

Description

On iOS, ShareParams(uri: ..., title: ..., subject: ...) currently passes only an NSURL to the activity controller. The supplied title is absent from the share-sheet preview, and the subject is discarded.

Use a UIActivityItemSource for URI sharing that continues to return the original NSURL, supplies LPLinkMetadata for the preview, and forwards the email subject separately. The preview uses a non-empty title, falling back to the subject and then the URL. Supplying a different title and subject preserves both values independently. No public Dart API changes are required.

Add native regression tests for URL payloads, separate preview titles and email subjects, and absent/empty metadata. Text and file sharing are unchanged.

Validation:

  • flutter test in packages/share_plus/share_plus: 14 passed, 1 skipped.
  • flutter analyze --no-pub in the same package: no issues.
  • New Swift XCTest source type-checked against the iOS Simulator SDK; swift-format lint --strict and git diff --check passed.
  • A Foundation assertion harness executed the actual new Objective-C item-source implementation with a metadata test double: URL identity, separate title/subject, and fallbacks passed.
  • The native change was built into a consuming Flutter app and verified on a physical iPhone; the tester confirmed the share-sheet title works.

The new UIKit XCTest cases have not been executed in an iOS test host locally. The full cross-platform test matrix has not been run locally.

Related Issues

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.

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.

[Bug]: (share_plus) iOS drops the subject when sharing a uri

1 participant