[url_launcher] Move away from shared method channel implementation in native packages. #4719
[url_launcher] Move away from shared method channel implementation in native packages. #4719
Conversation
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.
Thanks for this cleanup! Mostly looks good, just some minor adjustments.
packages/url_launcher/url_launcher_android/lib/url_launcher_android.dart
Outdated
Show resolved
Hide resolved
packages/url_launcher/url_launcher_android/lib/url_launcher_android.dart
Outdated
Show resolved
Hide resolved
packages/url_launcher/url_launcher_android/test/url_launcher_android_test.dart
Outdated
Show resolved
Hide resolved
packages/url_launcher/url_launcher_android/test/url_launcher_android_test.dart
Outdated
Show resolved
Hide resolved
packages/url_launcher/url_launcher_ios/lib/url_launcher_ios.dart
Outdated
Show resolved
Hide resolved
packages/url_launcher/url_launcher_android/lib/url_launcher_android.dart
Show resolved
Hide resolved
packages/url_launcher/url_launcher_ios/test/url_launcher_ios_test.dart
Outdated
Show resolved
Hide resolved
packages/url_launcher/url_launcher_linux/lib/url_launcher_linux.dart
Outdated
Show resolved
Hide resolved
736995c
to
f63ef67
Compare
Implement PR Feedback Implement PR Feedback
f63ef67
to
27753d5
Compare
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.
LGTM with one nit (across 5 files)
return null; | ||
}); | ||
|
||
final UrlLauncherAndroid launcher = UrlLauncherAndroid(); |
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.
Minor nit: Please move this into each test. Having the object under test be part of the test fixture makes tests harder to understand, doesn't scale to tests that need to initialize things differently, and makes it much easier to accidentally have state bleed across tests (which I've seen cause tests to pass when they should have failed due to something that was set in a completely different test far more times than I would like).
While this object is so simple it may well never come up, it's an anti-pattern that I don't want to have (or at least, add new) examples of in the codebase. The risk is just not worth saving one statement per test.
return null; | ||
}); | ||
|
||
final UrlLauncherIOS launcher = UrlLauncherIOS(); |
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.
Same.
return null; | ||
}); | ||
|
||
final UrlLauncherLinux launcher = UrlLauncherLinux(); |
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.
Same.
return null; | ||
}); | ||
|
||
final UrlLauncherMacOS launcher = UrlLauncherMacOS(); |
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.
Same
return null; | ||
}); | ||
|
||
final UrlLauncherWindows launcher = UrlLauncherWindows(); |
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.
Same.
…ntation in native packages. (flutter/plugins#4719)
I think this change has broken the integration test of the core plugin for MissingPluginException(No implementation found for method canLaunch on channel: plugins.flutter.io/url_launcher) Stack traces: MacOS
Linux
This is the failing test: Maybe the build is not picking up the latest versions of the macos/linux plugins? Is the testing app missing some setup? |
Hmm, that's the wrong channel name, which suggests that registration of the Dart code isn't working correctly somehow. |
Is it maybe an issue with flutter drive not initializing the app correctly? |
I'm not quite sure what to do here. I cannot replicate the integration tests failing locally (at least on macos) and as far as I'm aware the checks on the PR itself ran just fine? Is this an issue with the changes I made or is this an issue with the CI? Should we revert? |
It's actually a latent bug in url_launcher itself from the initial addition of the federated packages. Linux and macOS have a typo in the |
We run |
Windows too, which I missed before. Also now retracted. |
… implementations (#4777) #4719 converted the url_launcher implementations to Dart-based versions. This should have been completely transparent to clients, but there is a latent bug in `url_launcher` where the `default_package` entries for Linux, macOS, and Windows are incorrect. This went unnoticed until now because currently the only client-facing effect of `default_package` is in resolving which implementation to run Dart registration for. Because of the typos in the `default_package` entries, the resolution in the `flutter` tool doesn't recognize the registration for these packages as needing to run, causing them to be broken at runtime. The affected versions have been retracted to fix the breakage in the short term. This is PR is the first half of the long-term fix; it re-releases them as a major version bump so that existing versions of `url_launcher` will not pick them up. Once they are published, a follow-up PR will update `url_launcher` to fix the typos and relax the version constraints for the dependencies on these implementation packages to allow 2.x or 3.x. (In theory this could be one PR, but doing it as two ensures that we get real testing on the `url_launcher` change, so is safer.) Part of a long-term fix for flutter/flutter#98097
The plugins in the flutter/plugins repo have been moved away from shared method channels in native plugins. In other words, the channel names have been renamed from "url_launcher" to "url_launcher_<platform>". See flutter/plugins#4719 and flutter/flutter#94224 for details.
The plugins in the flutter/plugins repo have been moved away from shared method channels in native plugins. In other words, the channel names have been renamed from `url_launcher` to `url_launcher_<platform>`. See flutter/plugins#4719 and flutter/flutter#94224 for details.
… implementations (#4777) flutter/plugins#4719 converted the url_launcher implementations to Dart-based versions. This should have been completely transparent to clients, but there is a latent bug in `url_launcher` where the `default_package` entries for Linux, macOS, and Windows are incorrect. This went unnoticed until now because currently the only client-facing effect of `default_package` is in resolving which implementation to run Dart registration for. Because of the typos in the `default_package` entries, the resolution in the `flutter` tool doesn't recognize the registration for these packages as needing to run, causing them to be broken at runtime. The affected versions have been retracted to fix the breakage in the short term. This is PR is the first half of the long-term fix; it re-releases them as a major version bump so that existing versions of `url_launcher` will not pick them up. Once they are published, a follow-up PR will update `url_launcher` to fix the typos and relax the version constraints for the dependencies on these implementation packages to allow 2.x or 3.x. (In theory this could be one PR, but doing it as two ensures that we get real testing on the `url_launcher` change, so is safer.) Part of a long-term fix for flutter/flutter#98097
This PR eliminates the use of the shared method channel implementation in each of the native packages for the url_launcher plugin.
The changes to each native package are pretty much identical to each other. Only interface implementations and tests irrelevant to the respective platform have been removed.
This PR's contents are based on the steps outlined in the following issue:
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].///
).