Skip to content
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

feat(share_plus): add option to add custom link title on Android #3270

Closed

Conversation

florian-obernberger
Copy link

Description

This adds the possibility to add a custom link title to URIs on Android. As far as I am aware this feature is not available on iOS, so I did not implement it. I only added it to the shareURI method, as this is already a mobile only and already has platform specific parameters (sharePositionOrigin).

Related Issues

There is no open issue about it, I was thinking about opening one up but decided to implement it instead.

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.

@miquelbeltran
Copy link
Member

Hello and thanks for the contribution!

I will need to think about this, I'd like to find a better way to provide platform-exclusive parameters and/or provide Android intent extras.

@florian-obernberger
Copy link
Author

My pleasure!

I had a few different options in mind, but decided to stick to the existing design patterns. Some alternatives I had thought about were:

  • Something like an AndroidURIShareOptions object that gets passed along
  • A similar approach to flutter_local_notifications where you can resolve to the platform specific implementation which has more features / parameters available in the method. This however would most likely require a complete restructuring of the package, since you'd be work with instance methods and not static ones

@miquelbeltran
Copy link
Member

Another advantage of allowing instantiation of the Share class is that it would allow mocking, which is a complaint we had in the past from using static methods.

I was also thinking on having something like AndroidShareOptions or similar. Since Android allows adding Intent extras, it could also include a generic Map<String, String> for extras so you can pass in any intent extras you want.

And moving the sharePositionOrigin to an iOS (and macOS?) share options object to keep it consistent.

These options objects could be passed to the three share methods as well.

And another different question is the subject vs. title, as internally sometimes subject is used for "mailto" subject line, sometimes is passed as the title e.g. in web, and on Android is used as the intent EXTRA_SUBJECT which maybe is not what receiving apps expect.

So you see, it gets a bit messy :)

@miquelbeltran
Copy link
Member

As mentioned in #3306, I'd prefer if we can discuss this in a feature request ticket, and find a solution that fits most people. Then we can create a new PR.

@miquelbeltran
Copy link
Member

Created the ticket: #3307

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.

2 participants