[share_plus] Migrate Android part to Kotlin#666
[share_plus] Migrate Android part to Kotlin#666vbuberen merged 11 commits intofluttercommunity:mainfrom
Conversation
| when (call.method) { | ||
| "share" -> { | ||
| expectMapArguments(call) | ||
| // Android does not support showing the share sheet at a particular point on screen. |
There was a problem hiding this comment.
Tried to preserve all the original code comments
| putExtra(Intent.EXTRA_SUBJECT, subject) | ||
| } | ||
|
|
||
| val chooserIntent = Intent.createChooser(shareIntent, null /* dialog title optional */) |
There was a problem hiding this comment.
Tried to preserve all the original code comments.
I believe at a later point we could provide additional parameter to let users set the title for this chooser.
|
|
||
| override fun onAttachedToEngine(binding: FlutterPluginBinding) { | ||
| methodChannel = MethodChannel(binding.binaryMessenger, CHANNEL) | ||
| share = Share(context = binding.applicationContext, activity = null) |
There was a problem hiding this comment.
Explicitly specified names of parameters for better readability on Github
|
The failing pub.dev check is due to #655 and failing tests are caused by a flaky test in |
miquelbeltran
left a comment
There was a problem hiding this comment.
Looks good! sorry for the late review
|
Thanks. Will make a few updates, since it is quite a lot of time passed and there are newer versions of Gradle, etc. available. |
Description
This is first of PRs to migrate Android parts of Plus plugins to Kotlin in order to modernise the code, provider better null-safety handling and, potentially, helping engage more contributors with Kotlin experience.
The migration is done manually, not via Java to Kotlin converter to avoid possible potential issues. I tried to not change the behavior as much as I could (however, in some places I added some additional checks) while using all the Kotlin possibilities. Everything works in a same way as it worked before, but the code is much more concise.
With this PR we are getting to the point where we would not need
google-java-formatanymore. I suggest to replace it with a combination of KtLint + Detekt, which I would add in a separate PR.Did a minor version change, since there were no breaking changes.
I plan to do the same migrations for the other plugins we have in Plus plugins.
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]).This will ensure a smooth and quick review process. Updating the
pubspec.yamland changelogs is not required.///).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?