From 3edbbbc3968c0108af6e5f89334d606bda50dc45 Mon Sep 17 00:00:00 2001 From: Lorenzo Pichilli Date: Mon, 2 May 2022 23:53:09 +0200 Subject: [PATCH] renamed DebugSettings to DebugLoggingSettings --- CHANGELOG.md | 2 +- example/lib/main.dart | 2 +- .../chrome_safari_browser/chrome_safari_browser.dart | 11 ++++++----- ...ebug_settings.dart => debug_logging_settings.dart} | 6 +++--- lib/src/in_app_webview/in_app_webview_controller.dart | 8 ++++---- lib/src/in_app_webview/webview.dart | 8 +++----- lib/src/main.dart | 2 +- 7 files changed, 19 insertions(+), 20 deletions(-) rename lib/src/{debug_settings.dart => debug_logging_settings.dart} (83%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2275d887..0b94b454 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ - Added `underPageBackgroundColor`, `isTextInteractionEnabled`, `isSiteSpecificQuirksModeEnabled`, `upgradeKnownHostsToHTTPS`, `forceDarkStrategy` WebView settings - Added `onCameraCaptureStateChanged`, `onMicrophoneCaptureStateChanged` WebView events - Added support for `onPermissionRequest` event on iOS 15.0+ -- Added `debugSettings` static property for WebView and ChromeSafariBrowser +- Added `debugLoggingSettings` static property for WebView and ChromeSafariBrowser - Updated `getMetaThemeColor` on iOS 15.0+ - Deprecated `onLoadError` for `onReceivedError`. `onReceivedError` will be called also for subframes. - Deprecated `onLoadHttpError` for `onReceivedError`. `onReceivedHttpError` will be called also for subframes. diff --git a/example/lib/main.dart b/example/lib/main.dart index 7e61c47c..66fad45d 100755 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -19,7 +19,7 @@ Future main() async { // await Permission.microphone.request(); // await Permission.storage.request(); - WebView.debugSettings.maxLogMessageLength = 500; + WebView.debugLoggingSettings.maxLogMessageLength = 500; if (defaultTargetPlatform == TargetPlatform.android) { await InAppWebViewController.setWebContentsDebuggingEnabled(true); diff --git a/lib/src/chrome_safari_browser/chrome_safari_browser.dart b/lib/src/chrome_safari_browser/chrome_safari_browser.dart index a5ab9dbc..688b9c5b 100755 --- a/lib/src/chrome_safari_browser/chrome_safari_browser.dart +++ b/lib/src/chrome_safari_browser/chrome_safari_browser.dart @@ -6,7 +6,7 @@ import 'dart:developer' as developer; import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; import '../util.dart'; -import '../debug_settings.dart'; +import '../debug_logging_settings.dart'; import 'chrome_safari_browser_settings.dart'; @@ -46,7 +46,7 @@ class ChromeSafariBrowserNotOpenedException implements Exception { ///- iOS class ChromeSafariBrowser { ///Debug settings. - static DebugSettings debugSettings = DebugSettings(); + static DebugLoggingSettings debugLoggingSettings = DebugLoggingSettings(); ///View ID used internally. late final String id; @@ -67,12 +67,13 @@ class ChromeSafariBrowser { } _debugLog(String method, dynamic args) { - if (ChromeSafariBrowser.debugSettings.enabled) { - for (var regExp in ChromeSafariBrowser.debugSettings.excludeFilter) { + if (ChromeSafariBrowser.debugLoggingSettings.enabled) { + for (var regExp + in ChromeSafariBrowser.debugLoggingSettings.excludeFilter) { if (regExp.hasMatch(method)) return; } var maxLogMessageLength = - ChromeSafariBrowser.debugSettings.maxLogMessageLength; + ChromeSafariBrowser.debugLoggingSettings.maxLogMessageLength; String message = "ChromeSafariBrowser ID " + id + " calling \"" + diff --git a/lib/src/debug_settings.dart b/lib/src/debug_logging_settings.dart similarity index 83% rename from lib/src/debug_settings.dart rename to lib/src/debug_logging_settings.dart index 2d3afa36..102f750e 100644 --- a/lib/src/debug_settings.dart +++ b/lib/src/debug_logging_settings.dart @@ -2,8 +2,8 @@ import 'package:flutter/foundation.dart'; import 'in_app_webview/webview.dart'; import 'chrome_safari_browser/chrome_safari_browser.dart'; -///Class that represents the debug settings used by [WebView] and [ChromeSafariBrowser]. -class DebugSettings { +///Class that represents the debug logging settings used by [WebView] and [ChromeSafariBrowser]. +class DebugLoggingSettings { ///Enables debug logging info. /// ///The default value is the same value of [kDebugMode], @@ -20,7 +20,7 @@ class DebugSettings { ///The default value is `-1`. int maxLogMessageLength; - DebugSettings({ + DebugLoggingSettings({ this.enabled = kDebugMode, this.excludeFilter = const [], this.maxLogMessageLength = -1 diff --git a/lib/src/in_app_webview/in_app_webview_controller.dart b/lib/src/in_app_webview/in_app_webview_controller.dart index ba337ba0..baf426f0 100644 --- a/lib/src/in_app_webview/in_app_webview_controller.dart +++ b/lib/src/in_app_webview/in_app_webview_controller.dart @@ -104,11 +104,11 @@ class InAppWebViewController { } _debugLog(String method, dynamic args) { - if (WebView.debugSettings.enabled) { - for (var regExp in WebView.debugSettings.excludeFilter) { + if (WebView.debugLoggingSettings.enabled) { + for (var regExp in WebView.debugLoggingSettings.excludeFilter) { if (regExp.hasMatch(method)) return; } - var maxLogMessageLength = WebView.debugSettings.maxLogMessageLength; + var maxLogMessageLength = WebView.debugLoggingSettings.maxLogMessageLength; String viewId = (getViewId() ?? _inAppBrowser?.id).toString(); String message = (_inAppBrowser == null ? "WebView" : "InAppBrowser") + " ID " + @@ -125,7 +125,7 @@ class InAppWebViewController { } Future handleMethod(MethodCall call) async { - if (WebView.debugSettings.enabled && call.method != "onCallJsHandler") { + if (WebView.debugLoggingSettings.enabled && call.method != "onCallJsHandler") { _debugLog(call.method, call.arguments); } diff --git a/lib/src/in_app_webview/webview.dart b/lib/src/in_app_webview/webview.dart index b190fbe1..c009a118 100644 --- a/lib/src/in_app_webview/webview.dart +++ b/lib/src/in_app_webview/webview.dart @@ -10,16 +10,14 @@ import 'in_app_webview_controller.dart'; import 'in_app_webview_settings.dart'; import 'headless_in_app_webview.dart'; -import '../debug_settings.dart'; +import '../debug_logging_settings.dart'; ///Abstract class that represents a WebView. Used by [InAppWebView], [HeadlessInAppWebView] and the WebView of [InAppBrowser]. abstract class WebView { ///Debug settings used by [InAppWebView], [HeadlessInAppWebView] and [InAppBrowser]. ///The default value excludes the [WebView.onScrollChanged] and [WebView.onOverScrolled] events. - static DebugSettings debugSettings = DebugSettings(excludeFilter: [ - RegExp(r"onScrollChanged"), - RegExp(r"onOverScrolled") - ]); + static DebugLoggingSettings debugLoggingSettings = DebugLoggingSettings( + excludeFilter: [RegExp(r"onScrollChanged"), RegExp(r"onOverScrolled")]); ///The window id of a [CreateWindowAction.windowId]. final int? windowId; diff --git a/lib/src/main.dart b/lib/src/main.dart index 8075baec..3afb37c8 100644 --- a/lib/src/main.dart +++ b/lib/src/main.dart @@ -14,4 +14,4 @@ export 'http_auth_credentials_database.dart'; export 'context_menu.dart'; export 'pull_to_refresh/main.dart'; export 'web_message/main.dart'; -export 'debug_settings.dart'; +export 'debug_logging_settings.dart';