updated tests, fixed ios and macos headless to inappwebview conversion

This commit is contained in:
Lorenzo Pichilli 2023-11-15 00:56:10 +01:00
parent b190d02925
commit 79024b24da
5 changed files with 25 additions and 11 deletions

View File

@ -194,6 +194,12 @@ void main() {
].contains(defaultTargetPlatform);
skippableGroup('InAppWebView', () {
setUpAll(() async {
if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android) {
await InAppWebViewController.setWebContentsDebuggingEnabled(true);
}
});
initialUrlRequest();
setGetSettings();
javascriptCodeEvaluation();

View File

@ -121,7 +121,7 @@ void webMessage() {
if (event.ports[0] != null) {
port = event.ports[0];
port.onmessage = function (event) {
console.log(event.data);
console.log(bufferToString(event.data));
};
}
}

View File

@ -18,10 +18,6 @@ import 'tracing_controller/main.dart' as tracing_controller_tests;
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android) {
InAppWebViewController.setWebContentsDebuggingEnabled(true);
}
WebView.debugLoggingSettings.usePrint = true;
WebView.debugLoggingSettings.maxLogMessageLength = 7000;
InAppBrowser.debugLoggingSettings.usePrint = true;

View File

@ -71,20 +71,26 @@ public class HeadlessInAppWebView : Disposable {
view.alpha = 1.0
// remove from parent
view.removeFromSuperview()
dispose()
dispose(disposeWebView: false)
}
return newFlutterWebView
}
public func dispose() {
public func dispose(disposeWebView: Bool) {
channelDelegate?.dispose()
channelDelegate = nil
plugin?.headlessInAppWebViewManager?.webViews[id] = nil
flutterWebView?.dispose(removeFromSuperview: true)
if disposeWebView {
flutterWebView?.dispose(removeFromSuperview: true)
}
flutterWebView = nil
plugin = nil
}
public func dispose() {
dispose(disposeWebView: true)
}
deinit {
debugPrint("HeadlessInAppWebView - dealloc")
dispose()

View File

@ -72,21 +72,27 @@ public class HeadlessInAppWebView : Disposable {
view.alphaValue = 1.0
// remove from parent
view.removeFromSuperview()
dispose()
dispose(disposeWebView: false)
}
return newFlutterWebView
}
public func dispose() {
public func dispose(disposeWebView: Bool) {
channelDelegate?.dispose()
channelDelegate = nil
plugin?.headlessInAppWebViewManager?.webViews[id] = nil
flutterWebView?.dispose(removeFromSuperview: true)
if disposeWebView {
flutterWebView?.dispose(removeFromSuperview: true)
}
flutterWebView = nil
plugin = nil
}
public func dispose() {
dispose(disposeWebView: true)
}
deinit {
debugPrint("HeadlessInAppWebView - dealloc")
dispose()