mirror of
https://github.com/flutter/packages.git
synced 2025-06-29 22:33:11 +08:00
[webview_flutter_platform_interface] Adds support for retrieving user agent (#4563)
Platform interface portion of https://github.com/flutter/packages/pull/4472
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
## 2.5.0
|
||||||
|
|
||||||
|
* Adds support to retrieve the user agent. See `PlatformWebViewController.getUserAgent`.
|
||||||
|
|
||||||
## 2.4.0
|
## 2.4.0
|
||||||
|
|
||||||
* Adds support to retrieve the url from a web resource loading error. See `WebResourceError.url`.
|
* Adds support to retrieve the url from a web resource loading error. See `WebResourceError.url`.
|
||||||
|
@ -270,6 +270,13 @@ abstract class PlatformWebViewController extends PlatformInterface {
|
|||||||
'setOnPermissionRequest is not implemented on the current platform',
|
'setOnPermissionRequest is not implemented on the current platform',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Gets the value used for the HTTP `User-Agent:` request header.
|
||||||
|
Future<String?> getUserAgent() {
|
||||||
|
throw UnimplementedError(
|
||||||
|
'getUserAgent is not implemented on the current platform',
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Describes the parameters necessary for registering a JavaScript channel.
|
/// Describes the parameters necessary for registering a JavaScript channel.
|
||||||
|
@ -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
|
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
|
# 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
|
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
|
||||||
version: 2.4.0
|
version: 2.5.0
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.18.0 <4.0.0"
|
sdk: ">=2.18.0 <4.0.0"
|
||||||
|
@ -387,6 +387,19 @@ void main() {
|
|||||||
throwsUnimplementedError,
|
throwsUnimplementedError,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test(
|
||||||
|
'Default implementation of getUserAgent should throw unimplemented error',
|
||||||
|
() {
|
||||||
|
final PlatformWebViewController controller =
|
||||||
|
ExtendsPlatformWebViewController(
|
||||||
|
const PlatformWebViewControllerCreationParams());
|
||||||
|
|
||||||
|
expect(
|
||||||
|
() => controller.getUserAgent(),
|
||||||
|
throwsUnimplementedError,
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
class MockWebViewPlatformWithMixin extends MockWebViewPlatform
|
class MockWebViewPlatformWithMixin extends MockWebViewPlatform
|
||||||
|
Reference in New Issue
Block a user