Skip to content

fix(share_plus): Throw error if sharePositionOrigin not in sourceView #1038

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Sep 20, 2022

Conversation

tkreuder
Copy link
Contributor

@tkreuder tkreuder commented Aug 28, 2022

(iPad and maybe Mac): The sharePositionOrigin must be in the coordinate space of sourceView. See https://developer.apple.com/documentation/uikit/uipopoverpresentationcontroller/1622324-sourcerect, else [LayoutConstraints] Unable to simultaneously satisfy constraints. appears.

Description

Replace this paragraph with a description of what this PR is doing. If you're modifying existing behavior, describe the existing behavior, how this PR is changing it, and what motivated the change.

Related Issues

Replace this paragraph with a list of issues related to this PR from the issue database. Indicate, which of these issues are resolved or fixed by this PR. Note that you'll have to prefix the issue numbers with flutter/flutter#.

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]).
This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated the version in pubspec.yaml and CHANGELOG.md.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (flutter analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • I am willing to follow-up on review comments in a timely manner.

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 a breaking change in CHANGELOG.md and increment major revision).
  • No, this is not a breaking change.

@tkreuder
Copy link
Contributor Author

tkreuder commented Aug 29, 2022

Resolves #951

@tkreuder
Copy link
Contributor Author

tkreuder commented Aug 29, 2022

Resolves #870

@tkreuder tkreuder force-pushed the improvement/share_plus branch from 482b288 to d4ae457 Compare August 30, 2022 11:15
Copy link
Member

@miquelbeltran miquelbeltran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This will help bring clarity to this issue that seems to affect so many people.

Since sharePositionOrigin is not mandatory for iPhones, does it keep working as well for those devices when the param is not provided?

@miquelbeltran miquelbeltran self-assigned this Sep 6, 2022
@tkreuder
Copy link
Contributor Author

tkreuder commented Sep 9, 2022

Thanks! This will help bring clarity to this issue that seems to affect so many people.

Since sharePositionOrigin is not mandatory for iPhones, does it keep working as well for those devices when the param is not provided?

I now made sure, that it raises a PlatformException:

  • Only if popoverPresentationController is given, which is the case for iPad (not for iPhone) and the arguments sharePositionOrigin value, is not in the parents Rect. This avoids an explicit check, if the device is an iPad and would thus work also on other Apple devices, where this is needed (e.g. in future).
  • It raises the PlatformException no matter which Share.share* method is used

# Conflicts:
#	packages/share_plus/share_plus/CHANGELOG.md
#	packages/share_plus/share_plus/pubspec.yaml
@tkreuder tkreuder force-pushed the improvement/share_plus branch from 736ea84 to 7ecda36 Compare September 9, 2022 15:07
@tkreuder tkreuder force-pushed the improvement/share_plus branch from 7ecda36 to fa356dc Compare September 9, 2022 15:12
@tkreuder
Copy link
Contributor Author

tkreuder commented Sep 9, 2022

image
image

# Conflicts:
#	packages/share_plus/share_plus/CHANGELOG.md
#	packages/share_plus/share_plus/ios/Classes/FLTSharePlusPlugin.m
@tkreuder
Copy link
Contributor Author

Can this be merged @miquelbeltran ?

@miquelbeltran
Copy link
Member

on it

@miquelbeltran miquelbeltran merged commit 6da46f4 into fluttercommunity:main Sep 20, 2022
@tkreuder
Copy link
Contributor Author

Good catch and thank you @miquelbeltran :) 👍

@tkreuder tkreuder deleted the improvement/share_plus branch September 20, 2022 12:27
@miquelbeltran
Copy link
Member

released under 4.3.0, thanks to you!

I ran this on my mac on both iphone and ipad simulators

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants