Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Conversation

@ened
Copy link
Contributor

@ened ened commented Mar 11, 2020

Description

As outlined in flutter/flutter#51942, I needed a method to check whether a particular activity is reachable on a target device.

I have marked the PR WIP for the following reasons:

  • canResolve currently only checks for Activities, using this method [resolveActivity(android.content.Intent,%20int)](https://developer.android.com/reference/android/content/pm/PackageManager#resolveActivity(android.content.Intent, int)) . It also sets a default flag here.
    • there is also resolveService & resolveContentProvider which can be helpful respectively. I don't see the need for them just yet
    • the passed flag is fixed to PackageManager.MATCHDEFAULTONLY, which somewhat makes sense for activities. It could be copied to the dart side so that developers can specify it
    • the resolve* methods return information on, well, how to resolve a component. We can't do much with it on flutter side, so I would assume we don't need to pass that up
  • the name canResolve could be replaced with canLaunch (to follow url_launcher).

Related Issues

Fixes flutter/flutter#51942.

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.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • [] All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (flutter analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • No, this is not a breaking change.

@ened ened requested a review from matthew-carroll March 11, 2020 07:47
@ened ened requested a review from mklim as a code owner March 11, 2020 07:47
@ened ened changed the title [android_intent] Adds canResolve method WIP [android_intent] Adds canResolve method Mar 11, 2020
Copy link
Contributor

@mklim mklim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! LGTM modulo some nits.

@ened ened changed the title WIP [android_intent] Adds canResolve method [android_intent] Adds canResolve method Mar 25, 2020
@ened
Copy link
Contributor Author

ened commented Mar 25, 2020

@mklim thank you for reviewing. Have added a few more tests & addressed your feedback. Do you know why the "submit-queue" check failed?

I assume the submit-queue check fails because currently master does not build. As the message says. Doh. :)

@ened ened changed the title [android_intent] Adds canResolve method [android_intent] Adds canResolveActivity method Mar 26, 2020
@ened
Copy link
Contributor Author

ened commented Mar 27, 2020

@mklim still happy after the extended unit test? If so I shall merge soon. :)

Copy link
Contributor

@mklim mklim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about the delay, still LGTM!

@ened ened merged commit c03166b into flutter:master Apr 4, 2020
jerryzhoujw pushed a commit to jerryzhoujw/plugins that referenced this pull request Apr 10, 2020
@ened
Copy link
Contributor Author

ened commented Apr 17, 2020

@mklim could you please help to get this new version (0.3.7) uploaded to pub ?

@mklim
Copy link
Contributor

mklim commented Apr 17, 2020

@ened sorry about the delay, done.

EdwinRomelta pushed a commit to EdwinRomelta/plugins that referenced this pull request Jun 11, 2020
jorgefspereira pushed a commit to jorgefspereira/plugins_flutter that referenced this pull request Oct 10, 2020
FlutterSu pushed a commit to FlutterSu/flutter-plugins that referenced this pull request Nov 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[android_intent] Plugin should gain a "canResolve" method

3 participants