plus_plugins icon indicating copy to clipboard operation
plus_plugins copied to clipboard

feat(share_plus): Added excludedActivityTypes support for the iOS platform.

Open StanleyCocos opened this issue 1 year ago • 8 comments

The iOS platform is missing the exclusion feature. This PR adds the platform exclusion functionality for iOS.

fix: https://github.com/fluttercommunity/plus_plugins/issues/3377

Checklist

  • [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • [x] I titled the PR using Conventional Commits.
  • [x] I did not modify the CHANGELOG.md nor the plugin version in pubspec.yaml files.
  • [x] All existing and new tests are passing.
  • [x] 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).
  • [x] No, this is not a breaking change.

StanleyCocos avatar Dec 03 '24 06:12 StanleyCocos

Thanks for this contribution as well! We have to keep this one on hold because I plan to refactor the share() method parameters, as also discussed in https://github.com/fluttercommunity/plus_plugins/issues/3307#issuecomment-2513723902

Your input on this topic would be appreciated as well.

miquelbeltran avatar Dec 03 '24 07:12 miquelbeltran

@miquelbeltran Thank you for your reply. I understand your plan now. If needed, I can still improve this PR after your plan.

StanleyCocos avatar Dec 03 '24 07:12 StanleyCocos

FYI, started working on the shareplus refactor, that should simplify adding this and other optional parameters: https://github.com/fluttercommunity/plus_plugins/pull/3404

miquelbeltran avatar Dec 18 '24 13:12 miquelbeltran

Hi, that's great! I've been studying the code in your branch. It's really well-organized and tidy. Next, I need to add the parameter excludedActivityType for this pull request (PR) to ShareParams. After that, I'll wait for you to finish merging xx into the main branch. Once that's done, I'll synchronize my changes accordingly.

StanleyCocos avatar Dec 19 '24 01:12 StanleyCocos

@miquelbeltran I’ve updated my request based on #3404. If you have time, please take a look. Thank you.

StanleyCocos avatar Apr 21 '25 06:04 StanleyCocos

Thanks! I haven't looked too deep into it yet, but can you describe how it works in this PR, so I can understand the change better.

And as well, add a bit of documentation about this feature on the README.md so users are aware of it.

miquelbeltran avatar Apr 21 '25 14:04 miquelbeltran

Let me briefly describe the changes in this PR:

  • In share_plus_platform_interface, I declared a CupertinoActivityType enum and added it as a parameter to ShareParams. Before passing it to the iOS layer, it is transmitted as a string to make it easier for users to exclude unwanted share options on iOS and macOS.

  • On the iOS native side, the string passed from the Flutter layer is received and converted back into an enum, which is then applied to the share configuration.

  • In the example, I added a multi-selection page for easier testing. Due to structural issues, I also introduced a new MyApp class that returns a MaterialApp (this caused a number of structural and formatting changes).

StanleyCocos avatar Apr 22 '25 03:04 StanleyCocos

@miquelbeltran Sorry to bother you. I noticed this request has been pending for quite a while. Do you have any plans to complete the code review soon?

StanleyCocos avatar Jun 17 '25 09:06 StanleyCocos

Tested on iOS 18.5 simulator using the example app ✅

miquelbeltran avatar Jun 23 '25 13:06 miquelbeltran

Thanks for the changes, I think it's good to go now!

miquelbeltran avatar Jun 24 '25 08:06 miquelbeltran