Skip to content

Commit

Permalink
Adds the JavaScript info loglevel
Browse files Browse the repository at this point in the history
  • Loading branch information
mvanbeusekom committed Jul 24, 2023
1 parent 0929696 commit c1091ac
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 7 deletions.
5 changes: 5 additions & 0 deletions packages/webview_flutter/webview_flutter/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ flutter:
- assets/sample_video.mp4
- assets/www/index.html
- assets/www/styles/style.css

# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins
dependency_overrides:
{webview_flutter_platform_interface: {path: ../../../webview_flutter/webview_flutter_platform_interface}, webview_flutter_wkwebview: {path: ../../../webview_flutter/webview_flutter_wkwebview}}
5 changes: 5 additions & 0 deletions packages/webview_flutter/webview_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ dev_dependencies:
sdk: flutter
mockito: 5.4.1
plugin_platform_interface: ^2.1.3

# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins
dependency_overrides:
{webview_flutter_platform_interface: {path: ../../webview_flutter/webview_flutter_platform_interface}, webview_flutter_wkwebview: {path: ../../webview_flutter/webview_flutter_wkwebview}}
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@ flutter:
- assets/sample_video.mp4
- assets/www/index.html
- assets/www/styles/style.css

# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins
dependency_overrides:
{webview_flutter_platform_interface: {path: ../../../webview_flutter/webview_flutter_platform_interface}}
5 changes: 5 additions & 0 deletions packages/webview_flutter/webview_flutter_android/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@ dev_dependencies:
sdk: flutter
mockito: 5.4.1
pigeon: ^9.2.4

# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins
dependency_overrides:
{webview_flutter_platform_interface: {path: ../../webview_flutter/webview_flutter_platform_interface}}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ enum JavaScriptLogLevel {
/// Indicates a debug message was logged using the `console.debug` method.
debug,

/// Indicates an informational message was logged using the `console.info`
/// method.
info,

/// Indicates a log message was logged using the `console.log` method.
log,
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@ dev_dependencies:

flutter:
uses-material-design: true

# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins
dependency_overrides:
{webview_flutter_platform_interface: {path: ../../../webview_flutter/webview_flutter_platform_interface}}
5 changes: 5 additions & 0 deletions packages/webview_flutter/webview_flutter_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@ dev_dependencies:
flutter_test:
sdk: flutter
mockito: 5.4.1

# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins
dependency_overrides:
{webview_flutter_platform_interface: {path: ../../webview_flutter/webview_flutter_platform_interface}}
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,8 @@ flutter:
- assets/sample_video.mp4
- assets/www/index.html
- assets/www/styles/style.css

# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins
dependency_overrides:
{webview_flutter_platform_interface: {path: ../../../webview_flutter/webview_flutter_platform_interface}, webview_flutter_wkwebview: {path: ../../../webview_flutter/webview_flutter_wkwebview}}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -540,10 +540,14 @@ class WebKitWebViewController extends PlatformWebViewController {
_onConsoleLogCallback!(
JavaScriptLogLevel.warning, consoleLog['message']! as String);
break;
case 'default':
case 'debug':
_onConsoleLogCallback!(
JavaScriptLogLevel.debug, consoleLog['message']! as String);
break;
case 'info':
_onConsoleLogCallback!(
JavaScriptLogLevel.info, consoleLog['message']! as String);
break;
case 'log':
default:
_onConsoleLogCallback!(
Expand Down Expand Up @@ -574,11 +578,13 @@ function log(type, args) {
}
let originalLog = console.log;
let originalInfo = console.info;
let originalWarn = console.warn;
let originalError = console.error;
let originalDebug = console.debug;
console.log = function() { log("log", arguments); originalLog.apply(null, arguments) };
console.info = function() { log("info", arguments); originalInfo.apple(null, arguments) };
console.warn = function() { log("warning", arguments); originalWarn.apply(null, arguments) };
console.error = function() { log("error", arguments); originalError.apply(null, arguments) };
console.debug = function() { log("debug", arguments); originalDebug.apply(null, arguments) };
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -1221,11 +1221,13 @@ function log(type, args) {
}
let originalLog = console.log;
let originalInfo = console.info;
let originalWarn = console.warn;
let originalError = console.error;
let originalDebug = console.debug;
console.log = function() { log("log", arguments); originalLog.apply(null, arguments) };
console.info = function() { log("info", arguments); originalInfo.apple(null, arguments) };
console.warn = function() { log("warning", arguments); originalWarn.apply(null, arguments) };
console.error = function() { log("error", arguments); originalError.apply(null, arguments) };
console.debug = function() { log("debug", arguments); originalDebug.apply(null, arguments) };
Expand Down

0 comments on commit c1091ac

Please sign in to comment.