renamed DebugSettings to DebugLoggingSettings

This commit is contained in:
Lorenzo Pichilli 2022-05-02 23:53:09 +02:00
parent 28455c696a
commit 3edbbbc396
7 changed files with 19 additions and 20 deletions

View File

@ -7,7 +7,7 @@
- Added `underPageBackgroundColor`, `isTextInteractionEnabled`, `isSiteSpecificQuirksModeEnabled`, `upgradeKnownHostsToHTTPS`, `forceDarkStrategy` WebView settings - Added `underPageBackgroundColor`, `isTextInteractionEnabled`, `isSiteSpecificQuirksModeEnabled`, `upgradeKnownHostsToHTTPS`, `forceDarkStrategy` WebView settings
- Added `onCameraCaptureStateChanged`, `onMicrophoneCaptureStateChanged` WebView events - Added `onCameraCaptureStateChanged`, `onMicrophoneCaptureStateChanged` WebView events
- Added support for `onPermissionRequest` event on iOS 15.0+ - 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+ - Updated `getMetaThemeColor` on iOS 15.0+
- Deprecated `onLoadError` for `onReceivedError`. `onReceivedError` will be called also for subframes. - Deprecated `onLoadError` for `onReceivedError`. `onReceivedError` will be called also for subframes.
- Deprecated `onLoadHttpError` for `onReceivedError`. `onReceivedHttpError` will be called also for subframes. - Deprecated `onLoadHttpError` for `onReceivedError`. `onReceivedHttpError` will be called also for subframes.

View File

@ -19,7 +19,7 @@ Future main() async {
// await Permission.microphone.request(); // await Permission.microphone.request();
// await Permission.storage.request(); // await Permission.storage.request();
WebView.debugSettings.maxLogMessageLength = 500; WebView.debugLoggingSettings.maxLogMessageLength = 500;
if (defaultTargetPlatform == TargetPlatform.android) { if (defaultTargetPlatform == TargetPlatform.android) {
await InAppWebViewController.setWebContentsDebuggingEnabled(true); await InAppWebViewController.setWebContentsDebuggingEnabled(true);

View File

@ -6,7 +6,7 @@ import 'dart:developer' as developer;
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import '../util.dart'; import '../util.dart';
import '../debug_settings.dart'; import '../debug_logging_settings.dart';
import 'chrome_safari_browser_settings.dart'; import 'chrome_safari_browser_settings.dart';
@ -46,7 +46,7 @@ class ChromeSafariBrowserNotOpenedException implements Exception {
///- iOS ///- iOS
class ChromeSafariBrowser { class ChromeSafariBrowser {
///Debug settings. ///Debug settings.
static DebugSettings debugSettings = DebugSettings(); static DebugLoggingSettings debugLoggingSettings = DebugLoggingSettings();
///View ID used internally. ///View ID used internally.
late final String id; late final String id;
@ -67,12 +67,13 @@ class ChromeSafariBrowser {
} }
_debugLog(String method, dynamic args) { _debugLog(String method, dynamic args) {
if (ChromeSafariBrowser.debugSettings.enabled) { if (ChromeSafariBrowser.debugLoggingSettings.enabled) {
for (var regExp in ChromeSafariBrowser.debugSettings.excludeFilter) { for (var regExp
in ChromeSafariBrowser.debugLoggingSettings.excludeFilter) {
if (regExp.hasMatch(method)) return; if (regExp.hasMatch(method)) return;
} }
var maxLogMessageLength = var maxLogMessageLength =
ChromeSafariBrowser.debugSettings.maxLogMessageLength; ChromeSafariBrowser.debugLoggingSettings.maxLogMessageLength;
String message = "ChromeSafariBrowser ID " + String message = "ChromeSafariBrowser ID " +
id + id +
" calling \"" + " calling \"" +

View File

@ -2,8 +2,8 @@ import 'package:flutter/foundation.dart';
import 'in_app_webview/webview.dart'; import 'in_app_webview/webview.dart';
import 'chrome_safari_browser/chrome_safari_browser.dart'; import 'chrome_safari_browser/chrome_safari_browser.dart';
///Class that represents the debug settings used by [WebView] and [ChromeSafariBrowser]. ///Class that represents the debug logging settings used by [WebView] and [ChromeSafariBrowser].
class DebugSettings { class DebugLoggingSettings {
///Enables debug logging info. ///Enables debug logging info.
/// ///
///The default value is the same value of [kDebugMode], ///The default value is the same value of [kDebugMode],
@ -20,7 +20,7 @@ class DebugSettings {
///The default value is `-1`. ///The default value is `-1`.
int maxLogMessageLength; int maxLogMessageLength;
DebugSettings({ DebugLoggingSettings({
this.enabled = kDebugMode, this.enabled = kDebugMode,
this.excludeFilter = const [], this.excludeFilter = const [],
this.maxLogMessageLength = -1 this.maxLogMessageLength = -1

View File

@ -104,11 +104,11 @@ class InAppWebViewController {
} }
_debugLog(String method, dynamic args) { _debugLog(String method, dynamic args) {
if (WebView.debugSettings.enabled) { if (WebView.debugLoggingSettings.enabled) {
for (var regExp in WebView.debugSettings.excludeFilter) { for (var regExp in WebView.debugLoggingSettings.excludeFilter) {
if (regExp.hasMatch(method)) return; if (regExp.hasMatch(method)) return;
} }
var maxLogMessageLength = WebView.debugSettings.maxLogMessageLength; var maxLogMessageLength = WebView.debugLoggingSettings.maxLogMessageLength;
String viewId = (getViewId() ?? _inAppBrowser?.id).toString(); String viewId = (getViewId() ?? _inAppBrowser?.id).toString();
String message = (_inAppBrowser == null ? "WebView" : "InAppBrowser") + String message = (_inAppBrowser == null ? "WebView" : "InAppBrowser") +
" ID " + " ID " +
@ -125,7 +125,7 @@ class InAppWebViewController {
} }
Future<dynamic> handleMethod(MethodCall call) async { Future<dynamic> handleMethod(MethodCall call) async {
if (WebView.debugSettings.enabled && call.method != "onCallJsHandler") { if (WebView.debugLoggingSettings.enabled && call.method != "onCallJsHandler") {
_debugLog(call.method, call.arguments); _debugLog(call.method, call.arguments);
} }

View File

@ -10,16 +10,14 @@ import 'in_app_webview_controller.dart';
import 'in_app_webview_settings.dart'; import 'in_app_webview_settings.dart';
import 'headless_in_app_webview.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 that represents a WebView. Used by [InAppWebView], [HeadlessInAppWebView] and the WebView of [InAppBrowser].
abstract class WebView { abstract class WebView {
///Debug settings used by [InAppWebView], [HeadlessInAppWebView] and [InAppBrowser]. ///Debug settings used by [InAppWebView], [HeadlessInAppWebView] and [InAppBrowser].
///The default value excludes the [WebView.onScrollChanged] and [WebView.onOverScrolled] events. ///The default value excludes the [WebView.onScrollChanged] and [WebView.onOverScrolled] events.
static DebugSettings debugSettings = DebugSettings(excludeFilter: [ static DebugLoggingSettings debugLoggingSettings = DebugLoggingSettings(
RegExp(r"onScrollChanged"), excludeFilter: [RegExp(r"onScrollChanged"), RegExp(r"onOverScrolled")]);
RegExp(r"onOverScrolled")
]);
///The window id of a [CreateWindowAction.windowId]. ///The window id of a [CreateWindowAction.windowId].
final int? windowId; final int? windowId;

View File

@ -14,4 +14,4 @@ export 'http_auth_credentials_database.dart';
export 'context_menu.dart'; export 'context_menu.dart';
export 'pull_to_refresh/main.dart'; export 'pull_to_refresh/main.dart';
export 'web_message/main.dart'; export 'web_message/main.dart';
export 'debug_settings.dart'; export 'debug_logging_settings.dart';