-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[local_auth] Convert Android to Pigeon #3748
[local_auth] Convert Android to Pigeon #3748
Conversation
/* | ||
* Stops the authentication if in progress. | ||
*/ | ||
private void stopAuthentication(Result result) { |
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.
Almost all of the "removed" code in this removed-code diff block is actually just moved up inline into the new Pigeon API implementation functions above.
binding.addActivityResultListener(resultListener); | ||
setServicesFromActivity(binding.getActivity()); | ||
lifecycle = FlutterLifecycleAdapter.getActivityLifecycle(binding); | ||
channel.setMethodCallHandler(this); |
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.
We're no longer creating and removing the channel as part of the activity lifecycle. It's inconvenient to do with Pigeon (since we need the messenger), and I don't see any need for it since we're checking the activity in the necessary functions anyway. In fact, I think with the old code people would see "missing plugin" exceptions instead of our "this plugin needs a foreground activity" errors, which seems strictly worse.
flutter/packages@faf53fb...88591be 2023-04-19 engine-flutter-autoroll@skia.org Roll Flutter from 42fb0b2 to 3476b96 (20 revisions) (flutter/packages#3760) 2023-04-19 49699333+dependabot[bot]@users.noreply.github.com Bump cirrusci/flutter from `794fbbc` to `d99b1ba` in /.ci (flutter/packages#3724) 2023-04-18 10687576+bparrishMines@users.noreply.github.com [webview_flutter] Adds support to listen to url changes (flutter/packages#3313) 2023-04-18 engine-flutter-autoroll@skia.org Roll Flutter from 15cb1f8 to 42fb0b2 (19 revisions) (flutter/packages#3756) 2023-04-18 49699333+dependabot[bot]@users.noreply.github.com [webview]: Bump com.android.tools.build:gradle from 7.2.2 to 8.0.0 in /packages/webview_flutter/webview_flutter_android/android (flutter/packages#3739) 2023-04-18 stuartmorgan@google.com [local_auth] Convert Android to Pigeon (flutter/packages#3748) 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 flutter-ecosystem@google.com,rmistry@google.com 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
When we updated from 1.0.21 to 1.0.23 we started getting this error:
|
Please file issues in the issue tracker. |
The Pigeon conversion in flutter#3748 used a `List<enum>` return value, which Pigeon doesn't support correctly (see flutter/flutter#125230 for catching this earlier next time). Because the method doesn't return any values in integration test environments it wasn't caught (since the issue is in Pigeon message handling, and thus doesn't show up in unit tests of the plugin). This adds a wrapper class, since enum fields do work. Fixes flutter/flutter#125214
The Pigeon conversion in flutter#3748 used a `List<enum>` return value, which Pigeon doesn't support correctly (see flutter/flutter#125230 for catching this earlier next time). Because the method doesn't return any values in integration test environments it wasn't caught (since the issue is in Pigeon message handling, and thus doesn't show up in unit tests of the plugin). This adds a wrapper class, since enum fields do work. Fixes flutter/flutter#125214
Sorry, next time i'll file an issue. Found that there already exists one: flutter/flutter#125236 |
The Pigeon conversion in #3748 used a `List<enum>` return value, which Pigeon doesn't support correctly (see flutter/flutter#125230 for catching this earlier next time). Because the method doesn't return any values in integration test environments it wasn't caught (since the issue is in Pigeon message handling, and thus doesn't show up in unit tests of the plugin). This adds a wrapper class, since enum fields do work. Fixes flutter/flutter#125214
Updates the platform communication to use Pigeon. This includes some changes to the API boundary: - Collected authentication options into an options object; this avoids having a lot of positional boolean arguments (since Pigeon doesn't currently support named arguments). - Collected strings into a strings object, since having them as individual parameters would have been extremely messy. - Changes the `authenticate` return from a bool+exceptions to an enum that encompasses all of the explicitly known failure modes. To avoid a breaking change for clients, the Dart code creates `PlatformException`s that match the old ones, but this will make it much easier to someday make a (cross-platform) breaking change to replace them with better errors per the best practices we have documented on the wiki. Using an enum rather than throwing errors avoids the need to do string matching when we want to eventually translate them into something other than `PlatformException`. The Pigeon file, Dart implementation, and rewritten tests are all based very heavily on the recent Android migration: #3748 I noted several bugs that I noticed in the existing implementation during the migration. I intentionally didn't fix them so this isn't changing behavior at the same time that it's changing so much of the code and tests, but I marked them with TODO comments. Fixes flutter/flutter#117912
Updates the platform communication to use Pigeon. This includes some changes to the API boundary: - Collected authentication options into an options object; this avoids having a lot of positional boolean arguments (since Pigeon doesn't currently support named arguments). - Collected strings into a strings object, since having them as individual parameters would have been extremely messy. - Changes the `authenticate` return from a bool+exceptions to an enum that encompasses all of the explicitly known failure modes. To avoid a breaking change for clients, the Dart code creates `PlatformException`s that match the old ones, but this will make it much easier to someday make a (cross-platform) breaking change to replace them with better errors per the best practices we have documented on the wiki. Using an enum rather than throwing errors avoids the need to do string matching when we want to eventually translate them into something other than `PlatformException`. This removes all Java warnings from the baseline file; the remaining issues in code I wasn't already changing were easy enough to fix opportunistically. There are still XML-based warnings, but fixing those was well out of scope so I left them. Part of flutter/flutter#117912
The Pigeon conversion in flutter#3748 used a `List<enum>` return value, which Pigeon doesn't support correctly (see flutter/flutter#125230 for catching this earlier next time). Because the method doesn't return any values in integration test environments it wasn't caught (since the issue is in Pigeon message handling, and thus doesn't show up in unit tests of the plugin). This adds a wrapper class, since enum fields do work. Fixes flutter/flutter#125214
Updates the platform communication to use Pigeon. This includes some changes to the API boundary: - Collected authentication options into an options object; this avoids having a lot of positional boolean arguments (since Pigeon doesn't currently support named arguments). - Collected strings into a strings object, since having them as individual parameters would have been extremely messy. - Changes the `authenticate` return from a bool+exceptions to an enum that encompasses all of the explicitly known failure modes. To avoid a breaking change for clients, the Dart code creates `PlatformException`s that match the old ones, but this will make it much easier to someday make a (cross-platform) breaking change to replace them with better errors per the best practices we have documented on the wiki. Using an enum rather than throwing errors avoids the need to do string matching when we want to eventually translate them into something other than `PlatformException`. The Pigeon file, Dart implementation, and rewritten tests are all based very heavily on the recent Android migration: flutter#3748 I noted several bugs that I noticed in the existing implementation during the migration. I intentionally didn't fix them so this isn't changing behavior at the same time that it's changing so much of the code and tests, but I marked them with TODO comments. Fixes flutter/flutter#117912
Updates the platform communication to use Pigeon. This includes some changes to the API boundary:
authenticate
return from a bool+exceptions to an enum that encompasses all of the explicitly known failure modes. To avoid a breaking change for clients, the Dart code createsPlatformException
s that match the old ones, but this will make it much easier to someday make a (cross-platform) breaking change to replace them with better errors per the best practices we have documented on the wiki. Using an enum rather than throwing errors avoids the need to do string matching when we want to eventually translate them into something other thanPlatformException
.This removes all Java warnings from the baseline file; the remaining issues in code I wasn't already changing were easy enough to fix opportunistically. There are still XML-based warnings, but fixing those was well out of scope so I left them.
Part of flutter/flutter#117912
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to 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.