feat(share_plus): Added excludedActivityTypes support for the iOS platform.
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.mdnor the plugin version inpubspec.yamlfiles. - [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.
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 Thank you for your reply. I understand your plan now. If needed, I can still improve this PR after your plan.
FYI, started working on the shareplus refactor, that should simplify adding this and other optional parameters: https://github.com/fluttercommunity/plus_plugins/pull/3404
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.
@miquelbeltran I’ve updated my request based on #3404. If you have time, please take a look. Thank you.
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.
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).
@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?
Tested on iOS 18.5 simulator using the example app ✅
Thanks for the changes, I think it's good to go now!