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

Commit 58d215d

Browse files
[webview_flutter] Revert addition of onUrlChanged (#4524)
Reverts #4509, which is ecosystem-breaking since it adds a new method to the interface that no existing code implements. Note that while this PR is technically a breaking change, it is deliberately versioned as a non-breaking change so that people will automatically pick up the fix for the previous accidentally-breaking change. (In practice, this revert would only breaking if someone implemented this new method in an unendorsed webview implementation sometime in the last ~12 hours that the change was live).
1 parent ebf689d commit 58d215d

File tree

5 files changed

+10
-51
lines changed

5 files changed

+10
-51
lines changed

packages/webview_flutter/webview_flutter_platform_interface/CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.5.1
2+
3+
* Reverts the addition of `onUrlChanged`, which was unintentionally a breaking
4+
change.
5+
16
## 1.5.0
27

38
* Added `onUrlChanged` callback to platform callback handler.
@@ -20,4 +25,4 @@
2025

2126
## 1.0.0
2227

23-
* Extracted platform interface from `webview_flutter`.
28+
* Extracted platform interface from `webview_flutter`.

packages/webview_flutter/webview_flutter_platform_interface/lib/src/method_channel/webview_method_channel.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ class MethodChannelWebViewPlatform implements WebViewPlatformController {
5353
case 'onPageStarted':
5454
_platformCallbacksHandler.onPageStarted(call.arguments['url']!);
5555
return null;
56-
case 'onUrlChanged':
57-
_platformCallbacksHandler.onUrlChanged(call.arguments['url']!);
58-
return null;
5956
case 'onWebResourceError':
6057
_platformCallbacksHandler.onWebResourceError(
6158
WebResourceError(

packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_interface/webview_platform_callbacks_handler.dart

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,9 @@ abstract class WebViewPlatformCallbacksHandler {
2424
void onPageFinished(String url);
2525

2626
/// Invoked by [WebViewPlatformController] when a page is loading.
27-
/// Only works when [WebSettings.hasProgressTracking] is set to `true`.
27+
/// /// Only works when [WebSettings.hasProgressTracking] is set to `true`.
2828
void onProgress(int progress);
2929

30-
/// Invoked by [WebViewPlatformController] when the webview's URL has changed.
31-
///
32-
/// Unlike [onPageStarted], [onProgress], and [onPageFinished],
33-
/// [onUrlChanged] also fires when navigating without a full page load
34-
/// e.g. when navigating within a single page application.
35-
void onUrlChanged(String url);
36-
3730
/// Report web resource loading error to the host application.
3831
void onWebResourceError(WebResourceError error);
3932
}

packages/webview_flutter/webview_flutter_platform_interface/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ repository: https://github.com/flutter/plugins/tree/master/packages/webview_flut
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview_flutter%22
55
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
66
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
7-
version: 1.5.0
7+
version: 1.5.1
88

99
environment:
1010
sdk: ">=2.12.0 <3.0.0"
@@ -19,4 +19,4 @@ dev_dependencies:
1919
flutter_test:
2020
sdk: flutter
2121
mockito: ^5.0.0
22-
pedantic: ^1.10.0
22+
pedantic: ^1.10.0

packages/webview_flutter/webview_flutter_platform_interface/test/src/method_channel/webview_method_channel_test.dart

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ import 'package:webview_flutter_platform_interface/webview_flutter_platform_inte
1313
void main() {
1414
TestWidgetsFlutterBinding.ensureInitialized();
1515

16-
group(
17-
'Tests on `plugin.flutter.io/webview_<channel_id>` channel dart->native',
18-
() {
16+
group('Tests on `plugin.flutter.io/webview_<channel_id>` channel', () {
1917
const int channelId = 1;
2018
const MethodChannel channel =
2119
MethodChannel('plugins.flutter.io/webview_$channelId');
@@ -556,40 +554,6 @@ void main() {
556554
});
557555
});
558556

559-
group(
560-
'Tests on `plugin.flutter.io/webview_<channel_id>` channel native->dart',
561-
() {
562-
const int channelId = 1;
563-
final WebViewPlatformCallbacksHandler callbacksHandler =
564-
MockWebViewPlatformCallbacksHandler();
565-
final JavascriptChannelRegistry javascriptChannelRegistry =
566-
MockJavascriptChannelRegistry();
567-
568-
MethodChannelWebViewPlatform(
569-
channelId,
570-
callbacksHandler,
571-
javascriptChannelRegistry,
572-
);
573-
574-
tearDown(() {
575-
reset(callbacksHandler);
576-
});
577-
578-
test('onUrlChanged', () async {
579-
// Run
580-
await ServicesBinding.instance!.defaultBinaryMessenger
581-
.handlePlatformMessage(
582-
'plugins.flutter.io/webview_$channelId',
583-
StandardMethodCodec()
584-
.encodeMethodCall(MethodCall('onUrlChanged', {'url': 'Test Url'})),
585-
null,
586-
);
587-
588-
// Verify
589-
verify(callbacksHandler.onUrlChanged('Test Url'));
590-
});
591-
});
592-
593557
group('Tests on `plugins.flutter.io/cookie_manager` channel', () {
594558
const MethodChannel cookieChannel =
595559
MethodChannel('plugins.flutter.io/cookie_manager');

0 commit comments

Comments
 (0)