-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(share_plus): return correct share result on android #1301
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
Conversation
The Linux test failed because it got a 404 while installing packages through apt - that should not affect this PR Thank you for re-running the timedout Android integration tests :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and it seems to be working good.
Left a few Kotlin related comments, but otherwise looks good to me.
packages/share_plus/share_plus/android/src/main/kotlin/dev/fluttercommunity/plus/share/Share.kt
Outdated
Show resolved
Hide resolved
...share_plus/android/src/main/kotlin/dev/fluttercommunity/plus/share/SharePlusPendingIntent.kt
Outdated
Show resolved
Hide resolved
...share_plus/android/src/main/kotlin/dev/fluttercommunity/plus/share/SharePlusPendingIntent.kt
Outdated
Show resolved
Hide resolved
Thanks for your review! Fixed all points mentioned and updated my example project and all references to it :) PS: I just submitted a PR for the failing Linux test #1305 |
LGTM, but I'll have to run this on Monday before merging. |
I have tested it on Android 10 physical device and emulator of Android 12. Worked well. |
Description
The
share_plus
androidshareWithResult
andshareFilesWithResult
implementations are broken. The returnedShareResult.raw
is alwaysnull
on successful share. This PR fixes this by usingFLAG_MUTABLE
instead ofFLAG_IMMUTABLE
, as pointed out by @aakash-pamnani. This issue was not found when initially implementing theshareWithResult
methods, as theFLAG_IMMUTABLE
was only required by the highest API versions. Back then, a simple warning was emitted that strongly suggested usingFLAG_IMMUTABLE
, which seemed to break nothing.This PR now fixes the behavior and ensures that the
FLAG_MUTABLE
PendingIntent
given out may not be abused by moving from an implicit internalIntent
to an explicit one. This also reduces mental complexity of the implementation.I also added some more documentation throughout the android implementation.
As always, I provide share_plus_example as a pre-setup example project for this PR.
Related Issues
Fixes #916
Checklist
CHANGELOG.md
nor thepubspec.yaml
files.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).