From cfb462ba2084174be8507ab604374675efd0187b Mon Sep 17 00:00:00 2001 From: "swan.seo" <swan.seo@samsung.com> Date: Mon, 20 Nov 2023 15:02:07 +0900 Subject: [PATCH 1/6] Add topics --- packages/webview_flutter_lwe/pubspec.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/webview_flutter_lwe/pubspec.yaml b/packages/webview_flutter_lwe/pubspec.yaml index fc7e5d3aa..a298ee7cb 100644 --- a/packages/webview_flutter_lwe/pubspec.yaml +++ b/packages/webview_flutter_lwe/pubspec.yaml @@ -22,3 +22,8 @@ dependencies: flutter_tizen: ^0.2.1 webview_flutter: ^4.0.2 webview_flutter_platform_interface: ^2.0.1 + +topics: + - html + - webview + - webview-flutter From 2a1fee3c31312d23543a734bf9d7cafb25c7a8e5 Mon Sep 17 00:00:00 2001 From: "swan.seo" <swan.seo@samsung.com> Date: Mon, 20 Nov 2023 15:33:34 +0900 Subject: [PATCH 2/6] Implement getUserAgent --- packages/webview_flutter_lwe/lib/src/lwe_webview.dart | 8 +++++++- .../lib/src/lwe_webview_controller.dart | 3 +++ packages/webview_flutter_lwe/tizen/src/webview.cc | 5 ++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/webview_flutter_lwe/lib/src/lwe_webview.dart b/packages/webview_flutter_lwe/lib/src/lwe_webview.dart index 6f7f38e4d..7241fa8b5 100644 --- a/packages/webview_flutter_lwe/lib/src/lwe_webview.dart +++ b/packages/webview_flutter_lwe/lib/src/lwe_webview.dart @@ -195,5 +195,11 @@ class LweWebView { /// Sets the value used for the HTTP `User-Agent:` request header. Future<void> setUserAgent(String? userAgent) => - _invokeChannelMethod<void>('userAgent', userAgent); + _invokeChannelMethod<void>('setUserAgent', userAgent); + + /// Gets the HTTP 'User-Agent:' request header. + Future<String?> getUserAgent() async { + final String? result = await _invokeChannelMethod<String?>('getUserAgent'); + return result; + } } diff --git a/packages/webview_flutter_lwe/lib/src/lwe_webview_controller.dart b/packages/webview_flutter_lwe/lib/src/lwe_webview_controller.dart index 8ea9a13ba..0514a0476 100644 --- a/packages/webview_flutter_lwe/lib/src/lwe_webview_controller.dart +++ b/packages/webview_flutter_lwe/lib/src/lwe_webview_controller.dart @@ -159,6 +159,9 @@ class LweWebViewController extends PlatformWebViewController { @override Future<void> setUserAgent(String? userAgent) => _webview.setUserAgent(userAgent); + + @override + Future<String?> getUserAgent() => _webview.getUserAgent(); } /// An implementation of [PlatformWebViewWidget] with the Lightweight Web Engine. diff --git a/packages/webview_flutter_lwe/tizen/src/webview.cc b/packages/webview_flutter_lwe/tizen/src/webview.cc index 8da28c138..7b9e7b3f7 100644 --- a/packages/webview_flutter_lwe/tizen/src/webview.cc +++ b/packages/webview_flutter_lwe/tizen/src/webview.cc @@ -710,7 +710,7 @@ void WebView::HandleWebViewMethodCall(const FlMethodCall& method_call, webview_instance_->SetSettings(settings); result->Success(); } - } else if (method_name == "userAgent") { + } else if (method_name == "setUserAgent") { const auto* user_agent = std::get_if<std::string>(arguments); if (user_agent) { LWE::Settings settings = webview_instance_->GetSettings(); @@ -718,6 +718,9 @@ void WebView::HandleWebViewMethodCall(const FlMethodCall& method_call, webview_instance_->SetSettings(settings); } result->Success(); + } else if (method_name == "getUserAgent") { + LWE::Settings settings = webview_instance_->GetSettings(); + result->Success(flutter::EncodableValue(settings.GetUserAgentString())); } else if (method_name == "setCookie") { result->NotImplemented(); } else { From 24c1106ad0f103a3c47b81db5358800853a65b82 Mon Sep 17 00:00:00 2001 From: "swan.seo" <swan.seo@samsung.com> Date: Mon, 20 Nov 2023 22:09:58 +0900 Subject: [PATCH 3/6] Update integration_test --- .../webview_flutter_test.dart | 204 ++++++++---------- .../lib/src/lwe_webview_controller.dart | 16 +- 2 files changed, 108 insertions(+), 112 deletions(-) diff --git a/packages/webview_flutter_lwe/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter_lwe/example/integration_test/webview_flutter_test.dart index e92333058..dc2a0f24a 100644 --- a/packages/webview_flutter_lwe/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter_lwe/example/integration_test/webview_flutter_test.dart @@ -20,7 +20,7 @@ Future<void> main() async { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); final HttpServer server = await HttpServer.bind(InternetAddress.anyIPv4, 0); - server.forEach((HttpRequest request) { + unawaited(server.forEach((HttpRequest request) { if (request.uri.path == '/hello.txt') { request.response.writeln('Hello, world.'); } else if (request.uri.path == '/secondary.txt') { @@ -33,7 +33,7 @@ Future<void> main() async { fail('unexpected request: ${request.method} ${request.uri}'); } request.response.close(); - }); + })); final String prefixUrl = 'http://${server.address.address}:${server.port}'; final String primaryUrl = '$prefixUrl/hello.txt'; final String secondaryUrl = '$prefixUrl/secondary.txt'; @@ -41,11 +41,11 @@ Future<void> main() async { testWidgets('loadRequest', (WidgetTester tester) async { final Completer<void> pageFinished = Completer<void>(); - final WebViewController controller = WebViewController() - ..setNavigationDelegate( - NavigationDelegate(onPageFinished: (_) => pageFinished.complete()), - ) - ..loadRequest(Uri.parse(primaryUrl)); + final WebViewController controller = WebViewController(); + unawaited(controller.setNavigationDelegate( + NavigationDelegate(onPageFinished: (_) => pageFinished.complete()), + )); + unawaited(controller.loadRequest(Uri.parse(primaryUrl))); await tester.pumpWidget(WebViewWidget(controller: controller)); @@ -58,12 +58,12 @@ Future<void> main() async { testWidgets('runJavaScriptReturningResult', (WidgetTester tester) async { final Completer<void> pageFinished = Completer<void>(); - final WebViewController controller = WebViewController() - ..setJavaScriptMode(JavaScriptMode.unrestricted) - ..setNavigationDelegate( - NavigationDelegate(onPageFinished: (_) => pageFinished.complete()), - ) - ..loadRequest(Uri.parse(primaryUrl)); + final WebViewController controller = WebViewController(); + unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); + unawaited(controller.setNavigationDelegate( + NavigationDelegate(onPageFinished: (_) => pageFinished.complete()), + )); + unawaited(controller.loadRequest(Uri.parse(primaryUrl))); await tester.pumpWidget(WebViewWidget(controller: controller)); @@ -77,11 +77,11 @@ Future<void> main() async { testWidgets('JavascriptChannel', (WidgetTester tester) async { final Completer<void> pageFinished = Completer<void>(); - final WebViewController controller = WebViewController() - ..setJavaScriptMode(JavaScriptMode.unrestricted) - ..setNavigationDelegate( - NavigationDelegate(onPageFinished: (_) => pageFinished.complete()), - ); + final WebViewController controller = WebViewController(); + unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); + unawaited(controller.setNavigationDelegate( + NavigationDelegate(onPageFinished: (_) => pageFinished.complete()), + )); final Completer<String> channelCompleter = Completer<String>(); await controller.addJavaScriptChannel( @@ -138,19 +138,19 @@ Future<void> main() async { testWidgets('set custom userAgent', (WidgetTester tester) async { final Completer<void> pageFinished = Completer<void>(); - final WebViewController controller = WebViewController() - ..setJavaScriptMode(JavaScriptMode.unrestricted) - ..setNavigationDelegate(NavigationDelegate( - onPageFinished: (_) => pageFinished.complete(), - )) - ..setUserAgent('Custom_User_Agent1') - ..loadRequest(Uri.parse('about:blank')); + final WebViewController controller = WebViewController(); + unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); + unawaited(controller.setNavigationDelegate(NavigationDelegate( + onPageFinished: (_) => pageFinished.complete(), + ))); + unawaited(controller.setUserAgent('Custom_User_Agent1')); + unawaited(controller.loadRequest(Uri.parse('about:blank'))); await tester.pumpWidget(WebViewWidget(controller: controller)); await pageFinished.future; - final String customUserAgent = await _getUserAgent(controller); + final String? customUserAgent = await controller.getUserAgent(); expect(customUserAgent, 'Custom_User_Agent1'); }); @@ -167,14 +167,14 @@ Future<void> main() async { base64Encode(const Utf8Encoder().convert(getTitleTest)); final Completer<void> pageLoaded = Completer<void>(); - final WebViewController controller = WebViewController() - ..setJavaScriptMode(JavaScriptMode.unrestricted) - ..setNavigationDelegate(NavigationDelegate( - onPageFinished: (_) => pageLoaded.complete(), - )) - ..loadRequest( - Uri.parse('data:text/html;charset=utf-8;base64,$getTitleTestBase64'), - ); + final WebViewController controller = WebViewController(); + unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); + unawaited(controller.setNavigationDelegate(NavigationDelegate( + onPageFinished: (_) => pageLoaded.complete(), + ))); + unawaited(controller.loadRequest( + Uri.parse('data:text/html;charset=utf-8;base64,$getTitleTestBase64'), + )); await tester.pumpWidget(WebViewWidget(controller: controller)); @@ -217,14 +217,14 @@ Future<void> main() async { base64Encode(const Utf8Encoder().convert(scrollTestPage)); final Completer<void> pageLoaded = Completer<void>(); - final WebViewController controller = WebViewController() - ..setJavaScriptMode(JavaScriptMode.unrestricted) - ..setNavigationDelegate(NavigationDelegate( - onPageFinished: (_) => pageLoaded.complete(), - )) - ..loadRequest(Uri.parse( - 'data:text/html;charset=utf-8;base64,$scrollTestPageBase64', - )); + final WebViewController controller = WebViewController(); + unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); + unawaited(controller.setNavigationDelegate(NavigationDelegate( + onPageFinished: (_) => pageLoaded.complete(), + ))); + unawaited(controller.loadRequest(Uri.parse( + 'data:text/html;charset=utf-8;base64,$scrollTestPageBase64', + ))); await tester.pumpWidget(WebViewWidget(controller: controller)); @@ -264,20 +264,20 @@ Future<void> main() async { testWidgets('can allow requests', (WidgetTester tester) async { Completer<void> pageLoaded = Completer<void>(); - final WebViewController controller = WebViewController() - ..setJavaScriptMode(JavaScriptMode.unrestricted) - ..setNavigationDelegate(NavigationDelegate( - onPageFinished: (_) => pageLoaded.complete(), - onNavigationRequest: (NavigationRequest navigationRequest) { - return (navigationRequest.url.contains('youtube.com')) - ? NavigationDecision.prevent - : NavigationDecision.navigate; - }, - )); + final WebViewController controller = WebViewController(); + unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); + unawaited(controller.setNavigationDelegate(NavigationDelegate( + onPageFinished: (_) => pageLoaded.complete(), + onNavigationRequest: (NavigationRequest navigationRequest) { + return (navigationRequest.url.contains('youtube.com')) + ? NavigationDecision.prevent + : NavigationDecision.navigate; + }, + ))); await tester.pumpWidget(WebViewWidget(controller: controller)); - controller.loadRequest(Uri.parse(blankPageEncoded)); + unawaited(controller.loadRequest(Uri.parse(blankPageEncoded))); await pageLoaded.future; // Wait for initial page load. @@ -293,13 +293,14 @@ Future<void> main() async { final Completer<WebResourceError> errorCompleter = Completer<WebResourceError>(); - final WebViewController controller = WebViewController() - ..setJavaScriptMode(JavaScriptMode.unrestricted) - ..setNavigationDelegate( - NavigationDelegate(onWebResourceError: (WebResourceError error) { - errorCompleter.complete(error); - })) - ..loadRequest(Uri.parse('https://www.notawebsite..com')); + final WebViewController controller = WebViewController(); + unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); + unawaited(controller.setNavigationDelegate( + NavigationDelegate(onWebResourceError: (WebResourceError error) { + errorCompleter.complete(error); + }))); + unawaited( + controller.loadRequest(Uri.parse('https://www.notawebsite..com'))); await tester.pumpWidget(WebViewWidget(controller: controller)); @@ -313,17 +314,17 @@ Future<void> main() async { Completer<WebResourceError>(); final Completer<void> pageFinishCompleter = Completer<void>(); - final WebViewController controller = WebViewController() - ..setJavaScriptMode(JavaScriptMode.unrestricted) - ..setNavigationDelegate(NavigationDelegate( - onPageFinished: (_) => pageFinishCompleter.complete(), - onWebResourceError: (WebResourceError error) { - errorCompleter.complete(error); - }, - )) - ..loadRequest( - Uri.parse('data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+'), - ); + final WebViewController controller = WebViewController(); + unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); + unawaited(controller.setNavigationDelegate(NavigationDelegate( + onPageFinished: (_) => pageFinishCompleter.complete(), + onWebResourceError: (WebResourceError error) { + errorCompleter.complete(error); + }, + ))); + unawaited(controller.loadRequest( + Uri.parse('data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+'), + )); await tester.pumpWidget(WebViewWidget(controller: controller)); @@ -334,19 +335,19 @@ Future<void> main() async { testWidgets('can block requests', (WidgetTester tester) async { Completer<void> pageLoaded = Completer<void>(); - final WebViewController controller = WebViewController() - ..setJavaScriptMode(JavaScriptMode.unrestricted) - ..setNavigationDelegate(NavigationDelegate( - onPageFinished: (_) => pageLoaded.complete(), - onNavigationRequest: (NavigationRequest navigationRequest) { - return (navigationRequest.url.contains('youtube.com')) - ? NavigationDecision.prevent - : NavigationDecision.navigate; - })); + final WebViewController controller = WebViewController(); + unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); + unawaited(controller.setNavigationDelegate(NavigationDelegate( + onPageFinished: (_) => pageLoaded.complete(), + onNavigationRequest: (NavigationRequest navigationRequest) { + return (navigationRequest.url.contains('youtube.com')) + ? NavigationDecision.prevent + : NavigationDecision.navigate; + }))); await tester.pumpWidget(WebViewWidget(controller: controller)); - controller.loadRequest(Uri.parse(blankPageEncoded)); + unawaited(controller.loadRequest(Uri.parse(blankPageEncoded))); await pageLoaded.future; // Wait for initial page load. @@ -366,21 +367,21 @@ Future<void> main() async { testWidgets('supports asynchronous decisions', (WidgetTester tester) async { Completer<void> pageLoaded = Completer<void>(); - final WebViewController controller = WebViewController() - ..setJavaScriptMode(JavaScriptMode.unrestricted) - ..setNavigationDelegate(NavigationDelegate( - onPageFinished: (_) => pageLoaded.complete(), - onNavigationRequest: (NavigationRequest navigationRequest) async { - NavigationDecision decision = NavigationDecision.prevent; - decision = await Future<NavigationDecision>.delayed( - const Duration(milliseconds: 10), - () => NavigationDecision.navigate); - return decision; - })); + final WebViewController controller = WebViewController(); + unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); + unawaited(controller.setNavigationDelegate(NavigationDelegate( + onPageFinished: (_) => pageLoaded.complete(), + onNavigationRequest: (NavigationRequest navigationRequest) async { + NavigationDecision decision = NavigationDecision.prevent; + decision = await Future<NavigationDecision>.delayed( + const Duration(milliseconds: 10), + () => NavigationDecision.navigate); + return decision; + }))); await tester.pumpWidget(WebViewWidget(controller: controller)); - controller.loadRequest(Uri.parse(blankPageEncoded)); + unawaited(controller.loadRequest(Uri.parse(blankPageEncoded))); await pageLoaded.future; // Wait for initial page load. @@ -394,23 +395,6 @@ Future<void> main() async { }); } -/// Returns the value used for the HTTP User-Agent: request header in subsequent HTTP requests. -Future<String> _getUserAgent(WebViewController controller) async { - return _runJavascriptReturningResult(controller, 'navigator.userAgent;'); -} - -Future<String> _runJavascriptReturningResult( - WebViewController controller, - String js, -) async { - if (defaultTargetPlatform == TargetPlatform.iOS || - defaultTargetPlatform == TargetPlatform.linux) { - return await controller.runJavaScriptReturningResult(js) as String; - } - return jsonDecode(await controller.runJavaScriptReturningResult(js) as String) - as String; -} - class ResizableWebView extends StatefulWidget { const ResizableWebView({ super.key, diff --git a/packages/webview_flutter_lwe/lib/src/lwe_webview_controller.dart b/packages/webview_flutter_lwe/lib/src/lwe_webview_controller.dart index 0514a0476..2c252fdf2 100644 --- a/packages/webview_flutter_lwe/lib/src/lwe_webview_controller.dart +++ b/packages/webview_flutter_lwe/lib/src/lwe_webview_controller.dart @@ -160,8 +160,20 @@ class LweWebViewController extends PlatformWebViewController { Future<void> setUserAgent(String? userAgent) => _webview.setUserAgent(userAgent); - @override - Future<String?> getUserAgent() => _webview.getUserAgent(); + @override + Future<String?> getUserAgent() => _webview.getUserAgent(); + + @override + Future<void> setOnPlatformPermissionRequest( + void Function( + PlatformWebViewPermissionRequest request, + ) onPermissionRequest, + ) async { + // The current version of LWE does not provide any functionality related to a 'permission request'. + throw UnimplementedError( + 'This version of `LweWebViewController` currently has no ' + 'implementation.'); + } } /// An implementation of [PlatformWebViewWidget] with the Lightweight Web Engine. From 18e8125109393c120739d129915c3f8c0dea9f1f Mon Sep 17 00:00:00 2001 From: "swan.seo" <swan.seo@samsung.com> Date: Mon, 20 Nov 2023 22:16:21 +0900 Subject: [PATCH 4/6] Update example app --- .../webview_flutter_lwe/example/lib/main.dart | 54 +++++++++++++++++-- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/packages/webview_flutter_lwe/example/lib/main.dart b/packages/webview_flutter_lwe/example/lib/main.dart index d4c5f846b..068c4479a 100644 --- a/packages/webview_flutter_lwe/example/lib/main.dart +++ b/packages/webview_flutter_lwe/example/lib/main.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// ignore_for_file: public_member_api_docs, avoid_print +// ignore_for_file: public_member_api_docs import 'dart:async'; import 'dart:convert'; @@ -70,6 +70,36 @@ const String kTransparentBackgroundPage = ''' </html> '''; +const String kLogExamplePage = ''' +<!DOCTYPE html> +<html lang="en"> +<head> +<title>Load file or HTML string example</title> +</head> +<body onload="console.log('Logging that the page is loading.')"> +<h1>Local demo page</h1> +<p> + This page is used to test the forwarding of console logs to Dart. +</p> +<style> + .btn-group button { + padding: 24px; 24px; + display: block; + width: 25%; + margin: 5px 0px 0px 0px; + } +</style> +<div class="btn-group"> + <button onclick="console.error('This is an error message.')">Error</button> + <button onclick="console.warn('This is a warning message.')">Warning</button> + <button onclick="console.info('This is a info message.')">Info</button> + <button onclick="console.debug('This is a debug message.')">Debug</button> + <button onclick="console.log('This is a log message.')">Log</button> +</div> +</body> +</html> +'''; + class WebViewExample extends StatefulWidget { const WebViewExample({super.key}); @@ -150,7 +180,7 @@ Page resource error: return FloatingActionButton( onPressed: () async { final String? url = await _controller.currentUrl(); - if (context.mounted) { + if (mounted) { ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Favorited $url')), ); @@ -175,6 +205,7 @@ enum MenuOptions { loadHtmlString, transparentBackground, setCookie, + logExample, } class SampleMenu extends StatelessWidget { @@ -231,6 +262,9 @@ class SampleMenu extends StatelessWidget { case MenuOptions.setCookie: _onSetCookie(); break; + case MenuOptions.logExample: + _onLogExample(); + break; } }, itemBuilder: (BuildContext context) => <PopupMenuItem<MenuOptions>>[ @@ -287,6 +321,10 @@ class SampleMenu extends StatelessWidget { value: MenuOptions.setCookie, child: Text('Set cookie'), ), + const PopupMenuItem<MenuOptions>( + value: MenuOptions.logExample, + child: Text('Log example'), + ), ], ); } @@ -408,7 +446,7 @@ class SampleMenu extends StatelessWidget { } Widget _getCookieList(String cookies) { - if (cookies == null || cookies == '""') { + if (cookies == '""') { return Container(); } final List<String> cookieList = cookies.split(';'); @@ -431,6 +469,16 @@ class SampleMenu extends StatelessWidget { return indexFile.path; } + + Future<void> _onLogExample() { + webViewController + .setOnConsoleMessage((JavaScriptConsoleMessage consoleMessage) { + debugPrint( + '== JS == ${consoleMessage.level.name}: ${consoleMessage.message}'); + }); + + return webViewController.loadHtmlString(kLogExamplePage); + } } class NavigationControls extends StatelessWidget { From 98f01111b61ba6b1dbffb7441616485a19160237 Mon Sep 17 00:00:00 2001 From: "swan.seo" <swan.seo@samsung.com> Date: Tue, 21 Nov 2023 13:47:40 +0900 Subject: [PATCH 5/6] Update webview_flutter to 4.4.2 --- packages/webview_flutter_lwe/CHANGELOG.md | 8 +++++++- packages/webview_flutter_lwe/README.md | 4 ++-- .../integration_test/webview_flutter_test.dart | 1 - packages/webview_flutter_lwe/example/pubspec.yaml | 2 +- .../lib/src/lwe_webview_controller.dart | 14 +++++++++++++- packages/webview_flutter_lwe/pubspec.yaml | 6 +++--- 6 files changed, 26 insertions(+), 9 deletions(-) diff --git a/packages/webview_flutter_lwe/CHANGELOG.md b/packages/webview_flutter_lwe/CHANGELOG.md index bb9ad14ec..0858a2891 100644 --- a/packages/webview_flutter_lwe/CHANGELOG.md +++ b/packages/webview_flutter_lwe/CHANGELOG.md @@ -1,5 +1,11 @@ -## NEXT +## 0.3.0 +* Update webivew_flutter to 4.4.2. +* Update webview_flutter_platform_interface to 2.6.0. +* Update integration_test. +* Add pub topics to package metadata. +* Add support to retrieve the user agent. See `LweWebViewController.getUserAgent`. +* Apply Platform API change. * Increase the minimum Flutter version to 3.3. ## 0.2.0 diff --git a/packages/webview_flutter_lwe/README.md b/packages/webview_flutter_lwe/README.md index 918637efd..bea45df01 100644 --- a/packages/webview_flutter_lwe/README.md +++ b/packages/webview_flutter_lwe/README.md @@ -20,8 +20,8 @@ This package is not an _endorsed_ implementation of `webview_flutter`. Therefore ```yaml dependencies: - webview_flutter: ^4.0.2 - webview_flutter_lwe: ^0.2.0 + webview_flutter: ^4.4.2 + webview_flutter_lwe: ^0.3.0 ``` ## Example diff --git a/packages/webview_flutter_lwe/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter_lwe/example/integration_test/webview_flutter_test.dart index dc2a0f24a..1cf0d9fe1 100644 --- a/packages/webview_flutter_lwe/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter_lwe/example/integration_test/webview_flutter_test.dart @@ -10,7 +10,6 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; diff --git a/packages/webview_flutter_lwe/example/pubspec.yaml b/packages/webview_flutter_lwe/example/pubspec.yaml index 3d9805195..bcb8f807a 100644 --- a/packages/webview_flutter_lwe/example/pubspec.yaml +++ b/packages/webview_flutter_lwe/example/pubspec.yaml @@ -12,7 +12,7 @@ dependencies: path_provider: ^2.0.7 path_provider_tizen: path: ../../path_provider/ - webview_flutter: ^4.0.2 + webview_flutter: ^4.4.2 webview_flutter_lwe: path: ../ diff --git a/packages/webview_flutter_lwe/lib/src/lwe_webview_controller.dart b/packages/webview_flutter_lwe/lib/src/lwe_webview_controller.dart index 2c252fdf2..794681abc 100644 --- a/packages/webview_flutter_lwe/lib/src/lwe_webview_controller.dart +++ b/packages/webview_flutter_lwe/lib/src/lwe_webview_controller.dart @@ -172,7 +172,19 @@ class LweWebViewController extends PlatformWebViewController { // The current version of LWE does not provide any functionality related to a 'permission request'. throw UnimplementedError( 'This version of `LweWebViewController` currently has no ' - 'implementation.'); + 'implementation of `setOnPlatformPermissionRequest`.'); + } + + @override + Future<void> setOnConsoleMessage( + void Function( + JavaScriptConsoleMessage consoleMessage, + ) onConsoleMessage, + ) async { + // The current version of LWE does not provide any functionality related to a 'console message'. + throw UnimplementedError( + 'This version of `LweWebViewController` currently has no ' + 'implementation of `setOnConsoleMessage`.'); } } diff --git a/packages/webview_flutter_lwe/pubspec.yaml b/packages/webview_flutter_lwe/pubspec.yaml index a298ee7cb..d94577ea3 100644 --- a/packages/webview_flutter_lwe/pubspec.yaml +++ b/packages/webview_flutter_lwe/pubspec.yaml @@ -2,7 +2,7 @@ name: webview_flutter_lwe description: Tizen implementation of the webview_flutter plugin backed by Lightweight Web Engine. homepage: https://github.com/flutter-tizen/plugins repository: https://github.com/flutter-tizen/plugins/tree/master/packages/webview_flutter_lwe -version: 0.2.0 +version: 0.3.0 environment: sdk: ">=2.18.0 <4.0.0" @@ -20,8 +20,8 @@ dependencies: flutter: sdk: flutter flutter_tizen: ^0.2.1 - webview_flutter: ^4.0.2 - webview_flutter_platform_interface: ^2.0.1 + webview_flutter: ^4.4.2 + webview_flutter_platform_interface: ^2.6.0 topics: - html From 563f074f58dbef80997274bcb14340390deefdae Mon Sep 17 00:00:00 2001 From: "swan.seo" <swan.seo@samsung.com> Date: Wed, 29 Nov 2023 21:18:20 +1100 Subject: [PATCH 6/6] Add setOnUrlChange with UnimplementedError --- .../lib/src/lwe_webview_controller.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/webview_flutter_lwe/lib/src/lwe_webview_controller.dart b/packages/webview_flutter_lwe/lib/src/lwe_webview_controller.dart index 794681abc..ddb76466a 100644 --- a/packages/webview_flutter_lwe/lib/src/lwe_webview_controller.dart +++ b/packages/webview_flutter_lwe/lib/src/lwe_webview_controller.dart @@ -429,4 +429,12 @@ class LweNavigationDelegate extends PlatformNavigationDelegate { ) async { _onWebResourceError = onWebResourceError; } + + @override + Future<void> setOnUrlChange(UrlChangeCallback onUrlChange) async { + // The current version of LWE does not provide any functionality related to a 'url change'. + throw UnimplementedError( + 'This version of `LweNavigationDelegate` currently has no ' + 'implementation of `setOnConsoleMessage`.'); + } }