feat(share_plus): implement previewThumbnail preview on Android and Windows#3913
Open
diablodale wants to merge 6 commits into
Open
feat(share_plus): implement previewThumbnail preview on Android and Windows#3913diablodale wants to merge 6 commits into
diablodale wants to merge 6 commits into
Conversation
previewThumbnail was declared on ShareParams but never serialized across the method channel nor used by any native implementation, so setting it had no effect. - Serialize previewThumbnail to a file path in MethodChannelShare, reusing the existing _getFile helper so in-memory XFiles are materialized. - Android: attach the thumbnail to the chooser intent via data + ClipData with FLAG_GRANT_READ_URI_PERMISSION on text/URL shares (API 29+), and grant read access to resolved activities. File shares keep their own EXTRA_STREAM-derived preview. - Windows: set DataPackage.Thumbnail from the thumbnail file via RandomAccessStreamReference in the DataRequested callback. - Update docs to list Android and Windows as supported platforms and add a serialization test.
setData() clears the intent type (text/plain), which removes Direct Share (recommended people) suggestions. Attach the preview thumbnail via ClipData only, preserving the MIME type.
melos run format caused changes throughout the monorepo. This commit includes only those formatting changes within the share_plus folder.
Author
|
CI is compiling differently that local. It is unclear your compiler, switches, etc. When flutter does local build this failure (looks like a warning that has been promoted to error) does not exist. This is a core flutter generated file and I do not recommend changing it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements
ShareParams.previewThumbnailend-to-end on Android and Windows. Previously it was an unimplemented stub, the value was accepted by the API but never sent over the method channel or used natively, so setting it did nothing.a rich preview for text/URI shares. Ignored for file shares (the system previews those itself).
Verified
suggestions are preserved, and the pre-API-29 path is cleanly skipped
Windows 11 share sheet does not display the content preview for text shares, so it may not be visible there despite
being set.
Related Issues
Related #1221
Checklist
CHANGELOG.mdnor the plugin version inpubspec.yamlfiles.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?
!in the title as explained in Conventional Commits).