-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[url_launcher] Convert Android to Pigeon #4045
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
[url_launcher] Convert Android to Pigeon #4045
Conversation
| context, | ||
| intent -> { | ||
| ComponentName componentName = intent.resolveActivity(context.getPackageManager()); | ||
| return componentName == null ? null : componentName.toShortString(); |
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.
I was able to narrow the code that's not being unit tested from "all of UrlLauncher" to just these two lines (which come from the old canLaunch). I spent some time looking at this, and didn't see how to mock enough of context to make intent.resolveActivity return a dummy ComponentName, so I just extracted this one small piece into something tests could replace.
| NO_ACTIVITY, | ||
| /** No Activity found that can handle given intent. */ | ||
| ACTIVITY_NOT_FOUND, | ||
| private static @NonNull Bundle extractBundle(Map<String, String> headersMap) { |
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.
This, and the strings in the error in ensureActivity, are the surviving code from MethodCallHandlerImpl.
gmackall
left a comment
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.
This LGTM, though I haven't reviewed any conversions to pigeon before. In your opinion is this a change that it would be good for me to find a second reviewer on, or is the perceived risk low?
|
The pigeon surface here is quite small, so between that and the expanded native unit testing I think the risk is pretty low. |
|
@stuartmorgan This is causing a failure on main: |
Fixes `unawaited_futures` lint errors from #4045. This only updates the tests, so no version bump. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [relevant style guides] and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use `dart format`.) - [x] I signed the [CLA]. - [x] The title of the PR starts with the name of the package surrounded by square brackets, e.g. `[shared_preferences]` - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated `pubspec.yaml` with an appropriate new version according to the [pub versioning philosophy], or this PR is [exempt from version changes]. - [ ] I updated `CHANGELOG.md` to add a description of the change, [following repository CHANGELOG style]. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/packages/blob/main/CONTRIBUTING.md [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [relevant style guides]: https://github.com/flutter/packages/blob/main/CONTRIBUTING.md#style [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat [pub versioning philosophy]: https://dart.dev/tools/pub/versioning [exempt from version changes]: https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#version-and-changelog-updates [following repository CHANGELOG style]: https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changelog-style [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
flutter/packages@995bfc5...9f8dcc5 2023-05-25 [email protected] Append $flutter/osx sdk property to existing platforms/targets relying on xcode (flutter/packages#4074) 2023-05-25 [email protected] [url_launcher_android] Fix `unawaited_futures` lint errors (flutter/packages#4086) 2023-05-25 [email protected] [url_launcher] Convert Android to Pigeon (flutter/packages#4045) 2023-05-25 [email protected] [multiple packages] Update collection-fors to prefer final (as per updated `prefer_final_in_for_each`) (flutter/packages#4073) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
|
I catch an error on build android: anyone else with this? |
|
@rafaelmeteoro Could you open a new issue with an explanation of when you are seeing this error? https://github.com/flutter/flutter/issues/new/choose |
Converts from direct use of method channels to using Pigeon.
Adds unit testing of the actual implementation logic. The previous unit tests only covered the intermediate class that converted method calls/arguments into Java calls, which has been removed since that's now handled by Pigeon.
Part of flutter/flutter#117915
Pre-launch Checklist
dart format.)[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.