Skip to content
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

[webview_flutter_platform_interface] Adds support to return null in PlatformWebViewController.setOnJavaScriptTextInputDialog #5901

Closed

Conversation

bparrishMines
Copy link
Contributor

Based on the documentation for prompt and WebChromClient.onJsPrompt, this method should support returning a null value for the scenario that a user cancels the operation to enter text.

Side note: It seems reasonable the confirm dialog can just return false if the user cancels the operation, so no changes to that one.

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. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • 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.
  • All existing and new tests are passing.

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

@bparrishMines
Copy link
Contributor Author

Whoops it looks like I forgot the android implementation was already submitted.

@@ -870,19 +870,6 @@ class MockAndroidWebViewController extends _i1.Mock
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);

@override
_i9.Future<void> setOnJavaScriptTextInputDialog(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

#5796 has not landed yet, so I removed these generated overrides to have the pathified test pass.

@@ -318,7 +318,7 @@ abstract class PlatformWebViewController extends PlatformInterface {
/// Sets a callback that notifies the host application that the web page
/// wants to display a JavaScript prompt() dialog.
Future<void> setOnJavaScriptTextInputDialog(
Future<String> Function(JavaScriptTextInputDialogRequest request)
Future<String?> Function(JavaScriptTextInputDialogRequest request)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a breaking change; we'll need to make a replacement method instead (e.g., setOnJavaScriptTextInputDialogCancelable).

We should also document what null means in its doc comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there not a way to submit this without a breaking change? The Android and iOS implementation PRs have not landed yet.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's already breaking our own tests in other packages to try to change it, and there's no reason a third-party implementation of webview_flutter couldn't already be relying on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thats fair. I'll create a separate method for it. It's unfortunate that I didn't catch this earlier.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, the reason I set the process up to have the individual PRs only split out once the combined PR has been fully reviewed is to try to avoid this kind of thing, but it's inevitable that sometimes we just won't notice things until that final read-through.

@bparrishMines
Copy link
Contributor Author

closing since this isn't on my current list of todos. Added flutter/flutter#145799 to track interest.

@bparrishMines bparrishMines deleted the webview_textInput_nullable branch March 27, 2024 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants