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 `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.

View File

@ -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);

View File

@ -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 \"" +

View File

@ -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

View File

@ -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<dynamic> handleMethod(MethodCall call) async {
if (WebView.debugSettings.enabled && call.method != "onCallJsHandler") {
if (WebView.debugLoggingSettings.enabled && call.method != "onCallJsHandler") {
_debugLog(call.method, call.arguments);
}

View File

@ -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;

View File

@ -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';