Skip to content

fix(share_plus): only configure popover presentation on iPad - #3965

Merged
vbuberen merged 1 commit into
fluttercommunity:mainfrom
m1roxx:fix/share-plus-ipad-only-popover
Oct 1, 2026
Merged

vbuberen merged 1 commit into
fluttercommunity:mainfrom
m1roxx:fix/share-plus-ipad-only-popover

Conversation

@m1roxx

@m1roxx m1roxx commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Description

Since Xcode 26, UIActivityViewController.popoverPresentationController is non-nil on iPhone as well, where it returns a private _UIActivityViewControllerPresentationController instead of a real UIPopoverPresentationController. Logged on iOS 26.0:

iPhone: isIpad=0  popover=<_UIActivityViewControllerPresentationController: 0x102715c50>
iPad:   isIpad=1  popover=<UIPopoverPresentationController: 0x1017486d0>

FPPSharePlusPlugin set sourceView unconditionally and, on iPhone with a non-empty sharePositionOrigin, also set sourceRect through the else if branch. Both configure anchored presentation on a controller that is not a popover controller on iPhone.

This PR restricts every popover configuration to iPad, which is what the surrounding comment already stated as the intent. iPad behaviour, including the centre-of-view fallback added in #3769, is unchanged.

Verification

  • iPhone 17 Pro / iOS 26.0, with and without sharePositionOrigin: share sheet presents as before and share() resolves.
  • iPad Pro 11-inch (M4) / iOS 26.0: popover anchors correctly, centre-of-view fallback still applies when no origin is given, no exception.
  • flutter analyze reports no issues.

I could not reproduce the hang described in #3943 on iOS 26.0 — 3/3 calls resolved, including a sub-screen round trip and an interrupted interactive dismissal. That report is against iOS 26.3–26.5.2, which needs a newer Xcode than I have available. So this change is verified non-regressive on both idioms, but confirmation that it resolves the hang itself needs someone running 26.3+.

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

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

@m1roxx

m1roxx commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@vbuberen friendly ping when you have a moment. Note the red CI here is not from this PR: Check code formatting fails on Dart files in share_plus_windows/test/, Check pub.dev requirements fails in android_intent_plus / connectivity_plus / package_info_plus, and the Windows/iOS jobs fail on infrastructure. The same set of failures is present on #3970, #3967 and #3963 — this PR only touches FPPSharePlusPlugin.m. Happy to rebase once main is green.

Heads up that #3970 touches the same file, so one of the two will need a rebase depending on merge order.

guide-linhnv added a commit to guide-inc-org/guide-flutter_plus_plugins that referenced this pull request Sep 21, 2026
Cherry-picked from upstream PR fluttercommunity#3965 (unmerged) — fixes Future hang
when swiping to dismiss the share sheet on iPhone, iOS 26+.
@vbuberen
vbuberen force-pushed the fix/share-plus-ipad-only-popover branch from 8a4553c to 2e301dd Compare September 26, 2026 21:17
Since Xcode 26, `UIActivityViewController.popoverPresentationController` is
non-nil on iPhone as well, where it returns a private
`_UIActivityViewControllerPresentationController` instead of a real
`UIPopoverPresentationController`.

The plugin set `sourceView` unconditionally and, on iPhone with a non-empty
`sharePositionOrigin`, also set `sourceRect`. Both configure anchored
presentation on a controller that is not a popover controller on iPhone.

Restrict every popover configuration to iPad, which is what the surrounding
comment already stated as the intent. iPad behaviour, including the
centre-of-view fallback added in fluttercommunity#3769, is unchanged.
@vbuberen
vbuberen force-pushed the fix/share-plus-ipad-only-popover branch from 2e301dd to 781b972 Compare September 30, 2026 14:42
@vbuberen
vbuberen merged commit 86ba69a into fluttercommunity:main Oct 1, 2026
34 of 36 checks passed
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.

[share_plus] iOS: sourceView set unconditionally on iPhone — on iOS 26 swipe-dismissing the sheet can hang the share() Future and break touch delivery

2 participants