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

Conversation

@bparrishMines
Copy link
Contributor

@bparrishMines bparrishMines commented Oct 27, 2021

This transitions the Android implementation of the platform interface to mostly Dart code.

Generated Files:
packages/webview_flutter/webview_flutter_android/test/webview_widget_test.mocks.dart
packages/webview_flutter/webview_flutter_android/test/android_webview_test.mocks.dart
packages/webview_flutter/webview_flutter_android/lib/src/android_webview.pigeon.dart
packages/webview_flutter/webview_flutter_android/test/android_webview.pigeon.dart

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Note that unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin 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.
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@stuartmorgan-g
Copy link
Contributor

Where are the unit tests for webview_widget.dart? We should have unit tests for the Dart implementation just as we've been adding native unit tests for native implementations. Integration tests are useful, but shouldn't be a replacement.

/// an exception.
Future<void> release() {
final WebViewClient? webViewClient = _currentWebViewClient;
if (webViewClient != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

In what case would these be null before calling release()?


final DownloadListener? downloadListener = _currentDownloadListener;
if (downloadListener != null) {
DownloadListener.api.disposeFromInstance(downloadListener);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any way to push this logic into another method since it's repeated?

sdk: flutter
webview_flutter_platform_interface: ^1.0.0
webview_flutter_android: ^2.0.13
webview_flutter_android: 2.0.13
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unit tests fail because the default target platform is Android. Which now makes unmocked pigeon calls on creation. This can be fixed in a follow up PR to update tests to always run with a test WebViewPlatform.

Copy link
Contributor

Choose a reason for hiding this comment

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

Couldn't we land that change first, instead of having to temporarily pin the version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's probably the best solution. I'll create a PR for this now.

@bparrishMines bparrishMines changed the title Transition Platform Implementation to Pigeon API [WIP] Transition Platform Implementation to Pigeon API Oct 28, 2021
@bparrishMines
Copy link
Contributor Author

bparrishMines commented Oct 29, 2021

@stuartmorgan @camsim99 @mvanbeusekom @blasten This PR has became too big and does too many different things. I split this PR into 4 separate ones. Here are the first 3:

#4459
#4460
#4461

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes p: webview_flutter Edits files for a webview_flutter plugin platform-android

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants