Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.23.5

* Removes internal native library Dart proxy.

## 3.23.4

* Replaces use of deprecated Color.value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:leak_tracker/leak_tracker.dart';
import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart';
import 'package:webview_flutter_wkwebview/src/common/platform_webview.dart';
import 'package:webview_flutter_wkwebview/src/common/weak_reference_utils.dart';
import 'package:webview_flutter_wkwebview/src/common/web_kit.g.dart';
import 'package:webview_flutter_wkwebview/src/webkit_proxy.dart';
import 'package:webview_flutter_wkwebview/webview_flutter_wkwebview.dart';

Future<void> main() async {
Expand Down Expand Up @@ -63,6 +61,10 @@ Future<void> main() async {
final headersUrl = '$prefixUrl/headers';
final basicAuthUrl = '$prefixUrl/http-basic-authentication';

setUp(() {
PigeonOverrides.pigeon_reset();
});

testWidgets(
'withWeakReferenceTo allows encapsulating class to be garbage collected',
(WidgetTester tester) async {
Expand Down Expand Up @@ -98,38 +100,48 @@ Future<void> main() async {
}
});

PigeonOverrides.uIViewWKWebView_new =
({
required WKWebViewConfiguration initialConfiguration,
void Function(
NSObject pigeonInstance,
String? keyPath,
NSObject? object,
Map<KeyValueChangeKey, Object?>? change,
)?
observeValue,
}) {
final webView = UIViewWKWebView.pigeon_new(
initialConfiguration: initialConfiguration,
);
finalizer.attach(webView, webViewToken);
return webView;
};
PigeonOverrides.nSViewWKWebView_new =
({
required WKWebViewConfiguration initialConfiguration,
void Function(
NSObject pigeonInstance,
String? keyPath,
NSObject? object,
Map<KeyValueChangeKey, Object?>? change,
)?
observeValue,
}) {
final webView = NSViewWKWebView.pigeon_new(
initialConfiguration: initialConfiguration,
);
finalizer.attach(webView, webViewToken);
return webView;
};
// Wait for any WebView to be garbage collected.
await tester.pumpWidget(
Builder(
builder: (BuildContext context) {
return PlatformWebViewWidget(
WebKitWebViewWidgetCreationParams(
controller: PlatformWebViewController(
WebKitWebViewControllerCreationParams(
webKitProxy: WebKitProxy(
newPlatformWebView:
({
required WKWebViewConfiguration
initialConfiguration,
void Function(
NSObject,
String?,
NSObject?,
Map<KeyValueChangeKey, Object?>?,
)?
observeValue,
}) {
final platformWebView = PlatformWebView(
initialConfiguration: initialConfiguration,
);
finalizer.attach(
platformWebView.nativeWebView,
webViewToken,
);
return platformWebView;
},
),
),
WebKitWebViewControllerCreationParams(),
),
),
).build(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/foundation.dart';
// ignore: implementation_imports
import 'package:webview_flutter_platform_interface/src/webview_flutter_platform_interface_legacy.dart';

import '../common/web_kit.g.dart';
import '../webkit_proxy.dart';

/// Handles all cookie operations for the WebView platform.
class WKWebViewCookieManager extends WebViewCookieManagerPlatform {
/// Constructs a [WKWebViewCookieManager].
WKWebViewCookieManager({
WKWebsiteDataStore? websiteDataStore,
@visibleForTesting WebKitProxy webKitProxy = const WebKitProxy(),
}) : _webKitProxy = webKitProxy,
websiteDataStore =
websiteDataStore ?? webKitProxy.defaultDataStoreWKWebsiteDataStore();
WKWebViewCookieManager({WKWebsiteDataStore? websiteDataStore})
: websiteDataStore =
websiteDataStore ?? WKWebsiteDataStore.defaultDataStore;

/// Manages stored data for [WKWebView]s.
final WKWebsiteDataStore websiteDataStore;

final WebKitProxy _webKitProxy;

@override
Future<bool> clearCookies() async {
return websiteDataStore.removeDataOfTypes(<WebsiteDataType>[
Expand All @@ -40,7 +33,7 @@ class WKWebViewCookieManager extends WebViewCookieManagerPlatform {
}

return websiteDataStore.httpCookieStore.setCookie(
_webKitProxy.newHTTPCookie(
HTTPCookie(
properties: <HttpCookiePropertyKey, Object>{
HttpCookiePropertyKey.name: cookie.name,
HttpCookiePropertyKey.value: cookie.value,
Expand Down

This file was deleted.

Loading