Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.

_i9.Future<String> Function(_i3.JavaScriptTextInputDialogRequest)?
onJavaScriptTextInputDialog) =>
(super.noSuchMethod(
Invocation.method(
#setOnJavaScriptTextInputDialog,
[onJavaScriptTextInputDialog],
),
returnValue: _i9.Future<void>.value(),
returnValueForMissingStub: _i9.Future<void>.value(),
) as _i9.Future<void>);
}

/// A class which mocks [AndroidWebViewProxy].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -584,19 +584,6 @@ class MockAndroidWebViewController extends _i1.Mock
returnValue: _i5.Future<void>.value(),
returnValueForMissingStub: _i5.Future<void>.value(),
) as _i5.Future<void>);

@override
_i5.Future<void> setOnJavaScriptTextInputDialog(
_i5.Future<String> Function(_i3.JavaScriptTextInputDialogRequest)?
onJavaScriptTextInputDialog) =>
(super.noSuchMethod(
Invocation.method(
#setOnJavaScriptTextInputDialog,
[onJavaScriptTextInputDialog],
),
returnValue: _i5.Future<void>.value(),
returnValueForMissingStub: _i5.Future<void>.value(),
) as _i5.Future<void>);
}

/// A class which mocks [TestInstanceManagerHostApi].
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.9.2

* Adds support to return `null` in `PlatformWebViewController.setOnJavaScriptTextInputDialog`.

## 2.9.1

* Updates minimum required plugin_platform_interface version to 2.1.7.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Collaborator

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
Collaborator

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
Collaborator

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.

onJavaScriptTextInputDialog) async {
throw UnimplementedError(
'setOnJavaScriptTextInputDialog is not implemented on the current platform',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/webview_flutt
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview_flutter%22
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 2.9.1
version: 2.9.2

environment:
sdk: ">=3.0.0 <4.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,20 @@ void main() {
throwsUnimplementedError,
);
});

test('setOnJavaScriptTextInputDialog should support returning a null value',
() {
final PlatformWebViewController controller =
ExtendsPlatformWebViewController(
const PlatformWebViewControllerCreationParams());

expect(
() => controller.setOnJavaScriptTextInputDialog((_) async {
return null;
}),
throwsUnimplementedError,
);
});
}

class MockWebViewPlatformWithMixin extends MockWebViewPlatform
Expand Down