fix for ios and macos #1738
This commit is contained in:
parent
d23f7fd41b
commit
290cfd6efa
|
@ -1,3 +1,7 @@
|
|||
## 1.0.4
|
||||
|
||||
- Fixed "Cloudflare Turnstile failure" [#1738](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1738)
|
||||
|
||||
## 1.0.3
|
||||
|
||||
- Fixed `InAppBrowserMenuItem.iconColor` not working
|
||||
|
|
|
@ -21,6 +21,17 @@ let CONSOLE_LOG_JS_PLUGIN_SCRIPT = PluginScript(
|
|||
let CONSOLE_LOG_JS_SOURCE = """
|
||||
(function(console) {
|
||||
|
||||
function _callHandler(oldLog, args) {
|
||||
var message = '';
|
||||
for (var i in args) {
|
||||
try {
|
||||
message += message === '' ? args[i] : ' ' + args[i];
|
||||
} catch(ignored) {}
|
||||
}
|
||||
var _windowId = \(WINDOW_ID_VARIABLE_JS_SOURCE);
|
||||
window.webkit.messageHandlers[oldLog].postMessage({'message': message, '_windowId': _windowId});
|
||||
}
|
||||
|
||||
var oldLogs = {
|
||||
'consoleLog': console.log,
|
||||
'consoleDebug': console.debug,
|
||||
|
@ -33,24 +44,7 @@ let CONSOLE_LOG_JS_SOURCE = """
|
|||
(function(oldLog) {
|
||||
console[oldLog.replace('console', '').toLowerCase()] = function() {
|
||||
oldLogs[oldLog].apply(null, arguments);
|
||||
var args = arguments;
|
||||
|
||||
// on iOS, for some reason, accessing the arguments object synchronously can throw some errors, such as "TypeError"
|
||||
// see https://github.com/pichillilorenzo/flutter_inappwebview/issues/776
|
||||
setTimeout(function() {
|
||||
var message = '';
|
||||
for (var i in args) {
|
||||
if (message == '') {
|
||||
message += args[i];
|
||||
}
|
||||
else {
|
||||
message += ' ' + args[i];
|
||||
}
|
||||
}
|
||||
|
||||
var _windowId = \(WINDOW_ID_VARIABLE_JS_SOURCE);
|
||||
window.webkit.messageHandlers[oldLog].postMessage({'message': message, '_windowId': _windowId});
|
||||
});
|
||||
_callHandler(oldLog, arguments);
|
||||
}
|
||||
})(k);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: flutter_inappwebview_ios
|
||||
description: iOS implementation of the flutter_inappwebview plugin.
|
||||
version: 1.0.3
|
||||
version: 1.0.4
|
||||
homepage: https://inappwebview.dev/
|
||||
repository: https://github.com/pichillilorenzo/flutter_inappwebview/tree/master/flutter_inappwebview_ios
|
||||
issue_tracker: https://github.com/pichillilorenzo/flutter_inappwebview/issues
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
## 1.0.2
|
||||
|
||||
- Fixed "Cloudflare Turnstile failure" [#1738](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1738)
|
||||
|
||||
## 1.0.1
|
||||
|
||||
- Added `PlatformPrintJobController.onComplete` setter
|
||||
|
|
|
@ -21,6 +21,17 @@ let CONSOLE_LOG_JS_PLUGIN_SCRIPT = PluginScript(
|
|||
let CONSOLE_LOG_JS_SOURCE = """
|
||||
(function(console) {
|
||||
|
||||
function _callHandler(oldLog, args) {
|
||||
var message = '';
|
||||
for (var i in args) {
|
||||
try {
|
||||
message += message === '' ? args[i] : ' ' + args[i];
|
||||
} catch(ignored) {}
|
||||
}
|
||||
var _windowId = \(WINDOW_ID_VARIABLE_JS_SOURCE);
|
||||
window.webkit.messageHandlers[oldLog].postMessage({'message': message, '_windowId': _windowId});
|
||||
}
|
||||
|
||||
var oldLogs = {
|
||||
'consoleLog': console.log,
|
||||
'consoleDebug': console.debug,
|
||||
|
@ -33,24 +44,7 @@ let CONSOLE_LOG_JS_SOURCE = """
|
|||
(function(oldLog) {
|
||||
console[oldLog.replace('console', '').toLowerCase()] = function() {
|
||||
oldLogs[oldLog].apply(null, arguments);
|
||||
var args = arguments;
|
||||
|
||||
// on iOS, for some reason, accessing the arguments object synchronously can throw some errors, such as "TypeError"
|
||||
// see https://github.com/pichillilorenzo/flutter_inappwebview/issues/776
|
||||
setTimeout(function() {
|
||||
var message = '';
|
||||
for (var i in args) {
|
||||
if (message == '') {
|
||||
message += args[i];
|
||||
}
|
||||
else {
|
||||
message += ' ' + args[i];
|
||||
}
|
||||
}
|
||||
|
||||
var _windowId = \(WINDOW_ID_VARIABLE_JS_SOURCE);
|
||||
window.webkit.messageHandlers[oldLog].postMessage({'message': message, '_windowId': _windowId});
|
||||
});
|
||||
_callHandler(oldLog, arguments);
|
||||
}
|
||||
})(k);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: flutter_inappwebview_macos
|
||||
description: macOS implementation of the flutter_inappwebview plugin.
|
||||
version: 1.0.1
|
||||
version: 1.0.2
|
||||
homepage: https://inappwebview.dev/
|
||||
repository: https://github.com/pichillilorenzo/flutter_inappwebview/tree/master/flutter_inappwebview_macos
|
||||
issue_tracker: https://github.com/pichillilorenzo/flutter_inappwebview/issues
|
||||
|
|
Loading…
Reference in New Issue