diff --git a/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md b/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md index 7186ebfa8c25..9c64dc5abd29 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.9.4 + +* Updates to Pigeon 13. + ## 3.9.3 * Fixes `use_build_context_synchronously` lint violations in the example app. diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFDataConvertersTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFDataConvertersTests.m index 1a64148b4868..7613bf02f75c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFDataConvertersTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFDataConvertersTests.m @@ -49,7 +49,7 @@ - (void)testFWFWKUserScriptFromScriptData { makeWithSource:@"mySource" injectionTime:[FWFWKUserScriptInjectionTimeEnumData makeWithValue:FWFWKUserScriptInjectionTimeEnumAtDocumentStart] - isMainFrameOnly:@NO]); + isMainFrameOnly:NO]); XCTAssertEqualObjects(userScript.source, @"mySource"); XCTAssertEqual(userScript.injectionTime, WKUserScriptInjectionTimeAtDocumentStart); @@ -94,7 +94,7 @@ - (void)testFWFWKFrameInfoDataFromWKFrameInfo { OCMStub([mockFrameInfo isMainFrame]).andReturn(YES); FWFWKFrameInfoData *targetFrameData = FWFWKFrameInfoDataFromNativeWKFrameInfo(mockFrameInfo); - XCTAssertEqualObjects(targetFrameData.isMainFrame, @YES); + XCTAssertEqual(targetFrameData.isMainFrame, YES); } - (void)testFWFNSErrorDataFromNSError { @@ -104,7 +104,7 @@ - (void)testFWFNSErrorDataFromNSError { userInfo:@{@"a" : @"b", @"c" : unsupportedType}]; FWFNSErrorData *data = FWFNSErrorDataFromNativeNSError(error); - XCTAssertEqualObjects(data.code, @23); + XCTAssertEqual(data.code, 23); XCTAssertEqualObjects(data.domain, @"domain"); NSDictionary *userInfo = @{ @@ -133,7 +133,7 @@ - (void)testFWFWKSecurityOriginDataFromWKSecurityOrigin { FWFWKSecurityOriginData *data = FWFWKSecurityOriginDataFromNativeWKSecurityOrigin(mockSecurityOrigin); XCTAssertEqualObjects(data.host, @"host"); - XCTAssertEqualObjects(data.port, @(2)); + XCTAssertEqual(data.port, 2); XCTAssertEqualObjects(data.protocol, @"protocol"); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m index 185b4804371e..478e4fedef01 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFHTTPCookieStoreHostApiTests.m @@ -22,7 +22,7 @@ - (void)testCreateFromWebsiteDataStoreWithIdentifier { [instanceManager addDartCreatedInstance:mockDataStore withIdentifier:0]; FlutterError *error; - [hostAPI createFromWebsiteDataStoreWithIdentifier:@1 dataStoreIdentifier:@0 error:&error]; + [hostAPI createFromWebsiteDataStoreWithIdentifier:1 dataStoreIdentifier:0 error:&error]; WKHTTPCookieStore *cookieStore = (WKHTTPCookieStore *)[instanceManager instanceForIdentifier:1]; XCTAssertTrue([cookieStore isKindOfClass:[WKHTTPCookieStore class]]); XCTAssertNil(error); @@ -42,7 +42,7 @@ - (void)testSetCookie { makeWithValue:FWFNSHttpCookiePropertyKeyEnumName] ] propertyValues:@[ @"hello" ]]; FlutterError *__block blockError; - [hostAPI setCookieForStoreWithIdentifier:@0 + [hostAPI setCookieForStoreWithIdentifier:0 cookie:cookieData completion:^(FlutterError *error) { blockError = error; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFNavigationDelegateHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFNavigationDelegateHostApiTests.m index 570a1f73ad9b..669234d69b3c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFNavigationDelegateHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFNavigationDelegateHostApiTests.m @@ -51,7 +51,7 @@ - (void)testCreateWithIdentifier { instanceManager:instanceManager]; FlutterError *error; - [hostAPI createWithIdentifier:@0 error:&error]; + [hostAPI createWithIdentifier:0 error:&error]; FWFNavigationDelegate *navigationDelegate = (FWFNavigationDelegate *)[instanceManager instanceForIdentifier:0]; @@ -74,8 +74,8 @@ - (void)testDidFinishNavigation { [instanceManager addDartCreatedInstance:mockWebView withIdentifier:1]; [mockDelegate webView:mockWebView didFinishNavigation:OCMClassMock([WKNavigation class])]; - OCMVerify([mockFlutterAPI didFinishNavigationForDelegateWithIdentifier:@0 - webViewIdentifier:@1 + OCMVerify([mockFlutterAPI didFinishNavigationForDelegateWithIdentifier:0 + webViewIdentifier:1 URL:@"https://flutter.dev/" completion:OCMOCK_ANY]); } @@ -97,8 +97,8 @@ - (void)testDidStartProvisionalNavigation { [mockDelegate webView:mockWebView didStartProvisionalNavigation:OCMClassMock([WKNavigation class])]; OCMVerify([mockFlutterAPI - didStartProvisionalNavigationForDelegateWithIdentifier:@0 - webViewIdentifier:@1 + didStartProvisionalNavigationForDelegateWithIdentifier:0 + webViewIdentifier:1 URL:@"https://flutter.dev/" completion:OCMOCK_ANY]); } @@ -125,8 +125,8 @@ - (void)testDecidePolicyForNavigationAction { OCMStub([mockNavigationAction targetFrame]).andReturn(mockFrameInfo); OCMStub([mockFlutterAPI - decidePolicyForNavigationActionForDelegateWithIdentifier:@0 - webViewIdentifier:@1 + decidePolicyForNavigationActionForDelegateWithIdentifier:0 + webViewIdentifier:1 navigationAction: [OCMArg isKindOfClass:[FWFWKNavigationActionData class]] @@ -164,8 +164,8 @@ - (void)testDidFailNavigation { didFailNavigation:OCMClassMock([WKNavigation class]) withError:[NSError errorWithDomain:@"domain" code:0 userInfo:nil]]; OCMVerify([mockFlutterAPI - didFailNavigationForDelegateWithIdentifier:@0 - webViewIdentifier:@1 + didFailNavigationForDelegateWithIdentifier:0 + webViewIdentifier:1 error:[OCMArg isKindOfClass:[FWFNSErrorData class]] completion:OCMOCK_ANY]); } @@ -187,8 +187,8 @@ - (void)testDidFailProvisionalNavigation { didFailProvisionalNavigation:OCMClassMock([WKNavigation class]) withError:[NSError errorWithDomain:@"domain" code:0 userInfo:nil]]; OCMVerify([mockFlutterAPI - didFailProvisionalNavigationForDelegateWithIdentifier:@0 - webViewIdentifier:@1 + didFailProvisionalNavigationForDelegateWithIdentifier:0 + webViewIdentifier:1 error:[OCMArg isKindOfClass:[FWFNSErrorData class]] completion:OCMOCK_ANY]); @@ -209,8 +209,8 @@ - (void)testWebViewWebContentProcessDidTerminate { [mockDelegate webViewWebContentProcessDidTerminate:mockWebView]; OCMVerify([mockFlutterAPI - webViewWebContentProcessDidTerminateForDelegateWithIdentifier:@0 - webViewIdentifier:@1 + webViewWebContentProcessDidTerminateForDelegateWithIdentifier:0 + webViewIdentifier:1 completion:OCMOCK_ANY]); } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m index 888a3a1e9a66..8c0b90850a82 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m @@ -57,8 +57,8 @@ - (void)testAddObserver { FlutterError *error; [hostAPI - addObserverForObjectWithIdentifier:@0 - observerIdentifier:@1 + addObserverForObjectWithIdentifier:0 + observerIdentifier:1 keyPath:@"myKey" options:@[ [FWFNSKeyValueObservingOptionsEnumData @@ -88,8 +88,8 @@ - (void)testRemoveObserver { [instanceManager addDartCreatedInstance:observerObject withIdentifier:1]; FlutterError *error; - [hostAPI removeObserverForObjectWithIdentifier:@0 - observerIdentifier:@1 + [hostAPI removeObserverForObjectWithIdentifier:0 + observerIdentifier:1 keyPath:@"myKey" error:&error]; OCMVerify([mockObject removeObserver:observerObject forKeyPath:@"myKey"]); @@ -106,7 +106,7 @@ - (void)testDispose { [[FWFObjectHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostAPI disposeObjectWithIdentifier:@0 error:&error]; + [hostAPI disposeObjectWithIdentifier:0 error:&error]; // Only the strong reference is removed, so the weak reference will remain until object is set to // nil. object = nil; @@ -130,9 +130,9 @@ - (void)testObserveValueForKeyPath { change:@{NSKeyValueChangeOldKey : @"key"} context:nil]; OCMVerify([mockFlutterAPI - observeValueForObjectWithIdentifier:@0 + observeValueForObjectWithIdentifier:0 keyPath:@"keyPath" - objectIdentifier:@1 + objectIdentifier:1 changeKeys:[OCMArg checkWithBlock:^BOOL( NSArray *value) { @@ -140,8 +140,7 @@ - (void)testObserveValueForKeyPath { }] changeValues:[OCMArg checkWithBlock:^BOOL(id value) { FWFObjectOrIdentifier *object = (FWFObjectOrIdentifier *)value[0]; - return !object.isIdentifier.boolValue && - [@"key" isEqual:object.value]; + return !object.isIdentifier && [@"key" isEqual:object.value]; }] completion:OCMOCK_ANY]); } @@ -165,9 +164,9 @@ - (void)testObserveValueForKeyPathWithIdentifier { change:@{NSKeyValueChangeOldKey : returnedObject} context:nil]; OCMVerify([mockFlutterAPI - observeValueForObjectWithIdentifier:@0 + observeValueForObjectWithIdentifier:0 keyPath:@"keyPath" - objectIdentifier:@1 + objectIdentifier:1 changeKeys:[OCMArg checkWithBlock:^BOOL( NSArray *value) { @@ -175,7 +174,7 @@ - (void)testObserveValueForKeyPathWithIdentifier { }] changeValues:[OCMArg checkWithBlock:^BOOL(id value) { FWFObjectOrIdentifier *object = (FWFObjectOrIdentifier *)value[0]; - return object.isIdentifier.boolValue && [@(2) isEqual:object.value]; + return object.isIdentifier && [@(2) isEqual:object.value]; }] completion:OCMOCK_ANY]); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m index 95b81ad5c389..dcbe75bf58fb 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFPreferencesHostApiTests.m @@ -20,7 +20,7 @@ - (void)testCreateFromWebViewConfigurationWithIdentifier { [instanceManager addDartCreatedInstance:[[WKWebViewConfiguration alloc] init] withIdentifier:0]; FlutterError *error; - [hostAPI createFromWebViewConfigurationWithIdentifier:@1 configurationIdentifier:@0 error:&error]; + [hostAPI createFromWebViewConfigurationWithIdentifier:1 configurationIdentifier:0 error:&error]; WKPreferences *preferences = (WKPreferences *)[instanceManager instanceForIdentifier:1]; XCTAssertTrue([preferences isKindOfClass:[WKPreferences class]]); XCTAssertNil(error); @@ -36,7 +36,7 @@ - (void)testSetJavaScriptEnabled { [[FWFPreferencesHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostAPI setJavaScriptEnabledForPreferencesWithIdentifier:@0 isEnabled:@YES error:&error]; + [hostAPI setJavaScriptEnabledForPreferencesWithIdentifier:0 isEnabled:YES error:&error]; OCMVerify([mockPreferences setJavaScriptEnabled:YES]); XCTAssertNil(error); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScriptMessageHandlerHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScriptMessageHandlerHostApiTests.m index 84d31d1c543e..fb9958726286 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScriptMessageHandlerHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScriptMessageHandlerHostApiTests.m @@ -50,7 +50,7 @@ - (void)testCreateWithIdentifier { instanceManager:instanceManager]; FlutterError *error; - [hostAPI createWithIdentifier:@0 error:&error]; + [hostAPI createWithIdentifier:0 error:&error]; FWFScriptMessageHandler *scriptMessageHandler = (FWFScriptMessageHandler *)[instanceManager instanceForIdentifier:0]; @@ -78,8 +78,8 @@ - (void)testDidReceiveScriptMessageForHandler { [mockHandler userContentController:userContentController didReceiveScriptMessage:mockScriptMessage]; OCMVerify([mockFlutterAPI - didReceiveScriptMessageForHandlerWithIdentifier:@0 - userContentControllerIdentifier:@1 + didReceiveScriptMessageForHandlerWithIdentifier:0 + userContentControllerIdentifier:1 message:[OCMArg isKindOfClass:[FWFWKScriptMessageData class]] completion:OCMOCK_ANY]); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScrollViewHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScrollViewHostApiTests.m index ede8dcf35d89..b44a080ee47a 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScrollViewHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFScrollViewHostApiTests.m @@ -24,7 +24,7 @@ - (void)testGetContentOffset { FlutterError *error; NSArray *expectedValue = @[ @1.0, @2.0 ]; - XCTAssertEqualObjects([hostAPI contentOffsetForScrollViewWithIdentifier:@0 error:&error], + XCTAssertEqualObjects([hostAPI contentOffsetForScrollViewWithIdentifier:0 error:&error], expectedValue); XCTAssertNil(error); } @@ -40,7 +40,7 @@ - (void)testScrollBy { [[FWFScrollViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostAPI scrollByForScrollViewWithIdentifier:@0 x:@1 y:@2 error:&error]; + [hostAPI scrollByForScrollViewWithIdentifier:0 x:1 y:2 error:&error]; XCTAssertEqual(scrollView.contentOffset.x, 2); XCTAssertEqual(scrollView.contentOffset.y, 4); XCTAssertNil(error); @@ -56,7 +56,7 @@ - (void)testSetContentOffset { [[FWFScrollViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostAPI setContentOffsetForScrollViewWithIdentifier:@0 toX:@1 y:@2 error:&error]; + [hostAPI setContentOffsetForScrollViewWithIdentifier:0 toX:1 y:2 error:&error]; XCTAssertEqual(scrollView.contentOffset.x, 1); XCTAssertEqual(scrollView.contentOffset.y, 2); XCTAssertNil(error); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIDelegateHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIDelegateHostApiTests.m index 72366762b7f5..ac13eb5811be 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIDelegateHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIDelegateHostApiTests.m @@ -5,6 +5,7 @@ @import Flutter; @import XCTest; @import webview_flutter_wkwebview; +@import webview_flutter_wkwebview.Test; #import @@ -50,7 +51,7 @@ - (void)testCreateWithIdentifier { instanceManager:instanceManager]; FlutterError *error; - [hostAPI createWithIdentifier:@0 error:&error]; + [hostAPI createWithIdentifier:0 error:&error]; FWFUIDelegate *delegate = (FWFUIDelegate *)[instanceManager instanceForIdentifier:0]; XCTAssertTrue([delegate conformsToProtocol:@protocol(WKUIDelegate)]); @@ -70,12 +71,8 @@ - (void)testOnCreateWebViewForDelegateWithIdentifier { WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init]; id mockConfigurationFlutterApi = OCMPartialMock(mockFlutterAPI.webViewConfigurationFlutterApi); - NSNumber *__block configurationIdentifier; - OCMStub([mockConfigurationFlutterApi createWithIdentifier:[OCMArg checkWithBlock:^BOOL(id value) { - configurationIdentifier = value; - return YES; - }] - completion:OCMOCK_ANY]); + OCMStub([mockConfigurationFlutterApi createWithIdentifier:0 completion:OCMOCK_ANY]) + .ignoringNonObjectArgs(); WKNavigationAction *mockNavigationAction = OCMClassMock([WKNavigationAction class]); OCMStub([mockNavigationAction request]) @@ -85,13 +82,16 @@ - (void)testOnCreateWebViewForDelegateWithIdentifier { OCMStub([mockFrameInfo isMainFrame]).andReturn(YES); OCMStub([mockNavigationAction targetFrame]).andReturn(mockFrameInfo); + // Creating the webview will create a configuration on the host side, using the next available + // identifier, so save that for checking against later. + NSInteger configurationIdentifier = instanceManager.nextIdentifier; [mockDelegate webView:mockWebView createWebViewWithConfiguration:configuration forNavigationAction:mockNavigationAction windowFeatures:OCMClassMock([WKWindowFeatures class])]; OCMVerify([mockFlutterAPI - onCreateWebViewForDelegateWithIdentifier:@0 - webViewIdentifier:@1 + onCreateWebViewForDelegateWithIdentifier:0 + webViewIdentifier:1 configurationIdentifier:configurationIdentifier navigationAction:[OCMArg isKindOfClass:[FWFWKNavigationActionData class]] @@ -125,8 +125,8 @@ - (void)testRequestMediaCapturePermissionForOrigin API_AVAILABLE(ios(15.0)) { }]; OCMVerify([mockFlutterAPI - requestMediaCapturePermissionForDelegateWithIdentifier:@0 - webViewIdentifier:@1 + requestMediaCapturePermissionForDelegateWithIdentifier:0 + webViewIdentifier:1 origin:[OCMArg isKindOfClass: [FWFWKSecurityOriginData class]] diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIViewHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIViewHostApiTests.m index 65a24d97a39a..d15937b1fe9c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIViewHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUIViewHostApiTests.m @@ -22,7 +22,7 @@ - (void)testSetBackgroundColor { [[FWFUIViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostAPI setBackgroundColorForViewWithIdentifier:@0 toValue:@123 error:&error]; + [hostAPI setBackgroundColorForViewWithIdentifier:0 toValue:@123 error:&error]; OCMVerify([mockUIView setBackgroundColor:[UIColor colorWithRed:(123 >> 16 & 0xff) / 255.0 green:(123 >> 8 & 0xff) / 255.0 @@ -41,7 +41,7 @@ - (void)testSetOpaque { [[FWFUIViewHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostAPI setOpaqueForViewWithIdentifier:@0 isOpaque:@YES error:&error]; + [hostAPI setOpaqueForViewWithIdentifier:0 isOpaque:YES error:&error]; OCMVerify([mockUIView setOpaque:YES]); XCTAssertNil(error); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLTests.m index bf4dc36048f9..7e8d2ad0f129 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLTests.m @@ -24,7 +24,7 @@ - (void)testAbsoluteString { instanceManager:instanceManager]; FlutterError *error; - XCTAssertEqualObjects([hostApi absoluteStringForNSURLWithIdentifier:@(0) error:&error], + XCTAssertEqualObjects([hostApi absoluteStringForNSURLWithIdentifier:0 error:&error], @"https://www.google.com"); XCTAssertNil(error); } @@ -43,6 +43,6 @@ - (void)testFlutterApiCreate { }]; long identifier = [instanceManager identifierWithStrongReferenceForInstance:url]; - OCMVerify([flutterApi.api createWithIdentifier:@(identifier) completion:OCMOCK_ANY]); + OCMVerify([flutterApi.api createWithIdentifier:identifier completion:OCMOCK_ANY]); } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUserContentControllerHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUserContentControllerHostApiTests.m index 4f523e6da402..38da70fd62a3 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUserContentControllerHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFUserContentControllerHostApiTests.m @@ -20,7 +20,7 @@ - (void)testCreateFromWebViewConfigurationWithIdentifier { [instanceManager addDartCreatedInstance:[[WKWebViewConfiguration alloc] init] withIdentifier:0]; FlutterError *error; - [hostAPI createFromWebViewConfigurationWithIdentifier:@1 configurationIdentifier:@0 error:&error]; + [hostAPI createFromWebViewConfigurationWithIdentifier:1 configurationIdentifier:0 error:&error]; WKUserContentController *userContentController = (WKUserContentController *)[instanceManager instanceForIdentifier:1]; XCTAssertTrue([userContentController isKindOfClass:[WKUserContentController class]]); @@ -42,8 +42,8 @@ - (void)testAddScriptMessageHandler { [instanceManager addDartCreatedInstance:mockMessageHandler withIdentifier:1]; FlutterError *error; - [hostAPI addScriptMessageHandlerForControllerWithIdentifier:@0 - handlerIdentifier:@1 + [hostAPI addScriptMessageHandlerForControllerWithIdentifier:0 + handlerIdentifier:1 ofName:@"apple" error:&error]; OCMVerify([mockUserContentController addScriptMessageHandler:mockMessageHandler name:@"apple"]); @@ -61,7 +61,7 @@ - (void)testRemoveScriptMessageHandler { [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostAPI removeScriptMessageHandlerForControllerWithIdentifier:@0 name:@"apple" error:&error]; + [hostAPI removeScriptMessageHandlerForControllerWithIdentifier:0 name:@"apple" error:&error]; OCMVerify([mockUserContentController removeScriptMessageHandlerForName:@"apple"]); XCTAssertNil(error); } @@ -77,7 +77,7 @@ - (void)testRemoveAllScriptMessageHandlers API_AVAILABLE(ios(14.0)) { [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostAPI removeAllScriptMessageHandlersForControllerWithIdentifier:@0 error:&error]; + [hostAPI removeAllScriptMessageHandlersForControllerWithIdentifier:0 error:&error]; OCMVerify([mockUserContentController removeAllScriptMessageHandlers]); XCTAssertNil(error); } @@ -94,7 +94,7 @@ - (void)testAddUserScript { FlutterError *error; [hostAPI - addUserScriptForControllerWithIdentifier:@0 + addUserScriptForControllerWithIdentifier:0 userScript: [FWFWKUserScriptData makeWithSource:@"runAScript" @@ -102,7 +102,7 @@ - (void)testAddUserScript { [FWFWKUserScriptInjectionTimeEnumData makeWithValue: FWFWKUserScriptInjectionTimeEnumAtDocumentEnd] - isMainFrameOnly:@YES] + isMainFrameOnly:YES] error:&error]; OCMVerify([mockUserContentController addUserScript:[OCMArg isKindOfClass:[WKUserScript class]]]); @@ -120,7 +120,7 @@ - (void)testRemoveAllUserScripts { [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostAPI removeAllUserScriptsForControllerWithIdentifier:@0 error:&error]; + [hostAPI removeAllUserScriptsForControllerWithIdentifier:0 error:&error]; OCMVerify([mockUserContentController removeAllUserScripts]); XCTAssertNil(error); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m index 98be6dfe9e2b..5670468c0439 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewConfigurationHostApiTests.m @@ -19,7 +19,7 @@ - (void)testCreateWithIdentifier { instanceManager:instanceManager]; FlutterError *error; - [hostAPI createWithIdentifier:@0 error:&error]; + [hostAPI createWithIdentifier:0 error:&error]; WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[instanceManager instanceForIdentifier:0]; XCTAssertTrue([configuration isKindOfClass:[WKWebViewConfiguration class]]); @@ -37,7 +37,7 @@ - (void)testCreateFromWebViewWithIdentifier { [instanceManager addDartCreatedInstance:mockWebView withIdentifier:0]; FlutterError *error; - [hostAPI createFromWebViewWithIdentifier:@1 webViewIdentifier:@0 error:&error]; + [hostAPI createFromWebViewWithIdentifier:1 webViewIdentifier:0 error:&error]; WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[instanceManager instanceForIdentifier:1]; XCTAssertTrue([configuration isKindOfClass:[WKWebViewConfiguration class]]); @@ -55,9 +55,7 @@ - (void)testSetAllowsInlineMediaPlayback { instanceManager:instanceManager]; FlutterError *error; - [hostAPI setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:@0 - isAllowed:@NO - error:&error]; + [hostAPI setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:0 isAllowed:NO error:&error]; OCMVerify([mockWebViewConfiguration setAllowsInlineMediaPlayback:NO]); XCTAssertNil(error); } @@ -73,8 +71,8 @@ - (void)testSetLimitsNavigationsToAppBoundDomains API_AVAILABLE(ios(14.0)) { instanceManager:instanceManager]; FlutterError *error; - [hostAPI setLimitsNavigationsToAppBoundDomainsForConfigurationWithIdentifier:@0 - isLimited:@NO + [hostAPI setLimitsNavigationsToAppBoundDomainsForConfigurationWithIdentifier:0 + isLimited:NO error:&error]; OCMVerify([mockWebViewConfiguration setLimitsNavigationsToAppBoundDomains:NO]); XCTAssertNil(error); @@ -92,7 +90,7 @@ - (void)testSetMediaTypesRequiringUserActionForPlayback { FlutterError *error; [hostAPI - setMediaTypesRequiresUserActionForConfigurationWithIdentifier:@0 + setMediaTypesRequiresUserActionForConfigurationWithIdentifier:0 forTypes:@[ [FWFWKAudiovisualMediaTypeEnumData makeWithValue: diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewHostApiTests.m index 617f7309cdb5..568e5fe1ed1c 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebViewHostApiTests.m @@ -23,7 +23,7 @@ - (void)testCreateWithIdentifier { [instanceManager addDartCreatedInstance:[[WKWebViewConfiguration alloc] init] withIdentifier:0]; FlutterError *error; - [hostAPI createWithIdentifier:@1 configurationIdentifier:@0 error:&error]; + [hostAPI createWithIdentifier:1 configurationIdentifier:0 error:&error]; WKWebView *webView = (WKWebView *)[instanceManager instanceForIdentifier:1]; XCTAssertTrue([webView isKindOfClass:[WKWebView class]]); XCTAssertNil(error); @@ -44,7 +44,7 @@ - (void)testLoadRequest { httpMethod:@"get" httpBody:nil allHttpHeaderFields:@{@"a" : @"header"}]; - [hostAPI loadRequestForWebViewWithIdentifier:@0 request:requestData error:&error]; + [hostAPI loadRequestForWebViewWithIdentifier:0 request:requestData error:&error]; NSURL *url = [NSURL URLWithString:@"https://www.flutter.dev"]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; @@ -70,7 +70,7 @@ - (void)testLoadRequestWithInvalidUrl { httpMethod:nil httpBody:nil allHttpHeaderFields:@{}]; - [hostAPI loadRequestForWebViewWithIdentifier:@0 request:requestData error:&error]; + [hostAPI loadRequestForWebViewWithIdentifier:0 request:requestData error:&error]; // When linking against the iOS 17 SDK or later, NSURL uses a lenient parser, and won't // fail to parse URLs, so the test must allow for either outcome. if (error) { @@ -95,7 +95,7 @@ - (void)testSetCustomUserAgent { instanceManager:instanceManager]; FlutterError *error; - [hostAPI setCustomUserAgentForWebViewWithIdentifier:@0 userAgent:@"userA" error:&error]; + [hostAPI setCustomUserAgentForWebViewWithIdentifier:0 userAgent:@"userA" error:&error]; OCMVerify([mockWebView setCustomUserAgent:@"userA"]); XCTAssertNil(error); } @@ -112,7 +112,7 @@ - (void)testURL { instanceManager:instanceManager]; FlutterError *error; - XCTAssertEqualObjects([hostAPI URLForWebViewWithIdentifier:@0 error:&error], + XCTAssertEqualObjects([hostAPI URLForWebViewWithIdentifier:0 error:&error], @"https://www.flutter.dev/"); XCTAssertNil(error); } @@ -129,7 +129,7 @@ - (void)testCanGoBack { instanceManager:instanceManager]; FlutterError *error; - XCTAssertEqualObjects([hostAPI canGoBackForWebViewWithIdentifier:@0 error:&error], @YES); + XCTAssertEqualObjects([hostAPI canGoBackForWebViewWithIdentifier:0 error:&error], @YES); XCTAssertNil(error); } @@ -147,7 +147,7 @@ - (void)testSetUIDelegate { [instanceManager addDartCreatedInstance:mockDelegate withIdentifier:1]; FlutterError *error; - [hostAPI setUIDelegateForWebViewWithIdentifier:@0 delegateIdentifier:@1 error:&error]; + [hostAPI setUIDelegateForWebViewWithIdentifier:0 delegateIdentifier:@1 error:&error]; OCMVerify([mockWebView setUIDelegate:mockDelegate]); XCTAssertNil(error); } @@ -166,7 +166,7 @@ - (void)testSetNavigationDelegate { [instanceManager addDartCreatedInstance:mockDelegate withIdentifier:1]; FlutterError *error; - [hostAPI setNavigationDelegateForWebViewWithIdentifier:@0 delegateIdentifier:@1 error:&error]; + [hostAPI setNavigationDelegateForWebViewWithIdentifier:0 delegateIdentifier:@1 error:&error]; OCMVerify([mockWebView setNavigationDelegate:mockDelegate]); XCTAssertNil(error); } @@ -183,7 +183,7 @@ - (void)testEstimatedProgress { instanceManager:instanceManager]; FlutterError *error; - XCTAssertEqualObjects([hostAPI estimatedProgressForWebViewWithIdentifier:@0 error:&error], @34.0); + XCTAssertEqualObjects([hostAPI estimatedProgressForWebViewWithIdentifier:0 error:&error], @34.0); XCTAssertNil(error); } @@ -198,7 +198,7 @@ - (void)testloadHTMLString { instanceManager:instanceManager]; FlutterError *error; - [hostAPI loadHTMLForWebViewWithIdentifier:@0 + [hostAPI loadHTMLForWebViewWithIdentifier:0 HTMLString:@"myString" baseURL:@"myBaseUrl" error:&error]; @@ -217,7 +217,7 @@ - (void)testLoadFileURL { instanceManager:instanceManager]; FlutterError *error; - [hostAPI loadFileForWebViewWithIdentifier:@0 + [hostAPI loadFileForWebViewWithIdentifier:0 fileURL:@"myFolder/apple.txt" readAccessURL:@"myFolder" error:&error]; @@ -249,7 +249,7 @@ - (void)testLoadFlutterAsset { assetManager:mockAssetManager]; FlutterError *error; - [hostAPI loadAssetForWebViewWithIdentifier:@0 assetKey:@"assets/index.html" error:&error]; + [hostAPI loadAssetForWebViewWithIdentifier:0 assetKey:@"assets/index.html" error:&error]; XCTAssertNil(error); OCMVerify([mockWebView @@ -269,7 +269,7 @@ - (void)testCanGoForward { instanceManager:instanceManager]; FlutterError *error; - XCTAssertEqualObjects([hostAPI canGoForwardForWebViewWithIdentifier:@0 error:&error], @NO); + XCTAssertEqualObjects([hostAPI canGoForwardForWebViewWithIdentifier:0 error:&error], @NO); XCTAssertNil(error); } @@ -284,7 +284,7 @@ - (void)testGoBack { instanceManager:instanceManager]; FlutterError *error; - [hostAPI goBackForWebViewWithIdentifier:@0 error:&error]; + [hostAPI goBackForWebViewWithIdentifier:0 error:&error]; OCMVerify([mockWebView goBack]); XCTAssertNil(error); } @@ -300,7 +300,7 @@ - (void)testGoForward { instanceManager:instanceManager]; FlutterError *error; - [hostAPI goForwardForWebViewWithIdentifier:@0 error:&error]; + [hostAPI goForwardForWebViewWithIdentifier:0 error:&error]; OCMVerify([mockWebView goForward]); XCTAssertNil(error); } @@ -316,7 +316,7 @@ - (void)testReload { instanceManager:instanceManager]; FlutterError *error; - [hostAPI reloadWebViewWithIdentifier:@0 error:&error]; + [hostAPI reloadWebViewWithIdentifier:0 error:&error]; OCMVerify([mockWebView reload]); XCTAssertNil(error); } @@ -333,7 +333,7 @@ - (void)testTitle { instanceManager:instanceManager]; FlutterError *error; - XCTAssertEqualObjects([hostAPI titleForWebViewWithIdentifier:@0 error:&error], @"myTitle"); + XCTAssertEqualObjects([hostAPI titleForWebViewWithIdentifier:0 error:&error], @"myTitle"); XCTAssertNil(error); } @@ -348,7 +348,7 @@ - (void)testSetAllowsBackForwardNavigationGestures { instanceManager:instanceManager]; FlutterError *error; - [hostAPI setAllowsBackForwardForWebViewWithIdentifier:@0 isAllowed:@YES error:&error]; + [hostAPI setAllowsBackForwardForWebViewWithIdentifier:0 isAllowed:YES error:&error]; OCMVerify([mockWebView setAllowsBackForwardNavigationGestures:YES]); XCTAssertNil(error); } @@ -369,7 +369,7 @@ - (void)testEvaluateJavaScript { NSString __block *returnValue; FlutterError __block *returnError; - [hostAPI evaluateJavaScriptForWebViewWithIdentifier:@0 + [hostAPI evaluateJavaScriptForWebViewWithIdentifier:0 javaScriptString:@"runJavaScript" completion:^(id result, FlutterError *error) { returnValue = result; @@ -403,7 +403,7 @@ - (void)testEvaluateJavaScriptReturnsNSErrorData { NSString __block *returnValue; FlutterError __block *returnError; - [hostAPI evaluateJavaScriptForWebViewWithIdentifier:@0 + [hostAPI evaluateJavaScriptForWebViewWithIdentifier:0 javaScriptString:@"runJavaScript" completion:^(id result, FlutterError *error) { returnValue = result; @@ -413,7 +413,7 @@ - (void)testEvaluateJavaScriptReturnsNSErrorData { XCTAssertNil(returnValue); FWFNSErrorData *errorData = returnError.details; XCTAssertTrue([errorData isKindOfClass:[FWFNSErrorData class]]); - XCTAssertEqualObjects(errorData.code, @0); + XCTAssertEqual(errorData.code, 0); XCTAssertEqualObjects(errorData.domain, @"errorDomain"); XCTAssertEqualObjects(errorData.userInfo, @{NSLocalizedDescriptionKey : @"description"}); } @@ -427,7 +427,7 @@ - (void)testWebViewContentInsetBehaviorShouldBeNever { [instanceManager addDartCreatedInstance:[[WKWebViewConfiguration alloc] init] withIdentifier:0]; FlutterError *error; - [hostAPI createWithIdentifier:@1 configurationIdentifier:@0 error:&error]; + [hostAPI createWithIdentifier:1 configurationIdentifier:0 error:&error]; FWFWebView *webView = (FWFWebView *)[instanceManager instanceForIdentifier:1]; XCTAssertEqual(webView.scrollView.contentInsetAdjustmentBehavior, @@ -444,7 +444,7 @@ - (void)testScrollViewsAutomaticallyAdjustsScrollIndicatorInsetsShouldbeNoOnIOS1 [instanceManager addDartCreatedInstance:[[WKWebViewConfiguration alloc] init] withIdentifier:0]; FlutterError *error; - [hostAPI createWithIdentifier:@1 configurationIdentifier:@0 error:&error]; + [hostAPI createWithIdentifier:1 configurationIdentifier:0 error:&error]; FWFWebView *webView = (FWFWebView *)[instanceManager instanceForIdentifier:1]; XCTAssertFalse(webView.scrollView.automaticallyAdjustsScrollIndicatorInsets); @@ -483,7 +483,7 @@ - (void)testSetInspectable API_AVAILABLE(ios(16.4), macos(13.3)) { instanceManager:instanceManager]; FlutterError *error; - [hostAPI setInspectableForWebViewWithIdentifier:@0 inspectable:@YES error:&error]; + [hostAPI setInspectableForWebViewWithIdentifier:0 inspectable:YES error:&error]; OCMVerify([mockWebView setInspectable:YES]); XCTAssertNil(error); } @@ -502,7 +502,7 @@ - (void)testCustomUserAgent { instanceManager:instanceManager]; FlutterError *error; - XCTAssertEqualObjects([hostAPI customUserAgentForWebViewWithIdentifier:@0 error:&error], + XCTAssertEqualObjects([hostAPI customUserAgentForWebViewWithIdentifier:0 error:&error], userAgent); XCTAssertNil(error); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m index c518f55194c4..880c81e59e95 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFWebsiteDataStoreHostApiTests.m @@ -20,7 +20,7 @@ - (void)testCreateFromWebViewConfigurationWithIdentifier { [instanceManager addDartCreatedInstance:[[WKWebViewConfiguration alloc] init] withIdentifier:0]; FlutterError *error; - [hostAPI createFromWebViewConfigurationWithIdentifier:@1 configurationIdentifier:@0 error:&error]; + [hostAPI createFromWebViewConfigurationWithIdentifier:1 configurationIdentifier:0 error:&error]; WKWebsiteDataStore *dataStore = (WKWebsiteDataStore *)[instanceManager instanceForIdentifier:1]; XCTAssertTrue([dataStore isKindOfClass:[WKWebsiteDataStore class]]); XCTAssertNil(error); @@ -32,7 +32,7 @@ - (void)testCreateDefaultDataStoreWithIdentifier { [[FWFWebsiteDataStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]; FlutterError *error; - [hostAPI createDefaultDataStoreWithIdentifier:@0 error:&error]; + [hostAPI createDefaultDataStoreWithIdentifier:0 error:&error]; WKWebsiteDataStore *dataStore = (WKWebsiteDataStore *)[instanceManager instanceForIdentifier:0]; XCTAssertEqualObjects(dataStore, [WKWebsiteDataStore defaultDataStore]); XCTAssertNil(error); @@ -59,12 +59,12 @@ - (void)testRemoveDataOfTypes { NSNumber __block *returnValue; FlutterError *__block blockError; - [hostAPI removeDataFromDataStoreWithIdentifier:@0 + [hostAPI removeDataFromDataStoreWithIdentifier:0 ofTypes:@[ [FWFWKWebsiteDataTypeEnumData makeWithValue:FWFWKWebsiteDataTypeEnumLocalStorage] ] - modifiedSince:@45.0 + modifiedSince:45.0 completion:^(NSNumber *result, FlutterError *error) { returnValue = result; blockError = error; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FLTWebViewFlutterPlugin.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FLTWebViewFlutterPlugin.m index 2f919839aa5b..c3d6699e41da 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FLTWebViewFlutterPlugin.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FLTWebViewFlutterPlugin.m @@ -60,48 +60,48 @@ + (void)registerWithRegistrar:(NSObject *)registrar { instanceManager:[[FWFInstanceManager alloc] init]]; dispatch_async(dispatch_get_main_queue(), ^{ - [objectApi disposeObjectWithIdentifier:@(identifier) + [objectApi disposeObjectWithIdentifier:identifier completion:^(FlutterError *error) { NSAssert(!error, @"%@", error); }]; }); }]; - FWFWKHttpCookieStoreHostApiSetup( + SetUpFWFWKHttpCookieStoreHostApi( registrar.messenger, [[FWFHTTPCookieStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]); - FWFWKNavigationDelegateHostApiSetup( + SetUpFWFWKNavigationDelegateHostApi( registrar.messenger, [[FWFNavigationDelegateHostApiImpl alloc] initWithBinaryMessenger:registrar.messenger instanceManager:instanceManager]); - FWFNSObjectHostApiSetup(registrar.messenger, + SetUpFWFNSObjectHostApi(registrar.messenger, [[FWFObjectHostApiImpl alloc] initWithInstanceManager:instanceManager]); - FWFWKPreferencesHostApiSetup(registrar.messenger, [[FWFPreferencesHostApiImpl alloc] + SetUpFWFWKPreferencesHostApi(registrar.messenger, [[FWFPreferencesHostApiImpl alloc] initWithInstanceManager:instanceManager]); - FWFWKScriptMessageHandlerHostApiSetup( + SetUpFWFWKScriptMessageHandlerHostApi( registrar.messenger, [[FWFScriptMessageHandlerHostApiImpl alloc] initWithBinaryMessenger:registrar.messenger instanceManager:instanceManager]); - FWFUIScrollViewHostApiSetup(registrar.messenger, [[FWFScrollViewHostApiImpl alloc] + SetUpFWFUIScrollViewHostApi(registrar.messenger, [[FWFScrollViewHostApiImpl alloc] initWithInstanceManager:instanceManager]); - FWFWKUIDelegateHostApiSetup(registrar.messenger, [[FWFUIDelegateHostApiImpl alloc] + SetUpFWFWKUIDelegateHostApi(registrar.messenger, [[FWFUIDelegateHostApiImpl alloc] initWithBinaryMessenger:registrar.messenger instanceManager:instanceManager]); - FWFUIViewHostApiSetup(registrar.messenger, + SetUpFWFUIViewHostApi(registrar.messenger, [[FWFUIViewHostApiImpl alloc] initWithInstanceManager:instanceManager]); - FWFWKUserContentControllerHostApiSetup( + SetUpFWFWKUserContentControllerHostApi( registrar.messenger, [[FWFUserContentControllerHostApiImpl alloc] initWithInstanceManager:instanceManager]); - FWFWKWebsiteDataStoreHostApiSetup( + SetUpFWFWKWebsiteDataStoreHostApi( registrar.messenger, [[FWFWebsiteDataStoreHostApiImpl alloc] initWithInstanceManager:instanceManager]); - FWFWKWebViewConfigurationHostApiSetup( + SetUpFWFWKWebViewConfigurationHostApi( registrar.messenger, [[FWFWebViewConfigurationHostApiImpl alloc] initWithBinaryMessenger:registrar.messenger instanceManager:instanceManager]); - FWFWKWebViewHostApiSetup(registrar.messenger, [[FWFWebViewHostApiImpl alloc] + SetUpFWFWKWebViewHostApi(registrar.messenger, [[FWFWebViewHostApiImpl alloc] initWithBinaryMessenger:registrar.messenger instanceManager:instanceManager]); - FWFNSUrlHostApiSetup(registrar.messenger, + SetUpFWFNSUrlHostApi(registrar.messenger, [[FWFURLHostApiImpl alloc] initWithBinaryMessenger:registrar.messenger instanceManager:instanceManager]); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m index 28c029888a3a..3cbcea844a12 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFDataConverters.m @@ -103,7 +103,7 @@ NSHTTPCookiePropertyKey _Nullable FWFNativeNSHTTPCookiePropertyKeyFromEnumData( return [[WKUserScript alloc] initWithSource:data.source injectionTime:FWFNativeWKUserScriptInjectionTimeFromEnumData(data.injectionTime) - forMainFrameOnly:data.isMainFrameOnly.boolValue]; + forMainFrameOnly:data.isMainFrameOnly]; } WKUserScriptInjectionTime FWFNativeWKUserScriptInjectionTimeFromEnumData( @@ -176,7 +176,7 @@ WKAudiovisualMediaTypes FWFNativeWKAudiovisualMediaTypeFromEnumData( } FWFWKFrameInfoData *FWFWKFrameInfoDataFromNativeWKFrameInfo(WKFrameInfo *info) { - return [FWFWKFrameInfoData makeWithIsMainFrame:@(info.isMainFrame)]; + return [FWFWKFrameInfoData makeWithIsMainFrame:info.isMainFrame]; } WKNavigationActionPolicy FWFNativeWKNavigationActionPolicyFromEnumData( @@ -204,7 +204,7 @@ WKNavigationActionPolicy FWFNativeWKNavigationActionPolicyFromEnumData( } } } - return [FWFNSErrorData makeWithCode:@(error.code) domain:error.domain userInfo:userInfo]; + return [FWFNSErrorData makeWithCode:error.code domain:error.domain userInfo:userInfo]; } FWFNSKeyValueChangeKeyEnumData *FWFNSKeyValueChangeKeyEnumDataFromNativeNSKeyValueChangeKey( @@ -253,7 +253,7 @@ FWFWKNavigationType FWFWKNavigationTypeFromNativeWKNavigationType(WKNavigationTy FWFWKSecurityOriginData *FWFWKSecurityOriginDataFromNativeWKSecurityOrigin( WKSecurityOrigin *origin) { return [FWFWKSecurityOriginData makeWithHost:origin.host - port:@(origin.port) + port:origin.port protocol:origin.protocol]; } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h index 11c49d24b541..8469438ab020 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v10.1.4), do not edit directly. +// Autogenerated from Pigeon (v13.0.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #import @@ -24,6 +24,12 @@ typedef NS_ENUM(NSUInteger, FWFNSKeyValueObservingOptionsEnum) { FWFNSKeyValueObservingOptionsEnumPriorNotification = 3, }; +/// Wrapper for FWFNSKeyValueObservingOptionsEnum to allow for nullability. +@interface FWFNSKeyValueObservingOptionsEnumBox : NSObject +@property(nonatomic, assign) FWFNSKeyValueObservingOptionsEnum value; +- (instancetype)initWithValue:(FWFNSKeyValueObservingOptionsEnum)value; +@end + /// Mirror of NSKeyValueChange. /// /// See https://developer.apple.com/documentation/foundation/nskeyvaluechange?language=objc. @@ -34,6 +40,12 @@ typedef NS_ENUM(NSUInteger, FWFNSKeyValueChangeEnum) { FWFNSKeyValueChangeEnumReplacement = 3, }; +/// Wrapper for FWFNSKeyValueChangeEnum to allow for nullability. +@interface FWFNSKeyValueChangeEnumBox : NSObject +@property(nonatomic, assign) FWFNSKeyValueChangeEnum value; +- (instancetype)initWithValue:(FWFNSKeyValueChangeEnum)value; +@end + /// Mirror of NSKeyValueChangeKey. /// /// See https://developer.apple.com/documentation/foundation/nskeyvaluechangekey?language=objc. @@ -46,6 +58,12 @@ typedef NS_ENUM(NSUInteger, FWFNSKeyValueChangeKeyEnum) { FWFNSKeyValueChangeKeyEnumUnknown = 5, }; +/// Wrapper for FWFNSKeyValueChangeKeyEnum to allow for nullability. +@interface FWFNSKeyValueChangeKeyEnumBox : NSObject +@property(nonatomic, assign) FWFNSKeyValueChangeKeyEnum value; +- (instancetype)initWithValue:(FWFNSKeyValueChangeKeyEnum)value; +@end + /// Mirror of WKUserScriptInjectionTime. /// /// See https://developer.apple.com/documentation/webkit/wkuserscriptinjectiontime?language=objc. @@ -54,6 +72,12 @@ typedef NS_ENUM(NSUInteger, FWFWKUserScriptInjectionTimeEnum) { FWFWKUserScriptInjectionTimeEnumAtDocumentEnd = 1, }; +/// Wrapper for FWFWKUserScriptInjectionTimeEnum to allow for nullability. +@interface FWFWKUserScriptInjectionTimeEnumBox : NSObject +@property(nonatomic, assign) FWFWKUserScriptInjectionTimeEnum value; +- (instancetype)initWithValue:(FWFWKUserScriptInjectionTimeEnum)value; +@end + /// Mirror of WKAudiovisualMediaTypes. /// /// See @@ -65,6 +89,12 @@ typedef NS_ENUM(NSUInteger, FWFWKAudiovisualMediaTypeEnum) { FWFWKAudiovisualMediaTypeEnumAll = 3, }; +/// Wrapper for FWFWKAudiovisualMediaTypeEnum to allow for nullability. +@interface FWFWKAudiovisualMediaTypeEnumBox : NSObject +@property(nonatomic, assign) FWFWKAudiovisualMediaTypeEnum value; +- (instancetype)initWithValue:(FWFWKAudiovisualMediaTypeEnum)value; +@end + /// Mirror of WKWebsiteDataTypes. /// /// See @@ -80,6 +110,12 @@ typedef NS_ENUM(NSUInteger, FWFWKWebsiteDataTypeEnum) { FWFWKWebsiteDataTypeEnumIndexedDBDatabases = 7, }; +/// Wrapper for FWFWKWebsiteDataTypeEnum to allow for nullability. +@interface FWFWKWebsiteDataTypeEnumBox : NSObject +@property(nonatomic, assign) FWFWKWebsiteDataTypeEnum value; +- (instancetype)initWithValue:(FWFWKWebsiteDataTypeEnum)value; +@end + /// Mirror of WKNavigationActionPolicy. /// /// See https://developer.apple.com/documentation/webkit/wknavigationactionpolicy?language=objc. @@ -88,6 +124,12 @@ typedef NS_ENUM(NSUInteger, FWFWKNavigationActionPolicyEnum) { FWFWKNavigationActionPolicyEnumCancel = 1, }; +/// Wrapper for FWFWKNavigationActionPolicyEnum to allow for nullability. +@interface FWFWKNavigationActionPolicyEnumBox : NSObject +@property(nonatomic, assign) FWFWKNavigationActionPolicyEnum value; +- (instancetype)initWithValue:(FWFWKNavigationActionPolicyEnum)value; +@end + /// Mirror of NSHTTPCookiePropertyKey. /// /// See https://developer.apple.com/documentation/foundation/nshttpcookiepropertykey. @@ -108,6 +150,12 @@ typedef NS_ENUM(NSUInteger, FWFNSHttpCookiePropertyKeyEnum) { FWFNSHttpCookiePropertyKeyEnumVersion = 13, }; +/// Wrapper for FWFNSHttpCookiePropertyKeyEnum to allow for nullability. +@interface FWFNSHttpCookiePropertyKeyEnumBox : NSObject +@property(nonatomic, assign) FWFNSHttpCookiePropertyKeyEnum value; +- (instancetype)initWithValue:(FWFNSHttpCookiePropertyKeyEnum)value; +@end + /// An object that contains information about an action that causes navigation /// to occur. /// @@ -151,6 +199,12 @@ typedef NS_ENUM(NSUInteger, FWFWKNavigationType) { FWFWKNavigationTypeUnknown = 6, }; +/// Wrapper for FWFWKNavigationType to allow for nullability. +@interface FWFWKNavigationTypeBox : NSObject +@property(nonatomic, assign) FWFWKNavigationType value; +- (instancetype)initWithValue:(FWFWKNavigationType)value; +@end + /// Possible permission decisions for device resource access. /// /// See https://developer.apple.com/documentation/webkit/wkpermissiondecision?language=objc. @@ -172,6 +226,12 @@ typedef NS_ENUM(NSUInteger, FWFWKPermissionDecision) { FWFWKPermissionDecisionPrompt = 2, }; +/// Wrapper for FWFWKPermissionDecision to allow for nullability. +@interface FWFWKPermissionDecisionBox : NSObject +@property(nonatomic, assign) FWFWKPermissionDecision value; +- (instancetype)initWithValue:(FWFWKPermissionDecision)value; +@end + /// List of the types of media devices that can capture audio, video, or both. /// /// See https://developer.apple.com/documentation/webkit/wkmediacapturetype?language=objc. @@ -198,6 +258,12 @@ typedef NS_ENUM(NSUInteger, FWFWKMediaCaptureType) { FWFWKMediaCaptureTypeUnknown = 3, }; +/// Wrapper for FWFWKMediaCaptureType to allow for nullability. +@interface FWFWKMediaCaptureTypeBox : NSObject +@property(nonatomic, assign) FWFWKMediaCaptureType value; +- (instancetype)initWithValue:(FWFWKMediaCaptureType)value; +@end + @class FWFNSKeyValueObservingOptionsEnumData; @class FWFNSKeyValueChangeKeyEnumData; @class FWFWKUserScriptInjectionTimeEnumData; @@ -293,7 +359,7 @@ typedef NS_ENUM(NSUInteger, FWFWKMediaCaptureType) { @property(nonatomic, copy) NSString *url; @property(nonatomic, copy, nullable) NSString *httpMethod; @property(nonatomic, strong, nullable) FlutterStandardTypedData *httpBody; -@property(nonatomic, strong) NSDictionary *allHttpHeaderFields; +@property(nonatomic, copy) NSDictionary *allHttpHeaderFields; @end /// Mirror of WKUserScript. @@ -304,10 +370,10 @@ typedef NS_ENUM(NSUInteger, FWFWKMediaCaptureType) { - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithSource:(NSString *)source injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime - isMainFrameOnly:(NSNumber *)isMainFrameOnly; + isMainFrameOnly:(BOOL)isMainFrameOnly; @property(nonatomic, copy) NSString *source; @property(nonatomic, strong, nullable) FWFWKUserScriptInjectionTimeEnumData *injectionTime; -@property(nonatomic, strong) NSNumber *isMainFrameOnly; +@property(nonatomic, assign) BOOL isMainFrameOnly; @end /// Mirror of WKNavigationAction. @@ -330,8 +396,8 @@ typedef NS_ENUM(NSUInteger, FWFWKMediaCaptureType) { @interface FWFWKFrameInfoData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithIsMainFrame:(NSNumber *)isMainFrame; -@property(nonatomic, strong) NSNumber *isMainFrame; ++ (instancetype)makeWithIsMainFrame:(BOOL)isMainFrame; +@property(nonatomic, assign) BOOL isMainFrame; @end /// Mirror of NSError. @@ -340,12 +406,12 @@ typedef NS_ENUM(NSUInteger, FWFWKMediaCaptureType) { @interface FWFNSErrorData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithCode:(NSNumber *)code ++ (instancetype)makeWithCode:(NSInteger)code domain:(NSString *)domain userInfo:(nullable NSDictionary *)userInfo; -@property(nonatomic, strong) NSNumber *code; +@property(nonatomic, assign) NSInteger code; @property(nonatomic, copy) NSString *domain; -@property(nonatomic, strong, nullable) NSDictionary *userInfo; +@property(nonatomic, copy, nullable) NSDictionary *userInfo; @end /// Mirror of WKScriptMessage. @@ -354,9 +420,9 @@ typedef NS_ENUM(NSUInteger, FWFWKMediaCaptureType) { @interface FWFWKScriptMessageData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithName:(NSString *)name body:(id)body; ++ (instancetype)makeWithName:(NSString *)name body:(nullable id)body; @property(nonatomic, copy) NSString *name; -@property(nonatomic, strong) id body; +@property(nonatomic, strong, nullable) id body; @end /// Mirror of WKSecurityOrigin. @@ -365,9 +431,9 @@ typedef NS_ENUM(NSUInteger, FWFWKMediaCaptureType) { @interface FWFWKSecurityOriginData : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithHost:(NSString *)host port:(NSNumber *)port protocol:(NSString *)protocol; ++ (instancetype)makeWithHost:(NSString *)host port:(NSInteger)port protocol:(NSString *)protocol; @property(nonatomic, copy) NSString *host; -@property(nonatomic, strong) NSNumber *port; +@property(nonatomic, assign) NSInteger port; @property(nonatomic, copy) NSString *protocol; @end @@ -379,8 +445,8 @@ typedef NS_ENUM(NSUInteger, FWFWKMediaCaptureType) { - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithPropertyKeys:(NSArray *)propertyKeys propertyValues:(NSArray *)propertyValues; -@property(nonatomic, strong) NSArray *propertyKeys; -@property(nonatomic, strong) NSArray *propertyValues; +@property(nonatomic, copy) NSArray *propertyKeys; +@property(nonatomic, copy) NSArray *propertyValues; @end /// An object that can represent either a value supported by @@ -389,11 +455,11 @@ typedef NS_ENUM(NSUInteger, FWFWKMediaCaptureType) { @interface FWFObjectOrIdentifier : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithValue:(id)value isIdentifier:(NSNumber *)isIdentifier; -@property(nonatomic, strong) id value; ++ (instancetype)makeWithValue:(nullable id)value isIdentifier:(BOOL)isIdentifier; +@property(nonatomic, strong, nullable) id value; /// Whether value is an int that is used to retrieve an instance stored in an /// `InstanceManager`. -@property(nonatomic, strong) NSNumber *isIdentifier; +@property(nonatomic, assign) BOOL isIdentifier; @end /// The codec used by FWFWKWebsiteDataStoreHostApi. @@ -403,19 +469,19 @@ NSObject *FWFWKWebsiteDataStoreHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkwebsitedatastore?language=objc. @protocol FWFWKWebsiteDataStoreHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier - configurationIdentifier:(NSNumber *)configurationIdentifier +- (void)createFromWebViewConfigurationWithIdentifier:(NSInteger)identifier + configurationIdentifier:(NSInteger)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createDefaultDataStoreWithIdentifier:(NSNumber *)identifier +- (void)createDefaultDataStoreWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeDataFromDataStoreWithIdentifier:(NSNumber *)identifier +- (void)removeDataFromDataStoreWithIdentifier:(NSInteger)identifier ofTypes:(NSArray *)dataTypes - modifiedSince:(NSNumber *)modificationTimeInSecondsSinceEpoch + modifiedSince:(double)modificationTimeInSecondsSinceEpoch completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; @end -extern void FWFWKWebsiteDataStoreHostApiSetup( +extern void SetUpFWFWKWebsiteDataStoreHostApi( id binaryMessenger, NSObject *_Nullable api); @@ -426,15 +492,15 @@ NSObject *FWFUIViewHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/uikit/uiview?language=objc. @protocol FWFUIViewHostApi -- (void)setBackgroundColorForViewWithIdentifier:(NSNumber *)identifier +- (void)setBackgroundColorForViewWithIdentifier:(NSInteger)identifier toValue:(nullable NSNumber *)value error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setOpaqueForViewWithIdentifier:(NSNumber *)identifier - isOpaque:(NSNumber *)opaque +- (void)setOpaqueForViewWithIdentifier:(NSInteger)identifier + isOpaque:(BOOL)opaque error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFUIViewHostApiSetup(id binaryMessenger, +extern void SetUpFWFUIViewHostApi(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFUIScrollViewHostApi. @@ -444,24 +510,24 @@ NSObject *FWFUIScrollViewHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/uikit/uiscrollview?language=objc. @protocol FWFUIScrollViewHostApi -- (void)createFromWebViewWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier +- (void)createFromWebViewWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. - (nullable NSArray *) - contentOffsetForScrollViewWithIdentifier:(NSNumber *)identifier + contentOffsetForScrollViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)scrollByForScrollViewWithIdentifier:(NSNumber *)identifier - x:(NSNumber *)x - y:(NSNumber *)y +- (void)scrollByForScrollViewWithIdentifier:(NSInteger)identifier + x:(double)x + y:(double)y error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setContentOffsetForScrollViewWithIdentifier:(NSNumber *)identifier - toX:(NSNumber *)x - y:(NSNumber *)y +- (void)setContentOffsetForScrollViewWithIdentifier:(NSInteger)identifier + toX:(double)x + y:(double)y error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFUIScrollViewHostApiSetup(id binaryMessenger, +extern void SetUpFWFUIScrollViewHostApi(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKWebViewConfigurationHostApi. @@ -471,21 +537,21 @@ NSObject *FWFWKWebViewConfigurationHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkwebviewconfiguration?language=objc. @protocol FWFWKWebViewConfigurationHostApi -- (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)createFromWebViewWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier +- (void)createWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createFromWebViewWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSNumber *)identifier - isAllowed:(NSNumber *)allow +- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSInteger)identifier + isAllowed:(BOOL)allow error: (FlutterError *_Nullable *_Nonnull) error; -- (void)setLimitsNavigationsToAppBoundDomainsForConfigurationWithIdentifier:(NSNumber *)identifier - isLimited:(NSNumber *)limit +- (void)setLimitsNavigationsToAppBoundDomainsForConfigurationWithIdentifier:(NSInteger)identifier + isLimited:(BOOL)limit error:(FlutterError *_Nullable *_Nonnull)error; - (void) - setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSNumber *)identifier + setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSInteger)identifier forTypes: (NSArray< FWFWKAudiovisualMediaTypeEnumData @@ -495,7 +561,7 @@ NSObject *FWFWKWebViewConfigurationHostApiGetCodec(void); error; @end -extern void FWFWKWebViewConfigurationHostApiSetup( +extern void SetUpFWFWKWebViewConfigurationHostApi( id binaryMessenger, NSObject *_Nullable api); @@ -507,7 +573,7 @@ NSObject *FWFWKWebViewConfigurationFlutterApiGetCodec(void) /// See https://developer.apple.com/documentation/webkit/wkwebviewconfiguration?language=objc. @interface FWFWKWebViewConfigurationFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)createWithIdentifier:(NSNumber *)identifier +- (void)createWithIdentifier:(NSInteger)identifier completion:(void (^)(FlutterError *_Nullable))completion; @end @@ -518,29 +584,29 @@ NSObject *FWFWKUserContentControllerHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkusercontentcontroller?language=objc. @protocol FWFWKUserContentControllerHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier - configurationIdentifier:(NSNumber *)configurationIdentifier +- (void)createFromWebViewConfigurationWithIdentifier:(NSInteger)identifier + configurationIdentifier:(NSInteger)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)identifier - handlerIdentifier:(NSNumber *)handlerIdentifier +- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSInteger)identifier + handlerIdentifier:(NSInteger)handlerIdentifier ofName:(NSString *)name error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSNumber *)identifier +- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSInteger)identifier name:(NSString *)name error:(FlutterError *_Nullable *_Nonnull) error; -- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSNumber *)identifier +- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSInteger)identifier error: (FlutterError *_Nullable *_Nonnull) error; -- (void)addUserScriptForControllerWithIdentifier:(NSNumber *)identifier +- (void)addUserScriptForControllerWithIdentifier:(NSInteger)identifier userScript:(FWFWKUserScriptData *)userScript error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeAllUserScriptsForControllerWithIdentifier:(NSNumber *)identifier +- (void)removeAllUserScriptsForControllerWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKUserContentControllerHostApiSetup( +extern void SetUpFWFWKUserContentControllerHostApi( id binaryMessenger, NSObject *_Nullable api); @@ -551,15 +617,15 @@ NSObject *FWFWKPreferencesHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkpreferences?language=objc. @protocol FWFWKPreferencesHostApi -- (void)createFromWebViewConfigurationWithIdentifier:(NSNumber *)identifier - configurationIdentifier:(NSNumber *)configurationIdentifier +- (void)createFromWebViewConfigurationWithIdentifier:(NSInteger)identifier + configurationIdentifier:(NSInteger)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSNumber *)identifier - isEnabled:(NSNumber *)enabled +- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSInteger)identifier + isEnabled:(BOOL)enabled error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKPreferencesHostApiSetup(id binaryMessenger, +extern void SetUpFWFWKPreferencesHostApi(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKScriptMessageHandlerHostApi. @@ -569,10 +635,10 @@ NSObject *FWFWKScriptMessageHandlerHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkscriptmessagehandler?language=objc. @protocol FWFWKScriptMessageHandlerHostApi -- (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKScriptMessageHandlerHostApiSetup( +extern void SetUpFWFWKScriptMessageHandlerHostApi( id binaryMessenger, NSObject *_Nullable api); @@ -584,8 +650,8 @@ NSObject *FWFWKScriptMessageHandlerFlutterApiGetCodec(void) /// See https://developer.apple.com/documentation/webkit/wkscriptmessagehandler?language=objc. @interface FWFWKScriptMessageHandlerFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)identifier - userContentControllerIdentifier:(NSNumber *)userContentControllerIdentifier +- (void)didReceiveScriptMessageForHandlerWithIdentifier:(NSInteger)identifier + userContentControllerIdentifier:(NSInteger)userContentControllerIdentifier message:(FWFWKScriptMessageData *)message completion: (void (^)(FlutterError *_Nullable))completion; @@ -598,10 +664,10 @@ NSObject *FWFWKNavigationDelegateHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wknavigationdelegate?language=objc. @protocol FWFWKNavigationDelegateHostApi -- (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKNavigationDelegateHostApiSetup( +extern void SetUpFWFWKNavigationDelegateHostApi( id binaryMessenger, NSObject *_Nullable api); @@ -613,35 +679,35 @@ NSObject *FWFWKNavigationDelegateFlutterApiGetCodec(void); /// See https://developer.apple.com/documentation/webkit/wknavigationdelegate?language=objc. @interface FWFWKNavigationDelegateFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier +- (void)didFinishNavigationForDelegateWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier URL:(nullable NSString *)url completion:(void (^)(FlutterError *_Nullable))completion; -- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier +- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier URL:(nullable NSString *)url completion:(void (^)(FlutterError *_Nullable)) completion; - (void) - decidePolicyForNavigationActionForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier + decidePolicyForNavigationActionForDelegateWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier navigationAction: (FWFWKNavigationActionData *)navigationAction completion: (void (^)(FWFWKNavigationActionPolicyEnumData *_Nullable, FlutterError *_Nullable))completion; -- (void)didFailNavigationForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier +- (void)didFailNavigationForDelegateWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier error:(FWFNSErrorData *)error completion:(void (^)(FlutterError *_Nullable))completion; -- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier +- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier error:(FWFNSErrorData *)error completion:(void (^)(FlutterError *_Nullable)) completion; -- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier +- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier completion: (void (^)(FlutterError *_Nullable)) completion; @@ -654,21 +720,21 @@ NSObject *FWFNSObjectHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/objectivec/nsobject. @protocol FWFNSObjectHostApi -- (void)disposeObjectWithIdentifier:(NSNumber *)identifier +- (void)disposeObjectWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)addObserverForObjectWithIdentifier:(NSNumber *)identifier - observerIdentifier:(NSNumber *)observerIdentifier +- (void)addObserverForObjectWithIdentifier:(NSInteger)identifier + observerIdentifier:(NSInteger)observerIdentifier keyPath:(NSString *)keyPath options: (NSArray *)options error:(FlutterError *_Nullable *_Nonnull)error; -- (void)removeObserverForObjectWithIdentifier:(NSNumber *)identifier - observerIdentifier:(NSNumber *)observerIdentifier +- (void)removeObserverForObjectWithIdentifier:(NSInteger)identifier + observerIdentifier:(NSInteger)observerIdentifier keyPath:(NSString *)keyPath error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFNSObjectHostApiSetup(id binaryMessenger, +extern void SetUpFWFNSObjectHostApi(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFNSObjectFlutterApi. @@ -679,13 +745,13 @@ NSObject *FWFNSObjectFlutterApiGetCodec(void); /// See https://developer.apple.com/documentation/objectivec/nsobject. @interface FWFNSObjectFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)observeValueForObjectWithIdentifier:(NSNumber *)identifier +- (void)observeValueForObjectWithIdentifier:(NSInteger)identifier keyPath:(NSString *)keyPath - objectIdentifier:(NSNumber *)objectIdentifier + objectIdentifier:(NSInteger)objectIdentifier changeKeys:(NSArray *)changeKeys changeValues:(NSArray *)changeValues completion:(void (^)(FlutterError *_Nullable))completion; -- (void)disposeObjectWithIdentifier:(NSNumber *)identifier +- (void)disposeObjectWithIdentifier:(NSInteger)identifier completion:(void (^)(FlutterError *_Nullable))completion; @end @@ -696,70 +762,70 @@ NSObject *FWFWKWebViewHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkwebview?language=objc. @protocol FWFWKWebViewHostApi -- (void)createWithIdentifier:(NSNumber *)identifier - configurationIdentifier:(NSNumber *)configurationIdentifier +- (void)createWithIdentifier:(NSInteger)identifier + configurationIdentifier:(NSInteger)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setUIDelegateForWebViewWithIdentifier:(NSNumber *)identifier +- (void)setUIDelegateForWebViewWithIdentifier:(NSInteger)identifier delegateIdentifier:(nullable NSNumber *)uiDelegateIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setNavigationDelegateForWebViewWithIdentifier:(NSNumber *)identifier +- (void)setNavigationDelegateForWebViewWithIdentifier:(NSInteger)identifier delegateIdentifier: (nullable NSNumber *)navigationDelegateIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)URLForWebViewWithIdentifier:(NSNumber *)identifier +- (nullable NSString *)URLForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSNumber *)identifier +- (nullable NSNumber *)estimatedProgressForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull) error; -- (void)loadRequestForWebViewWithIdentifier:(NSNumber *)identifier +- (void)loadRequestForWebViewWithIdentifier:(NSInteger)identifier request:(FWFNSUrlRequestData *)request error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadHTMLForWebViewWithIdentifier:(NSNumber *)identifier +- (void)loadHTMLForWebViewWithIdentifier:(NSInteger)identifier HTMLString:(NSString *)string baseURL:(nullable NSString *)baseUrl error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadFileForWebViewWithIdentifier:(NSNumber *)identifier +- (void)loadFileForWebViewWithIdentifier:(NSInteger)identifier fileURL:(NSString *)url readAccessURL:(NSString *)readAccessUrl error:(FlutterError *_Nullable *_Nonnull)error; -- (void)loadAssetForWebViewWithIdentifier:(NSNumber *)identifier +- (void)loadAssetForWebViewWithIdentifier:(NSInteger)identifier assetKey:(NSString *)key error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSNumber *)identifier +- (nullable NSNumber *)canGoBackForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; /// @return `nil` only when `error != nil`. -- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSNumber *)identifier +- (nullable NSNumber *)canGoForwardForWebViewWithIdentifier:(NSInteger)identifier error: (FlutterError *_Nullable *_Nonnull)error; -- (void)goBackForWebViewWithIdentifier:(NSNumber *)identifier +- (void)goBackForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)goForwardForWebViewWithIdentifier:(NSNumber *)identifier +- (void)goForwardForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)reloadWebViewWithIdentifier:(NSNumber *)identifier +- (void)reloadWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)titleForWebViewWithIdentifier:(NSNumber *)identifier +- (nullable NSString *)titleForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSNumber *)identifier - isAllowed:(NSNumber *)allow +- (void)setAllowsBackForwardForWebViewWithIdentifier:(NSInteger)identifier + isAllowed:(BOOL)allow error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setCustomUserAgentForWebViewWithIdentifier:(NSNumber *)identifier +- (void)setCustomUserAgentForWebViewWithIdentifier:(NSInteger)identifier userAgent:(nullable NSString *)userAgent error:(FlutterError *_Nullable *_Nonnull)error; -- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSNumber *)identifier +- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSInteger)identifier javaScriptString:(NSString *)javaScriptString completion:(void (^)(id _Nullable, FlutterError *_Nullable))completion; -- (void)setInspectableForWebViewWithIdentifier:(NSNumber *)identifier - inspectable:(NSNumber *)inspectable +- (void)setInspectableForWebViewWithIdentifier:(NSInteger)identifier + inspectable:(BOOL)inspectable error:(FlutterError *_Nullable *_Nonnull)error; -- (nullable NSString *)customUserAgentForWebViewWithIdentifier:(NSNumber *)identifier +- (nullable NSString *)customUserAgentForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull) error; @end -extern void FWFWKWebViewHostApiSetup(id binaryMessenger, +extern void SetUpFWFWKWebViewHostApi(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKUIDelegateHostApi. @@ -769,10 +835,10 @@ NSObject *FWFWKUIDelegateHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkuidelegate?language=objc. @protocol FWFWKUIDelegateHostApi -- (void)createWithIdentifier:(NSNumber *)identifier error:(FlutterError *_Nullable *_Nonnull)error; +- (void)createWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFWKUIDelegateHostApiSetup(id binaryMessenger, +extern void SetUpFWFWKUIDelegateHostApi(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFWKUIDelegateFlutterApi. @@ -783,14 +849,14 @@ NSObject *FWFWKUIDelegateFlutterApiGetCodec(void); /// See https://developer.apple.com/documentation/webkit/wkuidelegate?language=objc. @interface FWFWKUIDelegateFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)onCreateWebViewForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier - configurationIdentifier:(NSNumber *)configurationIdentifier +- (void)onCreateWebViewForDelegateWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier + configurationIdentifier:(NSInteger)configurationIdentifier navigationAction:(FWFWKNavigationActionData *)navigationAction completion:(void (^)(FlutterError *_Nullable))completion; /// Callback to Dart function `WKUIDelegate.requestMediaCapturePermission`. -- (void)requestMediaCapturePermissionForDelegateWithIdentifier:(NSNumber *)identifier - webViewIdentifier:(NSNumber *)webViewIdentifier +- (void)requestMediaCapturePermissionForDelegateWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier origin:(FWFWKSecurityOriginData *)origin frame:(FWFWKFrameInfoData *)frame type:(FWFWKMediaCaptureTypeData *)type @@ -807,15 +873,15 @@ NSObject *FWFWKHttpCookieStoreHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/webkit/wkhttpcookiestore?language=objc. @protocol FWFWKHttpCookieStoreHostApi -- (void)createFromWebsiteDataStoreWithIdentifier:(NSNumber *)identifier - dataStoreIdentifier:(NSNumber *)websiteDataStoreIdentifier +- (void)createFromWebsiteDataStoreWithIdentifier:(NSInteger)identifier + dataStoreIdentifier:(NSInteger)websiteDataStoreIdentifier error:(FlutterError *_Nullable *_Nonnull)error; -- (void)setCookieForStoreWithIdentifier:(NSNumber *)identifier +- (void)setCookieForStoreWithIdentifier:(NSInteger)identifier cookie:(FWFNSHttpCookieData *)cookie completion:(void (^)(FlutterError *_Nullable))completion; @end -extern void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, +extern void SetUpFWFWKHttpCookieStoreHostApi(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFNSUrlHostApi. @@ -829,12 +895,12 @@ NSObject *FWFNSUrlHostApiGetCodec(void); /// /// See https://developer.apple.com/documentation/foundation/nsurl?language=objc. @protocol FWFNSUrlHostApi -- (nullable NSString *)absoluteStringForNSURLWithIdentifier:(NSNumber *)identifier +- (nullable NSString *)absoluteStringForNSURLWithIdentifier:(NSInteger)identifier error: (FlutterError *_Nullable *_Nonnull)error; @end -extern void FWFNSUrlHostApiSetup(id binaryMessenger, +extern void SetUpFWFNSUrlHostApi(id binaryMessenger, NSObject *_Nullable api); /// The codec used by FWFNSUrlFlutterApi. @@ -849,7 +915,7 @@ NSObject *FWFNSUrlFlutterApiGetCodec(void); /// See https://developer.apple.com/documentation/foundation/nsurl?language=objc. @interface FWFNSUrlFlutterApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (void)createWithIdentifier:(NSNumber *)identifier +- (void)createWithIdentifier:(NSInteger)identifier completion:(void (^)(FlutterError *_Nullable))completion; @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m index cc58067418e9..52fbbee9351e 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v10.1.4), do not edit directly. +// Autogenerated from Pigeon (v13.0.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #import "FWFGeneratedWebKitApis.h" @@ -16,6 +16,154 @@ #error File requires ARC to be enabled. #endif +/// Mirror of NSKeyValueObservingOptions. +/// +/// See +/// https://developer.apple.com/documentation/foundation/nskeyvalueobservingoptions?language=objc. +@implementation FWFNSKeyValueObservingOptionsEnumBox +- (instancetype)initWithValue:(FWFNSKeyValueObservingOptionsEnum)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + +/// Mirror of NSKeyValueChange. +/// +/// See https://developer.apple.com/documentation/foundation/nskeyvaluechange?language=objc. +@implementation FWFNSKeyValueChangeEnumBox +- (instancetype)initWithValue:(FWFNSKeyValueChangeEnum)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + +/// Mirror of NSKeyValueChangeKey. +/// +/// See https://developer.apple.com/documentation/foundation/nskeyvaluechangekey?language=objc. +@implementation FWFNSKeyValueChangeKeyEnumBox +- (instancetype)initWithValue:(FWFNSKeyValueChangeKeyEnum)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + +/// Mirror of WKUserScriptInjectionTime. +/// +/// See https://developer.apple.com/documentation/webkit/wkuserscriptinjectiontime?language=objc. +@implementation FWFWKUserScriptInjectionTimeEnumBox +- (instancetype)initWithValue:(FWFWKUserScriptInjectionTimeEnum)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + +/// Mirror of WKAudiovisualMediaTypes. +/// +/// See +/// [WKAudiovisualMediaTypes](https://developer.apple.com/documentation/webkit/wkaudiovisualmediatypes?language=objc). +@implementation FWFWKAudiovisualMediaTypeEnumBox +- (instancetype)initWithValue:(FWFWKAudiovisualMediaTypeEnum)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + +/// Mirror of WKWebsiteDataTypes. +/// +/// See +/// https://developer.apple.com/documentation/webkit/wkwebsitedatarecord/data_store_record_types?language=objc. +@implementation FWFWKWebsiteDataTypeEnumBox +- (instancetype)initWithValue:(FWFWKWebsiteDataTypeEnum)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + +/// Mirror of WKNavigationActionPolicy. +/// +/// See https://developer.apple.com/documentation/webkit/wknavigationactionpolicy?language=objc. +@implementation FWFWKNavigationActionPolicyEnumBox +- (instancetype)initWithValue:(FWFWKNavigationActionPolicyEnum)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + +/// Mirror of NSHTTPCookiePropertyKey. +/// +/// See https://developer.apple.com/documentation/foundation/nshttpcookiepropertykey. +@implementation FWFNSHttpCookiePropertyKeyEnumBox +- (instancetype)initWithValue:(FWFNSHttpCookiePropertyKeyEnum)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + +/// An object that contains information about an action that causes navigation +/// to occur. +/// +/// Wraps +/// [WKNavigationType](https://developer.apple.com/documentation/webkit/wknavigationaction?language=objc). +@implementation FWFWKNavigationTypeBox +- (instancetype)initWithValue:(FWFWKNavigationType)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + +/// Possible permission decisions for device resource access. +/// +/// See https://developer.apple.com/documentation/webkit/wkpermissiondecision?language=objc. +@implementation FWFWKPermissionDecisionBox +- (instancetype)initWithValue:(FWFWKPermissionDecision)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + +/// List of the types of media devices that can capture audio, video, or both. +/// +/// See https://developer.apple.com/documentation/webkit/wkmediacapturetype?language=objc. +@implementation FWFWKMediaCaptureTypeBox +- (instancetype)initWithValue:(FWFWKMediaCaptureType)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + static NSArray *wrapResult(id result, FlutterError *error) { if (error) { return @[ @@ -351,11 +499,9 @@ + (instancetype)makeWithUrl:(NSString *)url + (FWFNSUrlRequestData *)fromList:(NSArray *)list { FWFNSUrlRequestData *pigeonResult = [[FWFNSUrlRequestData alloc] init]; pigeonResult.url = GetNullableObjectAtIndex(list, 0); - NSAssert(pigeonResult.url != nil, @""); pigeonResult.httpMethod = GetNullableObjectAtIndex(list, 1); pigeonResult.httpBody = GetNullableObjectAtIndex(list, 2); pigeonResult.allHttpHeaderFields = GetNullableObjectAtIndex(list, 3); - NSAssert(pigeonResult.allHttpHeaderFields != nil, @""); return pigeonResult; } + (nullable FWFNSUrlRequestData *)nullableFromList:(NSArray *)list { @@ -363,10 +509,10 @@ + (nullable FWFNSUrlRequestData *)nullableFromList:(NSArray *)list { } - (NSArray *)toList { return @[ - (self.url ?: [NSNull null]), - (self.httpMethod ?: [NSNull null]), - (self.httpBody ?: [NSNull null]), - (self.allHttpHeaderFields ?: [NSNull null]), + self.url ?: [NSNull null], + self.httpMethod ?: [NSNull null], + self.httpBody ?: [NSNull null], + self.allHttpHeaderFields ?: [NSNull null], ]; } @end @@ -374,7 +520,7 @@ - (NSArray *)toList { @implementation FWFWKUserScriptData + (instancetype)makeWithSource:(NSString *)source injectionTime:(nullable FWFWKUserScriptInjectionTimeEnumData *)injectionTime - isMainFrameOnly:(NSNumber *)isMainFrameOnly { + isMainFrameOnly:(BOOL)isMainFrameOnly { FWFWKUserScriptData *pigeonResult = [[FWFWKUserScriptData alloc] init]; pigeonResult.source = source; pigeonResult.injectionTime = injectionTime; @@ -384,11 +530,9 @@ + (instancetype)makeWithSource:(NSString *)source + (FWFWKUserScriptData *)fromList:(NSArray *)list { FWFWKUserScriptData *pigeonResult = [[FWFWKUserScriptData alloc] init]; pigeonResult.source = GetNullableObjectAtIndex(list, 0); - NSAssert(pigeonResult.source != nil, @""); pigeonResult.injectionTime = [FWFWKUserScriptInjectionTimeEnumData nullableFromList:(GetNullableObjectAtIndex(list, 1))]; - pigeonResult.isMainFrameOnly = GetNullableObjectAtIndex(list, 2); - NSAssert(pigeonResult.isMainFrameOnly != nil, @""); + pigeonResult.isMainFrameOnly = [GetNullableObjectAtIndex(list, 2) boolValue]; return pigeonResult; } + (nullable FWFWKUserScriptData *)nullableFromList:(NSArray *)list { @@ -396,9 +540,9 @@ + (nullable FWFWKUserScriptData *)nullableFromList:(NSArray *)list { } - (NSArray *)toList { return @[ - (self.source ?: [NSNull null]), + self.source ?: [NSNull null], (self.injectionTime ? [self.injectionTime toList] : [NSNull null]), - (self.isMainFrameOnly ?: [NSNull null]), + @(self.isMainFrameOnly), ]; } @end @@ -416,10 +560,8 @@ + (instancetype)makeWithRequest:(FWFNSUrlRequestData *)request + (FWFWKNavigationActionData *)fromList:(NSArray *)list { FWFWKNavigationActionData *pigeonResult = [[FWFWKNavigationActionData alloc] init]; pigeonResult.request = [FWFNSUrlRequestData nullableFromList:(GetNullableObjectAtIndex(list, 0))]; - NSAssert(pigeonResult.request != nil, @""); pigeonResult.targetFrame = [FWFWKFrameInfoData nullableFromList:(GetNullableObjectAtIndex(list, 1))]; - NSAssert(pigeonResult.targetFrame != nil, @""); pigeonResult.navigationType = [GetNullableObjectAtIndex(list, 2) integerValue]; return pigeonResult; } @@ -436,15 +578,14 @@ - (NSArray *)toList { @end @implementation FWFWKFrameInfoData -+ (instancetype)makeWithIsMainFrame:(NSNumber *)isMainFrame { ++ (instancetype)makeWithIsMainFrame:(BOOL)isMainFrame { FWFWKFrameInfoData *pigeonResult = [[FWFWKFrameInfoData alloc] init]; pigeonResult.isMainFrame = isMainFrame; return pigeonResult; } + (FWFWKFrameInfoData *)fromList:(NSArray *)list { FWFWKFrameInfoData *pigeonResult = [[FWFWKFrameInfoData alloc] init]; - pigeonResult.isMainFrame = GetNullableObjectAtIndex(list, 0); - NSAssert(pigeonResult.isMainFrame != nil, @""); + pigeonResult.isMainFrame = [GetNullableObjectAtIndex(list, 0) boolValue]; return pigeonResult; } + (nullable FWFWKFrameInfoData *)nullableFromList:(NSArray *)list { @@ -452,13 +593,13 @@ + (nullable FWFWKFrameInfoData *)nullableFromList:(NSArray *)list { } - (NSArray *)toList { return @[ - (self.isMainFrame ?: [NSNull null]), + @(self.isMainFrame), ]; } @end @implementation FWFNSErrorData -+ (instancetype)makeWithCode:(NSNumber *)code ++ (instancetype)makeWithCode:(NSInteger)code domain:(NSString *)domain userInfo:(nullable NSDictionary *)userInfo { FWFNSErrorData *pigeonResult = [[FWFNSErrorData alloc] init]; @@ -469,10 +610,8 @@ + (instancetype)makeWithCode:(NSNumber *)code } + (FWFNSErrorData *)fromList:(NSArray *)list { FWFNSErrorData *pigeonResult = [[FWFNSErrorData alloc] init]; - pigeonResult.code = GetNullableObjectAtIndex(list, 0); - NSAssert(pigeonResult.code != nil, @""); + pigeonResult.code = [GetNullableObjectAtIndex(list, 0) integerValue]; pigeonResult.domain = GetNullableObjectAtIndex(list, 1); - NSAssert(pigeonResult.domain != nil, @""); pigeonResult.userInfo = GetNullableObjectAtIndex(list, 2); return pigeonResult; } @@ -481,15 +620,15 @@ + (nullable FWFNSErrorData *)nullableFromList:(NSArray *)list { } - (NSArray *)toList { return @[ - (self.code ?: [NSNull null]), - (self.domain ?: [NSNull null]), - (self.userInfo ?: [NSNull null]), + @(self.code), + self.domain ?: [NSNull null], + self.userInfo ?: [NSNull null], ]; } @end @implementation FWFWKScriptMessageData -+ (instancetype)makeWithName:(NSString *)name body:(id)body { ++ (instancetype)makeWithName:(NSString *)name body:(nullable id)body { FWFWKScriptMessageData *pigeonResult = [[FWFWKScriptMessageData alloc] init]; pigeonResult.name = name; pigeonResult.body = body; @@ -498,7 +637,6 @@ + (instancetype)makeWithName:(NSString *)name body:(id)body { + (FWFWKScriptMessageData *)fromList:(NSArray *)list { FWFWKScriptMessageData *pigeonResult = [[FWFWKScriptMessageData alloc] init]; pigeonResult.name = GetNullableObjectAtIndex(list, 0); - NSAssert(pigeonResult.name != nil, @""); pigeonResult.body = GetNullableObjectAtIndex(list, 1); return pigeonResult; } @@ -507,14 +645,14 @@ + (nullable FWFWKScriptMessageData *)nullableFromList:(NSArray *)list { } - (NSArray *)toList { return @[ - (self.name ?: [NSNull null]), - (self.body ?: [NSNull null]), + self.name ?: [NSNull null], + self.body ?: [NSNull null], ]; } @end @implementation FWFWKSecurityOriginData -+ (instancetype)makeWithHost:(NSString *)host port:(NSNumber *)port protocol:(NSString *)protocol { ++ (instancetype)makeWithHost:(NSString *)host port:(NSInteger)port protocol:(NSString *)protocol { FWFWKSecurityOriginData *pigeonResult = [[FWFWKSecurityOriginData alloc] init]; pigeonResult.host = host; pigeonResult.port = port; @@ -524,11 +662,8 @@ + (instancetype)makeWithHost:(NSString *)host port:(NSNumber *)port protocol:(NS + (FWFWKSecurityOriginData *)fromList:(NSArray *)list { FWFWKSecurityOriginData *pigeonResult = [[FWFWKSecurityOriginData alloc] init]; pigeonResult.host = GetNullableObjectAtIndex(list, 0); - NSAssert(pigeonResult.host != nil, @""); - pigeonResult.port = GetNullableObjectAtIndex(list, 1); - NSAssert(pigeonResult.port != nil, @""); + pigeonResult.port = [GetNullableObjectAtIndex(list, 1) integerValue]; pigeonResult.protocol = GetNullableObjectAtIndex(list, 2); - NSAssert(pigeonResult.protocol != nil, @""); return pigeonResult; } + (nullable FWFWKSecurityOriginData *)nullableFromList:(NSArray *)list { @@ -536,9 +671,9 @@ + (nullable FWFWKSecurityOriginData *)nullableFromList:(NSArray *)list { } - (NSArray *)toList { return @[ - (self.host ?: [NSNull null]), - (self.port ?: [NSNull null]), - (self.protocol ?: [NSNull null]), + self.host ?: [NSNull null], + @(self.port), + self.protocol ?: [NSNull null], ]; } @end @@ -554,9 +689,7 @@ + (instancetype)makeWithPropertyKeys:(NSArray binaryMessenger, +void SetUpFWFWKWebsiteDataStoreHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -660,8 +792,8 @@ void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenge api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSInteger arg_configurationIdentifier = [GetNullableObjectAtIndex(args, 1) integerValue]; FlutterError *error; [api createFromWebViewConfigurationWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier @@ -685,7 +817,7 @@ void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenge api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api createDefaultDataStoreWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); @@ -709,9 +841,10 @@ void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenge api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; NSArray *arg_dataTypes = GetNullableObjectAtIndex(args, 1); - NSNumber *arg_modificationTimeInSecondsSinceEpoch = GetNullableObjectAtIndex(args, 2); + double arg_modificationTimeInSecondsSinceEpoch = + [GetNullableObjectAtIndex(args, 2) doubleValue]; [api removeDataFromDataStoreWithIdentifier:arg_identifier ofTypes:arg_dataTypes modifiedSince:arg_modificationTimeInSecondsSinceEpoch @@ -731,7 +864,7 @@ void FWFWKWebsiteDataStoreHostApiSetup(id binaryMessenge return sSharedObject; } -void FWFUIViewHostApiSetup(id binaryMessenger, +void SetUpFWFUIViewHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -747,7 +880,7 @@ void FWFUIViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; NSNumber *arg_value = GetNullableObjectAtIndex(args, 1); FlutterError *error; [api setBackgroundColorForViewWithIdentifier:arg_identifier toValue:arg_value error:&error]; @@ -769,8 +902,8 @@ void FWFUIViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_opaque = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + BOOL arg_opaque = [GetNullableObjectAtIndex(args, 1) boolValue]; FlutterError *error; [api setOpaqueForViewWithIdentifier:arg_identifier isOpaque:arg_opaque error:&error]; callback(wrapResult(nil, error)); @@ -786,7 +919,7 @@ void FWFUIViewHostApiSetup(id binaryMessenger, return sSharedObject; } -void FWFUIScrollViewHostApiSetup(id binaryMessenger, +void SetUpFWFUIScrollViewHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -802,8 +935,8 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_webViewIdentifier = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSInteger arg_webViewIdentifier = [GetNullableObjectAtIndex(args, 1) integerValue]; FlutterError *error; [api createFromWebViewWithIdentifier:arg_identifier webViewIdentifier:arg_webViewIdentifier @@ -827,7 +960,7 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; NSArray *output = [api contentOffsetForScrollViewWithIdentifier:arg_identifier error:&error]; @@ -849,9 +982,9 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_x = GetNullableObjectAtIndex(args, 1); - NSNumber *arg_y = GetNullableObjectAtIndex(args, 2); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + double arg_x = [GetNullableObjectAtIndex(args, 1) doubleValue]; + double arg_y = [GetNullableObjectAtIndex(args, 2) doubleValue]; FlutterError *error; [api scrollByForScrollViewWithIdentifier:arg_identifier x:arg_x y:arg_y error:&error]; callback(wrapResult(nil, error)); @@ -874,9 +1007,9 @@ void FWFUIScrollViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_x = GetNullableObjectAtIndex(args, 1); - NSNumber *arg_y = GetNullableObjectAtIndex(args, 2); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + double arg_x = [GetNullableObjectAtIndex(args, 1) doubleValue]; + double arg_y = [GetNullableObjectAtIndex(args, 2) doubleValue]; FlutterError *error; [api setContentOffsetForScrollViewWithIdentifier:arg_identifier toX:arg_x @@ -937,7 +1070,7 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { return sSharedObject; } -void FWFWKWebViewConfigurationHostApiSetup(id binaryMessenger, +void SetUpFWFWKWebViewConfigurationHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -952,7 +1085,7 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); @@ -975,8 +1108,8 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_webViewIdentifier = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSInteger arg_webViewIdentifier = [GetNullableObjectAtIndex(args, 1) integerValue]; FlutterError *error; [api createFromWebViewWithIdentifier:arg_identifier webViewIdentifier:arg_webViewIdentifier @@ -1002,8 +1135,8 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + BOOL arg_allow = [GetNullableObjectAtIndex(args, 1) boolValue]; FlutterError *error; [api setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:arg_identifier isAllowed:arg_allow @@ -1030,8 +1163,8 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_limit = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + BOOL arg_limit = [GetNullableObjectAtIndex(args, 1) boolValue]; FlutterError *error; [api setLimitsNavigationsToAppBoundDomainsForConfigurationWithIdentifier:arg_identifier isLimited:arg_limit @@ -1058,7 +1191,7 @@ void FWFWKWebViewConfigurationHostApiSetup(id binaryMess api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; NSArray *arg_types = GetNullableObjectAtIndex(args, 1); FlutterError *error; [api setMediaTypesRequiresUserActionForConfigurationWithIdentifier:arg_identifier @@ -1090,17 +1223,30 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)createWithIdentifier:(NSNumber *)arg_identifier +- (void)createWithIdentifier:(NSInteger)arg_identifier completion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName: @"dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationFlutterApi.create" binaryMessenger:self.binaryMessenger codec:FWFWKWebViewConfigurationFlutterApiGetCodec()]; - [channel sendMessage:@[ arg_identifier ?: [NSNull null] ] - reply:^(id reply) { - completion(nil); - }]; + [channel + sendMessage:@[ @(arg_identifier) ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion([FlutterError errorWithCode:@"channel-error" + message:@"Unable to establish connection on channel." + details:@""]); + } + }]; } @end @@ -1157,7 +1303,7 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { return sSharedObject; } -void FWFWKUserContentControllerHostApiSetup(id binaryMessenger, +void SetUpFWFWKUserContentControllerHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -1174,8 +1320,8 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSInteger arg_configurationIdentifier = [GetNullableObjectAtIndex(args, 1) integerValue]; FlutterError *error; [api createFromWebViewConfigurationWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier @@ -1202,8 +1348,8 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_handlerIdentifier = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSInteger arg_handlerIdentifier = [GetNullableObjectAtIndex(args, 1) integerValue]; NSString *arg_name = GetNullableObjectAtIndex(args, 2); FlutterError *error; [api addScriptMessageHandlerForControllerWithIdentifier:arg_identifier @@ -1230,7 +1376,7 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; NSString *arg_name = GetNullableObjectAtIndex(args, 1); FlutterError *error; [api removeScriptMessageHandlerForControllerWithIdentifier:arg_identifier @@ -1256,7 +1402,7 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api removeAllScriptMessageHandlersForControllerWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); @@ -1279,7 +1425,7 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FWFWKUserScriptData *arg_userScript = GetNullableObjectAtIndex(args, 1); FlutterError *error; [api addUserScriptForControllerWithIdentifier:arg_identifier @@ -1305,7 +1451,7 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api removeAllUserScriptsForControllerWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); @@ -1321,7 +1467,7 @@ void FWFWKUserContentControllerHostApiSetup(id binaryMes return sSharedObject; } -void FWFWKPreferencesHostApiSetup(id binaryMessenger, +void SetUpFWFWKPreferencesHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -1338,8 +1484,8 @@ void FWFWKPreferencesHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSInteger arg_configurationIdentifier = [GetNullableObjectAtIndex(args, 1) integerValue]; FlutterError *error; [api createFromWebViewConfigurationWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier @@ -1364,8 +1510,8 @@ void FWFWKPreferencesHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_enabled = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + BOOL arg_enabled = [GetNullableObjectAtIndex(args, 1) boolValue]; FlutterError *error; [api setJavaScriptEnabledForPreferencesWithIdentifier:arg_identifier isEnabled:arg_enabled @@ -1383,7 +1529,7 @@ void FWFWKPreferencesHostApiSetup(id binaryMessenger, return sSharedObject; } -void FWFWKScriptMessageHandlerHostApiSetup(id binaryMessenger, +void SetUpFWFWKScriptMessageHandlerHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -1398,7 +1544,7 @@ void FWFWKScriptMessageHandlerHostApiSetup(id binaryMess api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); @@ -1470,8 +1616,8 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina return self; } - (void) - didReceiveScriptMessageForHandlerWithIdentifier:(NSNumber *)arg_identifier - userContentControllerIdentifier:(NSNumber *)arg_userContentControllerIdentifier + didReceiveScriptMessageForHandlerWithIdentifier:(NSInteger)arg_identifier + userContentControllerIdentifier:(NSInteger)arg_userContentControllerIdentifier message:(FWFWKScriptMessageData *)arg_message completion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel @@ -1479,13 +1625,25 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina @"WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage" binaryMessenger:self.binaryMessenger codec:FWFWKScriptMessageHandlerFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_userContentControllerIdentifier ?: [NSNull null], - arg_message ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); - }]; + [channel + sendMessage:@[ + @(arg_identifier), @(arg_userContentControllerIdentifier), arg_message ?: [NSNull null] + ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion([FlutterError errorWithCode:@"channel-error" + message:@"Unable to establish connection on channel." + details:@""]); + } + }]; } @end @@ -1495,7 +1653,7 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina return sSharedObject; } -void FWFWKNavigationDelegateHostApiSetup(id binaryMessenger, +void SetUpFWFWKNavigationDelegateHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -1510,7 +1668,7 @@ void FWFWKNavigationDelegateHostApiSetup(id binaryMessen api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); @@ -1601,8 +1759,8 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier +- (void)didFinishNavigationForDelegateWithIdentifier:(NSInteger)arg_identifier + webViewIdentifier:(NSInteger)arg_webViewIdentifier URL:(nullable NSString *)arg_url completion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel @@ -1610,16 +1768,26 @@ - (void)didFinishNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier @"WKNavigationDelegateFlutterApi.didFinishNavigation" binaryMessenger:self.binaryMessenger codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_url ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); - }]; -} -- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier + [channel + sendMessage:@[ @(arg_identifier), @(arg_webViewIdentifier), arg_url ?: [NSNull null] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion([FlutterError errorWithCode:@"channel-error" + message:@"Unable to establish connection on channel." + details:@""]); + } + }]; +} +- (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSInteger)arg_identifier + webViewIdentifier:(NSInteger)arg_webViewIdentifier URL:(nullable NSString *)arg_url completion:(void (^)(FlutterError *_Nullable)) completion { @@ -1628,16 +1796,26 @@ - (void)didStartProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)arg_i @"WKNavigationDelegateFlutterApi.didStartProvisionalNavigation" binaryMessenger:self.binaryMessenger codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_url ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); - }]; -} -- (void)decidePolicyForNavigationActionForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier + [channel + sendMessage:@[ @(arg_identifier), @(arg_webViewIdentifier), arg_url ?: [NSNull null] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion([FlutterError errorWithCode:@"channel-error" + message:@"Unable to establish connection on channel." + details:@""]); + } + }]; +} +- (void)decidePolicyForNavigationActionForDelegateWithIdentifier:(NSInteger)arg_identifier + webViewIdentifier:(NSInteger)arg_webViewIdentifier navigationAction:(FWFWKNavigationActionData *) arg_navigationAction completion: @@ -1651,16 +1829,29 @@ - (void)decidePolicyForNavigationActionForDelegateWithIdentifier:(NSNumber *)arg binaryMessenger:self.binaryMessenger codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_navigationAction ?: [NSNull null] + @(arg_identifier), @(arg_webViewIdentifier), arg_navigationAction ?: [NSNull null] ] - reply:^(id reply) { - FWFWKNavigationActionPolicyEnumData *output = reply; - completion(output, nil); + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion(nil, [FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + FWFWKNavigationActionPolicyEnumData *output = + reply[0] == [NSNull null] ? nil : reply[0]; + completion(output, nil); + } + } else { + completion(nil, [FlutterError + errorWithCode:@"channel-error" + message:@"Unable to establish connection on channel." + details:@""]); + } }]; } -- (void)didFailNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier +- (void)didFailNavigationForDelegateWithIdentifier:(NSInteger)arg_identifier + webViewIdentifier:(NSInteger)arg_webViewIdentifier error:(FWFNSErrorData *)arg_error completion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel @@ -1668,16 +1859,26 @@ - (void)didFailNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier @"WKNavigationDelegateFlutterApi.didFailNavigation" binaryMessenger:self.binaryMessenger codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_error ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); - }]; -} -- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier + [channel + sendMessage:@[ @(arg_identifier), @(arg_webViewIdentifier), arg_error ?: [NSNull null] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion([FlutterError errorWithCode:@"channel-error" + message:@"Unable to establish connection on channel." + details:@""]); + } + }]; +} +- (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSInteger)arg_identifier + webViewIdentifier:(NSInteger)arg_webViewIdentifier error:(FWFNSErrorData *)arg_error completion:(void (^)(FlutterError *_Nullable)) completion { @@ -1686,17 +1887,27 @@ - (void)didFailProvisionalNavigationForDelegateWithIdentifier:(NSNumber *)arg_id @"WKNavigationDelegateFlutterApi.didFailProvisionalNavigation" binaryMessenger:self.binaryMessenger codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_error ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); - }]; -} -- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSNumber *)arg_identifier + [channel + sendMessage:@[ @(arg_identifier), @(arg_webViewIdentifier), arg_error ?: [NSNull null] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion([FlutterError errorWithCode:@"channel-error" + message:@"Unable to establish connection on channel." + details:@""]); + } + }]; +} +- (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSInteger)arg_identifier webViewIdentifier: - (NSNumber *)arg_webViewIdentifier + (NSInteger)arg_webViewIdentifier completion: (void (^)(FlutterError *_Nullable)) completion { @@ -1705,10 +1916,23 @@ - (void)webViewWebContentProcessDidTerminateForDelegateWithIdentifier:(NSNumber @"WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate" binaryMessenger:self.binaryMessenger codec:FWFWKNavigationDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null] ] - reply:^(id reply) { - completion(nil); - }]; + [channel + sendMessage:@[ @(arg_identifier), @(arg_webViewIdentifier) ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion([FlutterError errorWithCode:@"channel-error" + message:@"Unable to establish connection on channel." + details:@""]); + } + }]; } @end @@ -1760,7 +1984,7 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { return sSharedObject; } -void FWFNSObjectHostApiSetup(id binaryMessenger, +void SetUpFWFNSObjectHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -1774,7 +1998,7 @@ void FWFNSObjectHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api disposeObjectWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); @@ -1798,8 +2022,8 @@ void FWFNSObjectHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_observerIdentifier = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSInteger arg_observerIdentifier = [GetNullableObjectAtIndex(args, 1) integerValue]; NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); NSArray *arg_options = GetNullableObjectAtIndex(args, 3); @@ -1830,8 +2054,8 @@ void FWFNSObjectHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_observerIdentifier = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSInteger arg_observerIdentifier = [GetNullableObjectAtIndex(args, 1) integerValue]; NSString *arg_keyPath = GetNullableObjectAtIndex(args, 2); FlutterError *error; [api removeObserverForObjectWithIdentifier:arg_identifier @@ -1911,9 +2135,9 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)observeValueForObjectWithIdentifier:(NSNumber *)arg_identifier +- (void)observeValueForObjectWithIdentifier:(NSInteger)arg_identifier keyPath:(NSString *)arg_keyPath - objectIdentifier:(NSNumber *)arg_objectIdentifier + objectIdentifier:(NSInteger)arg_objectIdentifier changeKeys: (NSArray *)arg_changeKeys changeValues:(NSArray *)arg_changeValues @@ -1923,26 +2147,51 @@ - (void)observeValueForObjectWithIdentifier:(NSNumber *)arg_identifier @"dev.flutter.pigeon.webview_flutter_wkwebview.NSObjectFlutterApi.observeValue" binaryMessenger:self.binaryMessenger codec:FWFNSObjectFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_keyPath ?: [NSNull null], - arg_objectIdentifier ?: [NSNull null], arg_changeKeys ?: [NSNull null], - arg_changeValues ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); - }]; -} -- (void)disposeObjectWithIdentifier:(NSNumber *)arg_identifier + [channel + sendMessage:@[ + @(arg_identifier), arg_keyPath ?: [NSNull null], @(arg_objectIdentifier), + arg_changeKeys ?: [NSNull null], arg_changeValues ?: [NSNull null] + ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion([FlutterError errorWithCode:@"channel-error" + message:@"Unable to establish connection on channel." + details:@""]); + } + }]; +} +- (void)disposeObjectWithIdentifier:(NSInteger)arg_identifier completion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName: @"dev.flutter.pigeon.webview_flutter_wkwebview.NSObjectFlutterApi.dispose" binaryMessenger:self.binaryMessenger codec:FWFNSObjectFlutterApiGetCodec()]; - [channel sendMessage:@[ arg_identifier ?: [NSNull null] ] - reply:^(id reply) { - completion(nil); - }]; + [channel + sendMessage:@[ @(arg_identifier) ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion([FlutterError errorWithCode:@"channel-error" + message:@"Unable to establish connection on channel." + details:@""]); + } + }]; } @end @@ -2079,7 +2328,7 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { return sSharedObject; } -void FWFWKWebViewHostApiSetup(id binaryMessenger, +void SetUpFWFWKWebViewHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -2094,8 +2343,8 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_configurationIdentifier = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSInteger arg_configurationIdentifier = [GetNullableObjectAtIndex(args, 1) integerValue]; FlutterError *error; [api createWithIdentifier:arg_identifier configurationIdentifier:arg_configurationIdentifier @@ -2120,7 +2369,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; NSNumber *arg_uiDelegateIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; [api setUIDelegateForWebViewWithIdentifier:arg_identifier @@ -2147,7 +2396,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; NSNumber *arg_navigationDelegateIdentifier = GetNullableObjectAtIndex(args, 1); FlutterError *error; [api setNavigationDelegateForWebViewWithIdentifier:arg_identifier @@ -2171,7 +2420,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; NSString *output = [api URLForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); @@ -2194,7 +2443,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; NSNumber *output = [api estimatedProgressForWebViewWithIdentifier:arg_identifier error:&error]; @@ -2217,7 +2466,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FWFNSUrlRequestData *arg_request = GetNullableObjectAtIndex(args, 1); FlutterError *error; [api loadRequestForWebViewWithIdentifier:arg_identifier request:arg_request error:&error]; @@ -2241,7 +2490,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; NSString *arg_string = GetNullableObjectAtIndex(args, 1); NSString *arg_baseUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; @@ -2268,7 +2517,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; NSString *arg_url = GetNullableObjectAtIndex(args, 1); NSString *arg_readAccessUrl = GetNullableObjectAtIndex(args, 2); FlutterError *error; @@ -2296,7 +2545,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; NSString *arg_key = GetNullableObjectAtIndex(args, 1); FlutterError *error; [api loadAssetForWebViewWithIdentifier:arg_identifier assetKey:arg_key error:&error]; @@ -2318,7 +2567,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; NSNumber *output = [api canGoBackForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); @@ -2340,7 +2589,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; NSNumber *output = [api canGoForwardForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); @@ -2361,7 +2610,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api goBackForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); @@ -2382,7 +2631,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api goForwardForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); @@ -2403,7 +2652,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api reloadWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); @@ -2424,7 +2673,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; NSString *output = [api titleForWebViewWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); @@ -2447,8 +2696,8 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_allow = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + BOOL arg_allow = [GetNullableObjectAtIndex(args, 1) boolValue]; FlutterError *error; [api setAllowsBackForwardForWebViewWithIdentifier:arg_identifier isAllowed:arg_allow @@ -2473,7 +2722,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; NSString *arg_userAgent = GetNullableObjectAtIndex(args, 1); FlutterError *error; [api setCustomUserAgentForWebViewWithIdentifier:arg_identifier @@ -2500,7 +2749,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; NSString *arg_javaScriptString = GetNullableObjectAtIndex(args, 1); [api evaluateJavaScriptForWebViewWithIdentifier:arg_identifier javaScriptString:arg_javaScriptString @@ -2527,8 +2776,8 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_inspectable = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + BOOL arg_inspectable = [GetNullableObjectAtIndex(args, 1) boolValue]; FlutterError *error; [api setInspectableForWebViewWithIdentifier:arg_identifier inspectable:arg_inspectable @@ -2552,7 +2801,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; NSString *output = [api customUserAgentForWebViewWithIdentifier:arg_identifier error:&error]; @@ -2569,7 +2818,7 @@ void FWFWKWebViewHostApiSetup(id binaryMessenger, return sSharedObject; } -void FWFWKUIDelegateHostApiSetup(id binaryMessenger, +void SetUpFWFWKUIDelegateHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -2583,7 +2832,7 @@ void FWFWKUIDelegateHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; [api createWithIdentifier:arg_identifier error:&error]; callback(wrapResult(nil, error)); @@ -2679,9 +2928,9 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)onCreateWebViewForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier - configurationIdentifier:(NSNumber *)arg_configurationIdentifier +- (void)onCreateWebViewForDelegateWithIdentifier:(NSInteger)arg_identifier + webViewIdentifier:(NSInteger)arg_webViewIdentifier + configurationIdentifier:(NSInteger)arg_configurationIdentifier navigationAction:(FWFWKNavigationActionData *)arg_navigationAction completion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel @@ -2689,16 +2938,29 @@ - (void)onCreateWebViewForDelegateWithIdentifier:(NSNumber *)arg_identifier @"dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi.onCreateWebView" binaryMessenger:self.binaryMessenger codec:FWFWKUIDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_configurationIdentifier ?: [NSNull null], arg_navigationAction ?: [NSNull null] - ] - reply:^(id reply) { - completion(nil); - }]; -} -- (void)requestMediaCapturePermissionForDelegateWithIdentifier:(NSNumber *)arg_identifier - webViewIdentifier:(NSNumber *)arg_webViewIdentifier + [channel + sendMessage:@[ + @(arg_identifier), @(arg_webViewIdentifier), @(arg_configurationIdentifier), + arg_navigationAction ?: [NSNull null] + ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion([FlutterError errorWithCode:@"channel-error" + message:@"Unable to establish connection on channel." + details:@""]); + } + }]; +} +- (void)requestMediaCapturePermissionForDelegateWithIdentifier:(NSInteger)arg_identifier + webViewIdentifier:(NSInteger)arg_webViewIdentifier origin:(FWFWKSecurityOriginData *)arg_origin frame:(FWFWKFrameInfoData *)arg_frame type:(FWFWKMediaCaptureTypeData *)arg_type @@ -2711,14 +2973,28 @@ - (void)requestMediaCapturePermissionForDelegateWithIdentifier:(NSNumber *)arg_i @"requestMediaCapturePermission" binaryMessenger:self.binaryMessenger codec:FWFWKUIDelegateFlutterApiGetCodec()]; - [channel sendMessage:@[ - arg_identifier ?: [NSNull null], arg_webViewIdentifier ?: [NSNull null], - arg_origin ?: [NSNull null], arg_frame ?: [NSNull null], arg_type ?: [NSNull null] - ] - reply:^(id reply) { - FWFWKPermissionDecisionData *output = reply; - completion(output, nil); - }]; + [channel + sendMessage:@[ + @(arg_identifier), @(arg_webViewIdentifier), arg_origin ?: [NSNull null], + arg_frame ?: [NSNull null], arg_type ?: [NSNull null] + ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion(nil, [FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + FWFWKPermissionDecisionData *output = reply[0] == [NSNull null] ? nil : reply[0]; + completion(output, nil); + } + } else { + completion(nil, + [FlutterError errorWithCode:@"channel-error" + message:@"Unable to establish connection on channel." + details:@""]); + } + }]; } @end @@ -2775,7 +3051,7 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { return sSharedObject; } -void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger, +void SetUpFWFWKHttpCookieStoreHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -2791,8 +3067,8 @@ void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); - NSNumber *arg_websiteDataStoreIdentifier = GetNullableObjectAtIndex(args, 1); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSInteger arg_websiteDataStoreIdentifier = [GetNullableObjectAtIndex(args, 1) integerValue]; FlutterError *error; [api createFromWebsiteDataStoreWithIdentifier:arg_identifier dataStoreIdentifier:arg_websiteDataStoreIdentifier @@ -2817,7 +3093,7 @@ void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FWFNSHttpCookieData *arg_cookie = GetNullableObjectAtIndex(args, 1); [api setCookieForStoreWithIdentifier:arg_identifier cookie:arg_cookie @@ -2836,7 +3112,7 @@ void FWFWKHttpCookieStoreHostApiSetup(id binaryMessenger return sSharedObject; } -void FWFNSUrlHostApiSetup(id binaryMessenger, +void SetUpFWFNSUrlHostApi(id binaryMessenger, NSObject *api) { { FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] @@ -2851,7 +3127,7 @@ void FWFNSUrlHostApiSetup(id binaryMessenger, api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0); + NSInteger arg_identifier = [GetNullableObjectAtIndex(args, 0) integerValue]; FlutterError *error; NSString *output = [api absoluteStringForNSURLWithIdentifier:arg_identifier error:&error]; callback(wrapResult(output, error)); @@ -2880,15 +3156,28 @@ - (instancetype)initWithBinaryMessenger:(NSObject *)bina } return self; } -- (void)createWithIdentifier:(NSNumber *)arg_identifier +- (void)createWithIdentifier:(NSInteger)arg_identifier completion:(void (^)(FlutterError *_Nullable))completion { FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel messageChannelWithName:@"dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlFlutterApi.create" binaryMessenger:self.binaryMessenger codec:FWFNSUrlFlutterApiGetCodec()]; - [channel sendMessage:@[ arg_identifier ?: [NSNull null] ] - reply:^(id reply) { - completion(nil); - }]; + [channel + sendMessage:@[ @(arg_identifier) ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion([FlutterError errorWithCode:@"channel-error" + message:@"Unable to establish connection on channel." + details:@""]); + } + }]; } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m index a5f4e02b9c2f..54703ff15b70 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFHTTPCookieStoreHostApi.m @@ -20,21 +20,20 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { return self; } -- (WKHTTPCookieStore *)HTTPCookieStoreForIdentifier:(NSNumber *)identifier { - return (WKHTTPCookieStore *)[self.instanceManager instanceForIdentifier:identifier.longValue]; +- (WKHTTPCookieStore *)HTTPCookieStoreForIdentifier:(NSInteger)identifier { + return (WKHTTPCookieStore *)[self.instanceManager instanceForIdentifier:identifier]; } -- (void)createFromWebsiteDataStoreWithIdentifier:(nonnull NSNumber *)identifier - dataStoreIdentifier:(nonnull NSNumber *)websiteDataStoreIdentifier +- (void)createFromWebsiteDataStoreWithIdentifier:(NSInteger)identifier + dataStoreIdentifier:(NSInteger)websiteDataStoreIdentifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull) error { - WKWebsiteDataStore *dataStore = (WKWebsiteDataStore *)[self.instanceManager - instanceForIdentifier:websiteDataStoreIdentifier.longValue]; - [self.instanceManager addDartCreatedInstance:dataStore.httpCookieStore - withIdentifier:identifier.longValue]; + WKWebsiteDataStore *dataStore = + (WKWebsiteDataStore *)[self.instanceManager instanceForIdentifier:websiteDataStoreIdentifier]; + [self.instanceManager addDartCreatedInstance:dataStore.httpCookieStore withIdentifier:identifier]; } -- (void)setCookieForStoreWithIdentifier:(nonnull NSNumber *)identifier +- (void)setCookieForStoreWithIdentifier:(NSInteger)identifier cookie:(nonnull FWFNSHttpCookieData *)cookie completion:(nonnull void (^)(FlutterError *_Nullable))completion { NSHTTPCookie *nsCookie = FWFNativeNSHTTPCookieFromCookieData(cookie); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFInstanceManager.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFInstanceManager.m index 242a5f707348..c2af8444a425 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFInstanceManager.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFInstanceManager.m @@ -51,7 +51,6 @@ @interface FWFInstanceManager () @property NSMapTable *identifiers; @property NSMapTable *weakInstances; @property NSMapTable *strongInstances; -@property long nextIdentifier; @end @implementation FWFInstanceManager diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFInstanceManager_Test.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFInstanceManager_Test.h index c33388b1a0ec..63480ce18018 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFInstanceManager_Test.h +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFInstanceManager_Test.h @@ -7,6 +7,11 @@ NS_ASSUME_NONNULL_BEGIN @interface FWFInstanceManager () +/** + * The next identifier that will be used for a host-created instance. + */ +@property long nextIdentifier; + /** * The number of instances stored as a strong reference. * diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m index f8b5925f2215..30035d04e5d4 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFNavigationDelegateHostApi.m @@ -29,9 +29,9 @@ - (void)didFinishNavigationForDelegate:(FWFNavigationDelegate *)instance webView:(WKWebView *)webView URL:(NSString *)URL completion:(void (^)(FlutterError *_Nullable))completion { - NSNumber *webViewIdentifier = - @([self.instanceManager identifierWithStrongReferenceForInstance:webView]); - [self didFinishNavigationForDelegateWithIdentifier:@([self identifierForDelegate:instance]) + NSInteger webViewIdentifier = + [self.instanceManager identifierWithStrongReferenceForInstance:webView]; + [self didFinishNavigationForDelegateWithIdentifier:[self identifierForDelegate:instance] webViewIdentifier:webViewIdentifier URL:URL completion:completion]; @@ -41,10 +41,9 @@ - (void)didStartProvisionalNavigationForDelegate:(FWFNavigationDelegate *)instan webView:(WKWebView *)webView URL:(NSString *)URL completion:(void (^)(FlutterError *_Nullable))completion { - NSNumber *webViewIdentifier = - @([self.instanceManager identifierWithStrongReferenceForInstance:webView]); - [self didStartProvisionalNavigationForDelegateWithIdentifier:@([self - identifierForDelegate:instance]) + NSInteger webViewIdentifier = + [self.instanceManager identifierWithStrongReferenceForInstance:webView]; + [self didStartProvisionalNavigationForDelegateWithIdentifier:[self identifierForDelegate:instance] webViewIdentifier:webViewIdentifier URL:URL completion:completion]; @@ -57,13 +56,12 @@ - (void)didStartProvisionalNavigationForDelegate:(FWFNavigationDelegate *)instan completion: (void (^)(FWFWKNavigationActionPolicyEnumData *_Nullable, FlutterError *_Nullable))completion { - NSNumber *webViewIdentifier = - @([self.instanceManager identifierWithStrongReferenceForInstance:webView]); + NSInteger webViewIdentifier = + [self.instanceManager identifierWithStrongReferenceForInstance:webView]; FWFWKNavigationActionData *navigationActionData = FWFWKNavigationActionDataFromNativeWKNavigationAction(navigationAction); [self - decidePolicyForNavigationActionForDelegateWithIdentifier:@([self - identifierForDelegate:instance]) + decidePolicyForNavigationActionForDelegateWithIdentifier:[self identifierForDelegate:instance] webViewIdentifier:webViewIdentifier navigationAction:navigationActionData completion:completion]; @@ -73,9 +71,9 @@ - (void)didFailNavigationForDelegate:(FWFNavigationDelegate *)instance webView:(WKWebView *)webView error:(NSError *)error completion:(void (^)(FlutterError *_Nullable))completion { - NSNumber *webViewIdentifier = - @([self.instanceManager identifierWithStrongReferenceForInstance:webView]); - [self didFailNavigationForDelegateWithIdentifier:@([self identifierForDelegate:instance]) + NSInteger webViewIdentifier = + [self.instanceManager identifierWithStrongReferenceForInstance:webView]; + [self didFailNavigationForDelegateWithIdentifier:[self identifierForDelegate:instance] webViewIdentifier:webViewIdentifier error:FWFNSErrorDataFromNativeNSError(error) completion:completion]; @@ -85,23 +83,22 @@ - (void)didFailProvisionalNavigationForDelegate:(FWFNavigationDelegate *)instanc webView:(WKWebView *)webView error:(NSError *)error completion:(void (^)(FlutterError *_Nullable))completion { - NSNumber *webViewIdentifier = - @([self.instanceManager identifierWithStrongReferenceForInstance:webView]); - [self - didFailProvisionalNavigationForDelegateWithIdentifier:@([self identifierForDelegate:instance]) - webViewIdentifier:webViewIdentifier - error:FWFNSErrorDataFromNativeNSError(error) - completion:completion]; + NSInteger webViewIdentifier = + [self.instanceManager identifierWithStrongReferenceForInstance:webView]; + [self didFailProvisionalNavigationForDelegateWithIdentifier:[self identifierForDelegate:instance] + webViewIdentifier:webViewIdentifier + error:FWFNSErrorDataFromNativeNSError(error) + completion:completion]; } - (void)webViewWebContentProcessDidTerminateForDelegate:(FWFNavigationDelegate *)instance webView:(WKWebView *)webView completion: (void (^)(FlutterError *_Nullable))completion { - NSNumber *webViewIdentifier = - @([self.instanceManager identifierWithStrongReferenceForInstance:webView]); + NSInteger webViewIdentifier = + [self.instanceManager identifierWithStrongReferenceForInstance:webView]; [self webViewWebContentProcessDidTerminateForDelegateWithIdentifier: - @([self identifierForDelegate:instance]) + [self identifierForDelegate:instance] webViewIdentifier:webViewIdentifier completion:completion]; } @@ -203,16 +200,15 @@ - (instancetype)initWithBinaryMessenger:(id)binaryMessen return self; } -- (FWFNavigationDelegate *)navigationDelegateForIdentifier:(NSNumber *)identifier { - return (FWFNavigationDelegate *)[self.instanceManager instanceForIdentifier:identifier.longValue]; +- (FWFNavigationDelegate *)navigationDelegateForIdentifier:(NSInteger)identifier { + return (FWFNavigationDelegate *)[self.instanceManager instanceForIdentifier:identifier]; } -- (void)createWithIdentifier:(nonnull NSNumber *)identifier +- (void)createWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { FWFNavigationDelegate *navigationDelegate = [[FWFNavigationDelegate alloc] initWithBinaryMessenger:self.binaryMessenger instanceManager:self.instanceManager]; - [self.instanceManager addDartCreatedInstance:navigationDelegate - withIdentifier:identifier.longValue]; + [self.instanceManager addDartCreatedInstance:navigationDelegate withIdentifier:identifier]; } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m index 3adf7246a9a0..098d291c6c2b 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m @@ -58,12 +58,12 @@ - (void)observeValueForObject:(NSObject *)instance ? @([self.instanceManager identifierWithStrongReferenceForInstance:value]) : value; [changeValues addObject:[FWFObjectOrIdentifier makeWithValue:returnValue - isIdentifier:@(isIdentifier)]]; + isIdentifier:isIdentifier]]; }]; - NSNumber *objectIdentifier = - @([self.instanceManager identifierWithStrongReferenceForInstance:object]); - [self observeValueForObjectWithIdentifier:@([self identifierForObject:instance]) + NSInteger objectIdentifier = + [self.instanceManager identifierWithStrongReferenceForInstance:object]; + [self observeValueForObjectWithIdentifier:[self identifierForObject:instance] keyPath:keyPath objectIdentifier:objectIdentifier changeKeys:changeKeys @@ -111,12 +111,12 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { return self; } -- (NSObject *)objectForIdentifier:(NSNumber *)identifier { - return (NSObject *)[self.instanceManager instanceForIdentifier:identifier.longValue]; +- (NSObject *)objectForIdentifier:(NSInteger)identifier { + return (NSObject *)[self.instanceManager instanceForIdentifier:identifier]; } -- (void)addObserverForObjectWithIdentifier:(nonnull NSNumber *)identifier - observerIdentifier:(nonnull NSNumber *)observer +- (void)addObserverForObjectWithIdentifier:(NSInteger)identifier + observerIdentifier:(NSInteger)observer keyPath:(nonnull NSString *)keyPath options: (nonnull NSArray *) @@ -132,16 +132,16 @@ - (void)addObserverForObjectWithIdentifier:(nonnull NSNumber *)identifier context:nil]; } -- (void)removeObserverForObjectWithIdentifier:(nonnull NSNumber *)identifier - observerIdentifier:(nonnull NSNumber *)observer +- (void)removeObserverForObjectWithIdentifier:(NSInteger)identifier + observerIdentifier:(NSInteger)observer keyPath:(nonnull NSString *)keyPath error:(FlutterError *_Nullable *_Nonnull)error { [[self objectForIdentifier:identifier] removeObserver:[self objectForIdentifier:observer] forKeyPath:keyPath]; } -- (void)disposeObjectWithIdentifier:(nonnull NSNumber *)identifier +- (void)disposeObjectWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error { - [self.instanceManager removeInstanceWithIdentifier:identifier.longValue]; + [self.instanceManager removeInstanceWithIdentifier:identifier]; } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.m index 1a10c08eec4a..95078975f4d9 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFPreferencesHostApi.m @@ -19,28 +19,26 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { return self; } -- (WKPreferences *)preferencesForIdentifier:(NSNumber *)identifier { - return (WKPreferences *)[self.instanceManager instanceForIdentifier:identifier.longValue]; +- (WKPreferences *)preferencesForIdentifier:(NSInteger)identifier { + return (WKPreferences *)[self.instanceManager instanceForIdentifier:identifier]; } -- (void)createWithIdentifier:(nonnull NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error { +- (void)createWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error { WKPreferences *preferences = [[WKPreferences alloc] init]; - [self.instanceManager addDartCreatedInstance:preferences withIdentifier:identifier.longValue]; + [self.instanceManager addDartCreatedInstance:preferences withIdentifier:identifier]; } -- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)identifier - configurationIdentifier:(nonnull NSNumber *)configurationIdentifier +- (void)createFromWebViewConfigurationWithIdentifier:(NSInteger)identifier + configurationIdentifier:(NSInteger)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager - instanceForIdentifier:configurationIdentifier.longValue]; - [self.instanceManager addDartCreatedInstance:configuration.preferences - withIdentifier:identifier.longValue]; + instanceForIdentifier:configurationIdentifier]; + [self.instanceManager addDartCreatedInstance:configuration.preferences withIdentifier:identifier]; } -- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(nonnull NSNumber *)identifier - isEnabled:(nonnull NSNumber *)enabled +- (void)setJavaScriptEnabledForPreferencesWithIdentifier:(NSInteger)identifier + isEnabled:(BOOL)enabled error:(FlutterError *_Nullable *_Nonnull)error { - [[self preferencesForIdentifier:identifier] setJavaScriptEnabled:enabled.boolValue]; + [[self preferencesForIdentifier:identifier] setJavaScriptEnabled:enabled]; } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m index f1b83993c4f8..1e27c1208bd0 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScriptMessageHandlerHostApi.m @@ -28,10 +28,10 @@ - (void)didReceiveScriptMessageForHandler:(FWFScriptMessageHandler *)instance userContentController:(WKUserContentController *)userContentController message:(WKScriptMessage *)message completion:(void (^)(FlutterError *_Nullable))completion { - NSNumber *userContentControllerIdentifier = - @([self.instanceManager identifierWithStrongReferenceForInstance:userContentController]); + NSInteger userContentControllerIdentifier = + [self.instanceManager identifierWithStrongReferenceForInstance:userContentController]; FWFWKScriptMessageData *messageData = FWFWKScriptMessageDataFromNativeWKScriptMessage(message); - [self didReceiveScriptMessageForHandlerWithIdentifier:@([self identifierForHandler:instance]) + [self didReceiveScriptMessageForHandlerWithIdentifier:[self identifierForHandler:instance] userContentControllerIdentifier:userContentControllerIdentifier message:messageData completion:completion]; @@ -85,12 +85,10 @@ - (FWFScriptMessageHandler *)scriptMessageHandlerForIdentifier:(NSNumber *)ident instanceForIdentifier:identifier.longValue]; } -- (void)createWithIdentifier:(nonnull NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error { +- (void)createWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error { FWFScriptMessageHandler *scriptMessageHandler = [[FWFScriptMessageHandler alloc] initWithBinaryMessenger:self.binaryMessenger instanceManager:self.instanceManager]; - [self.instanceManager addDartCreatedInstance:scriptMessageHandler - withIdentifier:identifier.longValue]; + [self.instanceManager addDartCreatedInstance:scriptMessageHandler withIdentifier:identifier]; } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m index a32e9565b514..18287d40ea00 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFScrollViewHostApi.m @@ -19,41 +19,37 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { return self; } -- (UIScrollView *)scrollViewForIdentifier:(NSNumber *)identifier { - return (UIScrollView *)[self.instanceManager instanceForIdentifier:identifier.longValue]; +- (UIScrollView *)scrollViewForIdentifier:(NSInteger)identifier { + return (UIScrollView *)[self.instanceManager instanceForIdentifier:identifier]; } -- (void)createFromWebViewWithIdentifier:(nonnull NSNumber *)identifier - webViewIdentifier:(nonnull NSNumber *)webViewIdentifier +- (void)createFromWebViewWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { - WKWebView *webView = - (WKWebView *)[self.instanceManager instanceForIdentifier:webViewIdentifier.longValue]; - [self.instanceManager addDartCreatedInstance:webView.scrollView - withIdentifier:identifier.longValue]; + WKWebView *webView = (WKWebView *)[self.instanceManager instanceForIdentifier:webViewIdentifier]; + [self.instanceManager addDartCreatedInstance:webView.scrollView withIdentifier:identifier]; } - (NSArray *) - contentOffsetForScrollViewWithIdentifier:(nonnull NSNumber *)identifier + contentOffsetForScrollViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error { CGPoint point = [[self scrollViewForIdentifier:identifier] contentOffset]; return @[ @(point.x), @(point.y) ]; } -- (void)scrollByForScrollViewWithIdentifier:(nonnull NSNumber *)identifier - x:(nonnull NSNumber *)x - y:(nonnull NSNumber *)y +- (void)scrollByForScrollViewWithIdentifier:(NSInteger)identifier + x:(double)x + y:(double)y error:(FlutterError *_Nullable *_Nonnull)error { UIScrollView *scrollView = [self scrollViewForIdentifier:identifier]; CGPoint contentOffset = scrollView.contentOffset; - [scrollView setContentOffset:CGPointMake(contentOffset.x + x.doubleValue, - contentOffset.y + y.doubleValue)]; + [scrollView setContentOffset:CGPointMake(contentOffset.x + x, contentOffset.y + y)]; } -- (void)setContentOffsetForScrollViewWithIdentifier:(nonnull NSNumber *)identifier - toX:(nonnull NSNumber *)x - y:(nonnull NSNumber *)y +- (void)setContentOffsetForScrollViewWithIdentifier:(NSInteger)identifier + toX:(double)x + y:(double)y error:(FlutterError *_Nullable *_Nonnull)error { - [[self scrollViewForIdentifier:identifier] - setContentOffset:CGPointMake(x.doubleValue, y.doubleValue)]; + [[self scrollViewForIdentifier:identifier] setContentOffset:CGPointMake(x, y)]; } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m index a7010509ef22..879d85dd9d42 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIDelegateHostApi.m @@ -43,18 +43,18 @@ - (void)onCreateWebViewForDelegate:(FWFUIDelegate *)instance }]; } - NSNumber *configurationIdentifier = - @([self.instanceManager identifierWithStrongReferenceForInstance:configuration]); + NSInteger configurationIdentifier = + [self.instanceManager identifierWithStrongReferenceForInstance:configuration]; FWFWKNavigationActionData *navigationActionData = FWFWKNavigationActionDataFromNativeWKNavigationAction(navigationAction); - [self onCreateWebViewForDelegateWithIdentifier:@([self identifierForDelegate:instance]) - webViewIdentifier: - @([self.instanceManager - identifierWithStrongReferenceForInstance:webView]) - configurationIdentifier:configurationIdentifier - navigationAction:navigationActionData - completion:completion]; + [self + onCreateWebViewForDelegateWithIdentifier:[self identifierForDelegate:instance] + webViewIdentifier:[self.instanceManager + identifierWithStrongReferenceForInstance:webView] + configurationIdentifier:configurationIdentifier + navigationAction:navigationActionData + completion:completion]; } - (void)requestMediaCapturePermissionForDelegateWithIdentifier:(FWFUIDelegate *)instance @@ -66,12 +66,10 @@ - (void)requestMediaCapturePermissionForDelegateWithIdentifier:(FWFUIDelegate *) (void (^)(WKPermissionDecision))completion API_AVAILABLE(ios(15.0)) { [self - requestMediaCapturePermissionForDelegateWithIdentifier:@([self - identifierForDelegate:instance]) + requestMediaCapturePermissionForDelegateWithIdentifier:[self identifierForDelegate:instance] webViewIdentifier: - @([self.instanceManager - identifierWithStrongReferenceForInstance: - webView]) + [self.instanceManager + identifierWithStrongReferenceForInstance:webView] origin: FWFWKSecurityOriginDataFromNativeWKSecurityOrigin( origin) @@ -158,10 +156,9 @@ - (FWFUIDelegate *)delegateForIdentifier:(NSNumber *)identifier { return (FWFUIDelegate *)[self.instanceManager instanceForIdentifier:identifier.longValue]; } -- (void)createWithIdentifier:(nonnull NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error { +- (void)createWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error { FWFUIDelegate *uIDelegate = [[FWFUIDelegate alloc] initWithBinaryMessenger:self.binaryMessenger instanceManager:self.instanceManager]; - [self.instanceManager addDartCreatedInstance:uIDelegate withIdentifier:identifier.longValue]; + [self.instanceManager addDartCreatedInstance:uIDelegate withIdentifier:identifier]; } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m index 1e168d0a8fcb..3ee6f38faa80 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUIViewHostApi.m @@ -18,11 +18,11 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { return self; } -- (UIView *)viewForIdentifier:(NSNumber *)identifier { - return (UIView *)[self.instanceManager instanceForIdentifier:identifier.longValue]; +- (UIView *)viewForIdentifier:(NSInteger)identifier { + return (UIView *)[self.instanceManager instanceForIdentifier:identifier]; } -- (void)setBackgroundColorForViewWithIdentifier:(nonnull NSNumber *)identifier +- (void)setBackgroundColorForViewWithIdentifier:(NSInteger)identifier toValue:(nullable NSNumber *)color error:(FlutterError *_Nullable *_Nonnull)error { if (color == nil) { @@ -36,9 +36,9 @@ - (void)setBackgroundColorForViewWithIdentifier:(nonnull NSNumber *)identifier [[self viewForIdentifier:identifier] setBackgroundColor:colorObject]; } -- (void)setOpaqueForViewWithIdentifier:(nonnull NSNumber *)identifier - isOpaque:(nonnull NSNumber *)opaque +- (void)setOpaqueForViewWithIdentifier:(NSInteger)identifier + isOpaque:(BOOL)opaque error:(FlutterError *_Nullable *_Nonnull)error { - [[self viewForIdentifier:identifier] setOpaque:opaque.boolValue]; + [[self viewForIdentifier:identifier] setOpaque:opaque]; } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLHostApi.m index 9f747c22994b..c3101c7bfaaf 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLHostApi.m @@ -29,7 +29,7 @@ - (instancetype)initWithBinaryMessenger:(id)binaryMessen } - (nullable NSString *) - absoluteStringForNSURLWithIdentifier:(nonnull NSNumber *)identifier + absoluteStringForNSURLWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { NSURL *instance = [self urlForIdentifier:identifier error:error]; if (*error) { @@ -39,14 +39,14 @@ - (instancetype)initWithBinaryMessenger:(id)binaryMessen return instance.absoluteString; } -- (nullable NSURL *)urlForIdentifier:(NSNumber *)identifier +- (nullable NSURL *)urlForIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { - NSURL *instance = (NSURL *)[self.instanceManager instanceForIdentifier:identifier.longValue]; + NSURL *instance = (NSURL *)[self.instanceManager instanceForIdentifier:identifier]; if (!instance) { - NSString *message = - [NSString stringWithFormat:@"InstanceManager does not contain an NSURL with identifier: %@", - identifier]; + NSString *message = [NSString + stringWithFormat:@"InstanceManager does not contain an NSURL with identifier: %li", + (long)identifier]; *error = [FlutterError errorWithCode:NSInternalInconsistencyException message:message details:nil]; @@ -68,7 +68,7 @@ - (instancetype)initWithBinaryMessenger:(id)binaryMessen } - (void)create:(NSURL *)instance completion:(void (^)(FlutterError *_Nullable))completion { - [self.api createWithIdentifier:@([self.instanceManager addHostCreatedInstance:instance]) + [self.api createWithIdentifier:[self.instanceManager addHostCreatedInstance:instance] completion:completion]; } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.m index ac314323da3b..074a54c9a8a9 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFUserContentControllerHostApi.m @@ -20,39 +20,38 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { return self; } -- (WKUserContentController *)userContentControllerForIdentifier:(NSNumber *)identifier { - return (WKUserContentController *)[self.instanceManager - instanceForIdentifier:identifier.longValue]; +- (WKUserContentController *)userContentControllerForIdentifier:(NSInteger)identifier { + return (WKUserContentController *)[self.instanceManager instanceForIdentifier:identifier]; } -- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)identifier - configurationIdentifier:(nonnull NSNumber *)configurationIdentifier +- (void)createFromWebViewConfigurationWithIdentifier:(NSInteger)identifier + configurationIdentifier:(NSInteger)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager - instanceForIdentifier:configurationIdentifier.longValue]; + instanceForIdentifier:configurationIdentifier]; [self.instanceManager addDartCreatedInstance:configuration.userContentController - withIdentifier:identifier.longValue]; + withIdentifier:identifier]; } -- (void)addScriptMessageHandlerForControllerWithIdentifier:(nonnull NSNumber *)identifier - handlerIdentifier:(nonnull NSNumber *)handler +- (void)addScriptMessageHandlerForControllerWithIdentifier:(NSInteger)identifier + handlerIdentifier:(NSInteger)handler ofName:(nonnull NSString *)name error: (FlutterError *_Nullable *_Nonnull)error { [[self userContentControllerForIdentifier:identifier] addScriptMessageHandler:(id)[self.instanceManager - instanceForIdentifier:handler.longValue] + instanceForIdentifier:handler] name:name]; } -- (void)removeScriptMessageHandlerForControllerWithIdentifier:(nonnull NSNumber *)identifier +- (void)removeScriptMessageHandlerForControllerWithIdentifier:(NSInteger)identifier name:(nonnull NSString *)name error:(FlutterError *_Nullable *_Nonnull) error { [[self userContentControllerForIdentifier:identifier] removeScriptMessageHandlerForName:name]; } -- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(nonnull NSNumber *)identifier +- (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(NSInteger)identifier error: (FlutterError *_Nullable *_Nonnull) error { @@ -66,14 +65,14 @@ - (void)removeAllScriptMessageHandlersForControllerWithIdentifier:(nonnull NSNum } } -- (void)addUserScriptForControllerWithIdentifier:(nonnull NSNumber *)identifier +- (void)addUserScriptForControllerWithIdentifier:(NSInteger)identifier userScript:(nonnull FWFWKUserScriptData *)userScript error:(FlutterError *_Nullable *_Nonnull)error { [[self userContentControllerForIdentifier:identifier] addUserScript:FWFNativeWKUserScriptFromScriptData(userScript)]; } -- (void)removeAllUserScriptsForControllerWithIdentifier:(nonnull NSNumber *)identifier +- (void)removeAllUserScriptsForControllerWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error { [[self userContentControllerForIdentifier:identifier] removeAllUserScripts]; } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m index 762c07b5abe6..ee4896c1d2a1 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewConfigurationHostApi.m @@ -24,7 +24,7 @@ - (instancetype)initWithBinaryMessenger:(id)binaryMessen - (void)createWithConfiguration:(WKWebViewConfiguration *)configuration completion:(void (^)(FlutterError *_Nullable))completion { long identifier = [self.instanceManager addHostCreatedInstance:configuration]; - [self createWithIdentifier:@(identifier) completion:completion]; + [self createWithIdentifier:identifier completion:completion]; } @end @@ -72,47 +72,39 @@ - (instancetype)initWithBinaryMessenger:(id)binaryMessen return self; } -- (WKWebViewConfiguration *)webViewConfigurationForIdentifier:(NSNumber *)identifier { - return (WKWebViewConfiguration *)[self.instanceManager - instanceForIdentifier:identifier.longValue]; +- (WKWebViewConfiguration *)webViewConfigurationForIdentifier:(NSInteger)identifier { + return (WKWebViewConfiguration *)[self.instanceManager instanceForIdentifier:identifier]; } -- (void)createWithIdentifier:(nonnull NSNumber *)identifier - error:(FlutterError *_Nullable *_Nonnull)error { +- (void)createWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable *_Nonnull)error { FWFWebViewConfiguration *webViewConfiguration = [[FWFWebViewConfiguration alloc] initWithBinaryMessenger:self.binaryMessenger instanceManager:self.instanceManager]; - [self.instanceManager addDartCreatedInstance:webViewConfiguration - withIdentifier:identifier.longValue]; + [self.instanceManager addDartCreatedInstance:webViewConfiguration withIdentifier:identifier]; } -- (void)createFromWebViewWithIdentifier:(nonnull NSNumber *)identifier - webViewIdentifier:(nonnull NSNumber *)webViewIdentifier +- (void)createFromWebViewWithIdentifier:(NSInteger)identifier + webViewIdentifier:(NSInteger)webViewIdentifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { - WKWebView *webView = - (WKWebView *)[self.instanceManager instanceForIdentifier:webViewIdentifier.longValue]; - [self.instanceManager addDartCreatedInstance:webView.configuration - withIdentifier:identifier.longValue]; + WKWebView *webView = (WKWebView *)[self.instanceManager instanceForIdentifier:webViewIdentifier]; + [self.instanceManager addDartCreatedInstance:webView.configuration withIdentifier:identifier]; } -- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(nonnull NSNumber *)identifier - isAllowed:(nonnull NSNumber *)allow +- (void)setAllowsInlineMediaPlaybackForConfigurationWithIdentifier:(NSInteger)identifier + isAllowed:(BOOL)allow error: (FlutterError *_Nullable *_Nonnull) error { - [[self webViewConfigurationForIdentifier:identifier] - setAllowsInlineMediaPlayback:allow.boolValue]; + [[self webViewConfigurationForIdentifier:identifier] setAllowsInlineMediaPlayback:allow]; } -- (void)setLimitsNavigationsToAppBoundDomainsForConfigurationWithIdentifier: - (nonnull NSNumber *)identifier - isLimited: - (nonnull NSNumber *)limit +- (void)setLimitsNavigationsToAppBoundDomainsForConfigurationWithIdentifier:(NSInteger)identifier + isLimited:(BOOL)limit error:(FlutterError *_Nullable *_Nonnull)error { if (@available(iOS 14, *)) { [[self webViewConfigurationForIdentifier:identifier] - setLimitsNavigationsToAppBoundDomains:limit.boolValue]; + setLimitsNavigationsToAppBoundDomains:limit]; } else { *error = [FlutterError errorWithCode:@"FWFUnsupportedVersionError" @@ -122,7 +114,7 @@ - (void)setLimitsNavigationsToAppBoundDomainsForConfigurationWithIdentifier: } - (void) - setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(nonnull NSNumber *)identifier + setMediaTypesRequiresUserActionForConfigurationWithIdentifier:(NSInteger)identifier forTypes: (nonnull NSArray< FWFWKAudiovisualMediaTypeEnumData diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m index eb30b773d1f2..7c2f3ede932d 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebViewHostApi.m @@ -95,8 +95,8 @@ - (instancetype)initWithBinaryMessenger:(id)binaryMessen return self; } -- (FWFWebView *)webViewForIdentifier:(NSNumber *)identifier { - return (FWFWebView *)[self.instanceManager instanceForIdentifier:identifier.longValue]; +- (FWFWebView *)webViewForIdentifier:(NSInteger)identifier { + return (FWFWebView *)[self.instanceManager instanceForIdentifier:identifier]; } + (nonnull FlutterError *)errorForURLString:(nonnull NSString *)string { @@ -108,19 +108,19 @@ + (nonnull FlutterError *)errorForURLString:(nonnull NSString *)string { details:errorDetails]; } -- (void)createWithIdentifier:(nonnull NSNumber *)identifier - configurationIdentifier:(nonnull NSNumber *)configurationIdentifier +- (void)createWithIdentifier:(NSInteger)identifier + configurationIdentifier:(NSInteger)configurationIdentifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager - instanceForIdentifier:configurationIdentifier.longValue]; + instanceForIdentifier:configurationIdentifier]; FWFWebView *webView = [[FWFWebView alloc] initWithFrame:CGRectMake(0, 0, 0, 0) configuration:configuration binaryMessenger:self.binaryMessenger instanceManager:self.instanceManager]; - [self.instanceManager addDartCreatedInstance:webView withIdentifier:identifier.longValue]; + [self.instanceManager addDartCreatedInstance:webView withIdentifier:identifier]; } -- (void)loadRequestForWebViewWithIdentifier:(nonnull NSNumber *)identifier +- (void)loadRequestForWebViewWithIdentifier:(NSInteger)identifier request:(nonnull FWFNSUrlRequestData *)request error: (FlutterError *_Nullable __autoreleasing *_Nonnull)error { @@ -134,7 +134,7 @@ - (void)loadRequestForWebViewWithIdentifier:(nonnull NSNumber *)identifier [[self webViewForIdentifier:identifier] loadRequest:urlRequest]; } -- (void)setCustomUserAgentForWebViewWithIdentifier:(nonnull NSNumber *)identifier +- (void)setCustomUserAgentForWebViewWithIdentifier:(NSInteger)identifier userAgent:(nullable NSString *)userAgent error: (FlutterError *_Nullable __autoreleasing *_Nonnull) @@ -143,31 +143,31 @@ - (void)setCustomUserAgentForWebViewWithIdentifier:(nonnull NSNumber *)identifie } - (nullable NSNumber *) - canGoBackForWebViewWithIdentifier:(nonnull NSNumber *)identifier + canGoBackForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { return @([self webViewForIdentifier:identifier].canGoBack); } - (nullable NSString *) - URLForWebViewWithIdentifier:(nonnull NSNumber *)identifier + URLForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { return [self webViewForIdentifier:identifier].URL.absoluteString; } - (nullable NSNumber *) - canGoForwardForWebViewWithIdentifier:(nonnull NSNumber *)identifier + canGoForwardForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { return @([[self webViewForIdentifier:identifier] canGoForward]); } - (nullable NSNumber *) - estimatedProgressForWebViewWithIdentifier:(nonnull NSNumber *)identifier + estimatedProgressForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull) error { return @([[self webViewForIdentifier:identifier] estimatedProgress]); } -- (void)evaluateJavaScriptForWebViewWithIdentifier:(nonnull NSNumber *)identifier +- (void)evaluateJavaScriptForWebViewWithIdentifier:(NSInteger)identifier javaScriptString:(nonnull NSString *)javaScriptString completion: (nonnull void (^)(id _Nullable, @@ -198,12 +198,12 @@ - (void)evaluateJavaScriptForWebViewWithIdentifier:(nonnull NSNumber *)identifie }]; } -- (void)setInspectableForWebViewWithIdentifier:(NSNumber *)identifier - inspectable:(NSNumber *)inspectable +- (void)setInspectableForWebViewWithIdentifier:(NSInteger)identifier + inspectable:(BOOL)inspectable error:(FlutterError *_Nullable *_Nonnull)error { if (@available(macOS 13.3, iOS 16.4, tvOS 16.4, *)) { #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130300 || __IPHONE_OS_VERSION_MAX_ALLOWED >= 160400 - [[self webViewForIdentifier:identifier] setInspectable:inspectable.boolValue]; + [[self webViewForIdentifier:identifier] setInspectable:inspectable]; #endif } else { *error = [FlutterError errorWithCode:@"FWFUnsupportedVersionError" @@ -212,17 +212,17 @@ - (void)setInspectableForWebViewWithIdentifier:(NSNumber *)identifier } } -- (void)goBackForWebViewWithIdentifier:(nonnull NSNumber *)identifier +- (void)goBackForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { [[self webViewForIdentifier:identifier] goBack]; } -- (void)goForwardForWebViewWithIdentifier:(nonnull NSNumber *)identifier +- (void)goForwardForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { [[self webViewForIdentifier:identifier] goForward]; } -- (void)loadAssetForWebViewWithIdentifier:(nonnull NSNumber *)identifier +- (void)loadAssetForWebViewWithIdentifier:(NSInteger)identifier assetKey:(nonnull NSString *)key error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { NSString *assetFilePath = [self.assetManager lookupKeyForAsset:key]; @@ -237,7 +237,7 @@ - (void)loadAssetForWebViewWithIdentifier:(nonnull NSNumber *)identifier } } -- (void)loadFileForWebViewWithIdentifier:(nonnull NSNumber *)identifier +- (void)loadFileForWebViewWithIdentifier:(NSInteger)identifier fileURL:(nonnull NSString *)url readAccessURL:(nonnull NSString *)readAccessUrl error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { @@ -254,7 +254,7 @@ - (void)loadFileForWebViewWithIdentifier:(nonnull NSNumber *)identifier } } -- (void)loadHTMLForWebViewWithIdentifier:(nonnull NSNumber *)identifier +- (void)loadHTMLForWebViewWithIdentifier:(NSInteger)identifier HTMLString:(nonnull NSString *)string baseURL:(nullable NSString *)baseUrl error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { @@ -262,21 +262,21 @@ - (void)loadHTMLForWebViewWithIdentifier:(nonnull NSNumber *)identifier baseURL:[NSURL URLWithString:baseUrl]]; } -- (void)reloadWebViewWithIdentifier:(nonnull NSNumber *)identifier +- (void)reloadWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { [[self webViewForIdentifier:identifier] reload]; } - (void) - setAllowsBackForwardForWebViewWithIdentifier:(nonnull NSNumber *)identifier - isAllowed:(nonnull NSNumber *)allow + setAllowsBackForwardForWebViewWithIdentifier:(NSInteger)identifier + isAllowed:(BOOL)allow error:(FlutterError *_Nullable __autoreleasing *_Nonnull) error { - [[self webViewForIdentifier:identifier] setAllowsBackForwardNavigationGestures:allow.boolValue]; + [[self webViewForIdentifier:identifier] setAllowsBackForwardNavigationGestures:allow]; } - (void) - setNavigationDelegateForWebViewWithIdentifier:(nonnull NSNumber *)identifier + setNavigationDelegateForWebViewWithIdentifier:(NSInteger)identifier delegateIdentifier:(nullable NSNumber *)navigationDelegateIdentifier error: (FlutterError *_Nullable __autoreleasing *_Nonnull) @@ -286,7 +286,7 @@ - (void)reloadWebViewWithIdentifier:(nonnull NSNumber *)identifier [[self webViewForIdentifier:identifier] setNavigationDelegate:navigationDelegate]; } -- (void)setUIDelegateForWebViewWithIdentifier:(nonnull NSNumber *)identifier +- (void)setUIDelegateForWebViewWithIdentifier:(NSInteger)identifier delegateIdentifier:(nullable NSNumber *)uiDelegateIdentifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull) error { @@ -296,13 +296,13 @@ - (void)setUIDelegateForWebViewWithIdentifier:(nonnull NSNumber *)identifier } - (nullable NSString *) - titleForWebViewWithIdentifier:(nonnull NSNumber *)identifier + titleForWebViewWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { return [[self webViewForIdentifier:identifier] title]; } - (nullable NSString *) - customUserAgentForWebViewWithIdentifier:(nonnull NSNumber *)identifier + customUserAgentForWebViewWithIdentifier:(NSInteger)identifier error: (FlutterError *_Nullable __autoreleasing *_Nonnull)error { return [[self webViewForIdentifier:identifier] customUserAgent]; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m index 51c7784931bb..f7252240957d 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m +++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFWebsiteDataStoreHostApi.m @@ -20,49 +20,47 @@ - (instancetype)initWithInstanceManager:(FWFInstanceManager *)instanceManager { return self; } -- (WKWebsiteDataStore *)websiteDataStoreForIdentifier:(NSNumber *)identifier { - return (WKWebsiteDataStore *)[self.instanceManager instanceForIdentifier:identifier.longValue]; +- (WKWebsiteDataStore *)websiteDataStoreForIdentifier:(NSInteger)identifier { + return (WKWebsiteDataStore *)[self.instanceManager instanceForIdentifier:identifier]; } -- (void)createFromWebViewConfigurationWithIdentifier:(nonnull NSNumber *)identifier - configurationIdentifier:(nonnull NSNumber *)configurationIdentifier +- (void)createFromWebViewConfigurationWithIdentifier:(NSInteger)identifier + configurationIdentifier:(NSInteger)configurationIdentifier error:(FlutterError *_Nullable *_Nonnull)error { WKWebViewConfiguration *configuration = (WKWebViewConfiguration *)[self.instanceManager - instanceForIdentifier:configurationIdentifier.longValue]; + instanceForIdentifier:configurationIdentifier]; [self.instanceManager addDartCreatedInstance:configuration.websiteDataStore - withIdentifier:identifier.longValue]; + withIdentifier:identifier]; } -- (void)createDefaultDataStoreWithIdentifier:(nonnull NSNumber *)identifier +- (void)createDefaultDataStoreWithIdentifier:(NSInteger)identifier error:(FlutterError *_Nullable __autoreleasing *_Nonnull) error { [self.instanceManager addDartCreatedInstance:[WKWebsiteDataStore defaultDataStore] - withIdentifier:identifier.longValue]; + withIdentifier:identifier]; } -- (void) - removeDataFromDataStoreWithIdentifier:(nonnull NSNumber *)identifier - ofTypes: - (nonnull NSArray *)dataTypes - modifiedSince:(nonnull NSNumber *)modificationTimeInSecondsSinceEpoch - completion:(nonnull void (^)(NSNumber *_Nullable, - FlutterError *_Nullable))completion { +- (void)removeDataFromDataStoreWithIdentifier:(NSInteger)identifier + ofTypes:(nonnull NSArray *) + dataTypes + modifiedSince:(double)modificationTimeInSecondsSinceEpoch + completion: + (nonnull void (^)(NSNumber *_Nullable, + FlutterError *_Nullable))completion { NSMutableSet *stringDataTypes = [NSMutableSet set]; for (FWFWKWebsiteDataTypeEnumData *type in dataTypes) { [stringDataTypes addObject:FWFNativeWKWebsiteDataTypeFromEnumData(type)]; } WKWebsiteDataStore *dataStore = [self websiteDataStoreForIdentifier:identifier]; - [dataStore - fetchDataRecordsOfTypes:stringDataTypes - completionHandler:^(NSArray *records) { - [dataStore - removeDataOfTypes:stringDataTypes - modifiedSince:[NSDate dateWithTimeIntervalSince1970: - modificationTimeInSecondsSinceEpoch.doubleValue] - completionHandler:^{ - completion([NSNumber numberWithBool:(records.count > 0)], nil); - }]; - }]; + [dataStore fetchDataRecordsOfTypes:stringDataTypes + completionHandler:^(NSArray *records) { + [dataStore removeDataOfTypes:stringDataTypes + modifiedSince:[NSDate dateWithTimeIntervalSince1970: + modificationTimeInSecondsSinceEpoch] + completionHandler:^{ + completion([NSNumber numberWithBool:(records.count > 0)], nil); + }]; + }]; } @end diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.g.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.g.dart index b0eaadeb739f..ff08766ba90f 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.g.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.g.dart @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v10.1.4), do not edit directly. +// Autogenerated from Pigeon (v13.0.0), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import @@ -11,6 +11,17 @@ import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; +List wrapResponse( + {Object? result, PlatformException? error, bool empty = false}) { + if (empty) { + return []; + } + if (error == null) { + return [result]; + } + return [error.code, error.message, error.details]; +} + /// Mirror of NSKeyValueObservingOptions. /// /// See https://developer.apple.com/documentation/foundation/nskeyvalueobservingoptions?language=objc. @@ -1149,8 +1160,15 @@ abstract class WKWebViewConfigurationFlutterApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationFlutterApi.create was null, expected non-null int.'); - api.create(arg_identifier!); - return; + try { + api.create(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1501,9 +1519,16 @@ abstract class WKScriptMessageHandlerFlutterApi { (args[2] as WKScriptMessageData?); assert(arg_message != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessageHandlerFlutterApi.didReceiveScriptMessage was null, expected non-null WKScriptMessageData.'); - api.didReceiveScriptMessage(arg_identifier!, - arg_userContentControllerIdentifier!, arg_message!); - return; + try { + api.didReceiveScriptMessage(arg_identifier!, + arg_userContentControllerIdentifier!, arg_message!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1637,9 +1662,16 @@ abstract class WKNavigationDelegateFlutterApi { assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegateFlutterApi.didFinishNavigation was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - api.didFinishNavigation( - arg_identifier!, arg_webViewIdentifier!, arg_url); - return; + try { + api.didFinishNavigation( + arg_identifier!, arg_webViewIdentifier!, arg_url); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1662,9 +1694,16 @@ abstract class WKNavigationDelegateFlutterApi { assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegateFlutterApi.didStartProvisionalNavigation was null, expected non-null int.'); final String? arg_url = (args[2] as String?); - api.didStartProvisionalNavigation( - arg_identifier!, arg_webViewIdentifier!, arg_url); - return; + try { + api.didStartProvisionalNavigation( + arg_identifier!, arg_webViewIdentifier!, arg_url); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1690,10 +1729,17 @@ abstract class WKNavigationDelegateFlutterApi { (args[2] as WKNavigationActionData?); assert(arg_navigationAction != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegateFlutterApi.decidePolicyForNavigationAction was null, expected non-null WKNavigationActionData.'); - final WKNavigationActionPolicyEnumData output = - await api.decidePolicyForNavigationAction(arg_identifier!, - arg_webViewIdentifier!, arg_navigationAction!); - return output; + try { + final WKNavigationActionPolicyEnumData output = + await api.decidePolicyForNavigationAction(arg_identifier!, + arg_webViewIdentifier!, arg_navigationAction!); + return wrapResponse(result: output); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1718,9 +1764,16 @@ abstract class WKNavigationDelegateFlutterApi { final NSErrorData? arg_error = (args[2] as NSErrorData?); assert(arg_error != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegateFlutterApi.didFailNavigation was null, expected non-null NSErrorData.'); - api.didFailNavigation( - arg_identifier!, arg_webViewIdentifier!, arg_error!); - return; + try { + api.didFailNavigation( + arg_identifier!, arg_webViewIdentifier!, arg_error!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1745,9 +1798,16 @@ abstract class WKNavigationDelegateFlutterApi { final NSErrorData? arg_error = (args[2] as NSErrorData?); assert(arg_error != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegateFlutterApi.didFailProvisionalNavigation was null, expected non-null NSErrorData.'); - api.didFailProvisionalNavigation( - arg_identifier!, arg_webViewIdentifier!, arg_error!); - return; + try { + api.didFailProvisionalNavigation( + arg_identifier!, arg_webViewIdentifier!, arg_error!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1769,9 +1829,16 @@ abstract class WKNavigationDelegateFlutterApi { final int? arg_webViewIdentifier = (args[1] as int?); assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegateFlutterApi.webViewWebContentProcessDidTerminate was null, expected non-null int.'); - api.webViewWebContentProcessDidTerminate( - arg_identifier!, arg_webViewIdentifier!); - return; + try { + api.webViewWebContentProcessDidTerminate( + arg_identifier!, arg_webViewIdentifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1968,9 +2035,16 @@ abstract class NSObjectFlutterApi { (args[4] as List?)?.cast(); assert(arg_changeValues != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSObjectFlutterApi.observeValue was null, expected non-null List.'); - api.observeValue(arg_identifier!, arg_keyPath!, arg_objectIdentifier!, - arg_changeKeys!, arg_changeValues!); - return; + try { + api.observeValue(arg_identifier!, arg_keyPath!, + arg_objectIdentifier!, arg_changeKeys!, arg_changeValues!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1989,8 +2063,15 @@ abstract class NSObjectFlutterApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSObjectFlutterApi.dispose was null, expected non-null int.'); - api.dispose(arg_identifier!); - return; + try { + api.dispose(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -2738,9 +2819,16 @@ abstract class WKUIDelegateFlutterApi { (args[3] as WKNavigationActionData?); assert(arg_navigationAction != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi.onCreateWebView was null, expected non-null WKNavigationActionData.'); - api.onCreateWebView(arg_identifier!, arg_webViewIdentifier!, - arg_configurationIdentifier!, arg_navigationAction!); - return; + try { + api.onCreateWebView(arg_identifier!, arg_webViewIdentifier!, + arg_configurationIdentifier!, arg_navigationAction!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -2773,10 +2861,17 @@ abstract class WKUIDelegateFlutterApi { (args[4] as WKMediaCaptureTypeData?); assert(arg_type != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateFlutterApi.requestMediaCapturePermission was null, expected non-null WKMediaCaptureTypeData.'); - final WKPermissionDecisionData output = - await api.requestMediaCapturePermission(arg_identifier!, - arg_webViewIdentifier!, arg_origin!, arg_frame!, arg_type!); - return output; + try { + final WKPermissionDecisionData output = + await api.requestMediaCapturePermission(arg_identifier!, + arg_webViewIdentifier!, arg_origin!, arg_frame!, arg_type!); + return wrapResponse(result: output); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -2943,8 +3038,15 @@ abstract class NSUrlFlutterApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlFlutterApi.create was null, expected non-null int.'); - api.create(arg_identifier!); - return; + try { + api.create(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml index 4918777a2b9b..035fecbf2cfa 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml @@ -2,7 +2,7 @@ name: webview_flutter_wkwebview description: A Flutter plugin that provides a WebView widget based on Apple's WKWebView control. repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_wkwebview issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22 -version: 3.9.3 +version: 3.9.4 environment: sdk: ">=2.19.0 <4.0.0" @@ -27,7 +27,7 @@ dev_dependencies: flutter_test: sdk: flutter mockito: 5.4.1 - pigeon: ^10.1.4 + pigeon: ^13.0.0 topics: - html diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.g.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.g.dart index 03e5b6cbca5e..1541f02adca7 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.g.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.g.dart @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v10.1.4), do not edit directly. +// Autogenerated from Pigeon (v13.0.0), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, unnecessary_import // ignore_for_file: avoid_relative_lib_imports @@ -78,9 +78,16 @@ abstract class TestWKWebsiteDataStoreHostApi { final int? arg_configurationIdentifier = (args[1] as int?); assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStoreHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration( - arg_identifier!, arg_configurationIdentifier!); - return []; + try { + api.createFromWebViewConfiguration( + arg_identifier!, arg_configurationIdentifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -102,8 +109,15 @@ abstract class TestWKWebsiteDataStoreHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStoreHostApi.createDefaultDataStore was null, expected non-null int.'); - api.createDefaultDataStore(arg_identifier!); - return []; + try { + api.createDefaultDataStore(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -133,9 +147,16 @@ abstract class TestWKWebsiteDataStoreHostApi { (args[2] as double?); assert(arg_modificationTimeInSecondsSinceEpoch != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStoreHostApi.removeDataOfTypes was null, expected non-null double.'); - final bool output = await api.removeDataOfTypes(arg_identifier!, - arg_dataTypes!, arg_modificationTimeInSecondsSinceEpoch!); - return [output]; + try { + final bool output = await api.removeDataOfTypes(arg_identifier!, + arg_dataTypes!, arg_modificationTimeInSecondsSinceEpoch!); + return [output]; + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -175,8 +196,15 @@ abstract class TestUIViewHostApi { assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.UIViewHostApi.setBackgroundColor was null, expected non-null int.'); final int? arg_value = (args[1] as int?); - api.setBackgroundColor(arg_identifier!, arg_value); - return []; + try { + api.setBackgroundColor(arg_identifier!, arg_value); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -201,8 +229,15 @@ abstract class TestUIViewHostApi { final bool? arg_opaque = (args[1] as bool?); assert(arg_opaque != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.UIViewHostApi.setOpaque was null, expected non-null bool.'); - api.setOpaque(arg_identifier!, arg_opaque!); - return []; + try { + api.setOpaque(arg_identifier!, arg_opaque!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -248,8 +283,15 @@ abstract class TestUIScrollViewHostApi { final int? arg_webViewIdentifier = (args[1] as int?); assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewHostApi.createFromWebView was null, expected non-null int.'); - api.createFromWebView(arg_identifier!, arg_webViewIdentifier!); - return []; + try { + api.createFromWebView(arg_identifier!, arg_webViewIdentifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -271,8 +313,15 @@ abstract class TestUIScrollViewHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewHostApi.getContentOffset was null, expected non-null int.'); - final List output = api.getContentOffset(arg_identifier!); - return [output]; + try { + final List output = api.getContentOffset(arg_identifier!); + return [output]; + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -300,8 +349,15 @@ abstract class TestUIScrollViewHostApi { final double? arg_y = (args[2] as double?); assert(arg_y != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewHostApi.scrollBy was null, expected non-null double.'); - api.scrollBy(arg_identifier!, arg_x!, arg_y!); - return []; + try { + api.scrollBy(arg_identifier!, arg_x!, arg_y!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -329,8 +385,15 @@ abstract class TestUIScrollViewHostApi { final double? arg_y = (args[2] as double?); assert(arg_y != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewHostApi.setContentOffset was null, expected non-null double.'); - api.setContentOffset(arg_identifier!, arg_x!, arg_y!); - return []; + try { + api.setContentOffset(arg_identifier!, arg_x!, arg_y!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -400,8 +463,15 @@ abstract class TestWKWebViewConfigurationHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationHostApi.create was null, expected non-null int.'); - api.create(arg_identifier!); - return []; + try { + api.create(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -426,8 +496,15 @@ abstract class TestWKWebViewConfigurationHostApi { final int? arg_webViewIdentifier = (args[1] as int?); assert(arg_webViewIdentifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationHostApi.createFromWebView was null, expected non-null int.'); - api.createFromWebView(arg_identifier!, arg_webViewIdentifier!); - return []; + try { + api.createFromWebView(arg_identifier!, arg_webViewIdentifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -452,8 +529,15 @@ abstract class TestWKWebViewConfigurationHostApi { final bool? arg_allow = (args[1] as bool?); assert(arg_allow != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationHostApi.setAllowsInlineMediaPlayback was null, expected non-null bool.'); - api.setAllowsInlineMediaPlayback(arg_identifier!, arg_allow!); - return []; + try { + api.setAllowsInlineMediaPlayback(arg_identifier!, arg_allow!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -478,9 +562,16 @@ abstract class TestWKWebViewConfigurationHostApi { final bool? arg_limit = (args[1] as bool?); assert(arg_limit != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationHostApi.setLimitsNavigationsToAppBoundDomains was null, expected non-null bool.'); - api.setLimitsNavigationsToAppBoundDomains( - arg_identifier!, arg_limit!); - return []; + try { + api.setLimitsNavigationsToAppBoundDomains( + arg_identifier!, arg_limit!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -507,9 +598,16 @@ abstract class TestWKWebViewConfigurationHostApi { ?.cast(); assert(arg_types != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfigurationHostApi.setMediaTypesRequiringUserActionForPlayback was null, expected non-null List.'); - api.setMediaTypesRequiringUserActionForPlayback( - arg_identifier!, arg_types!); - return []; + try { + api.setMediaTypesRequiringUserActionForPlayback( + arg_identifier!, arg_types!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -590,9 +688,16 @@ abstract class TestWKUserContentControllerHostApi { final int? arg_configurationIdentifier = (args[1] as int?); assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration( - arg_identifier!, arg_configurationIdentifier!); - return []; + try { + api.createFromWebViewConfiguration( + arg_identifier!, arg_configurationIdentifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -620,9 +725,16 @@ abstract class TestWKUserContentControllerHostApi { final String? arg_name = (args[2] as String?); assert(arg_name != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.addScriptMessageHandler was null, expected non-null String.'); - api.addScriptMessageHandler( - arg_identifier!, arg_handlerIdentifier!, arg_name!); - return []; + try { + api.addScriptMessageHandler( + arg_identifier!, arg_handlerIdentifier!, arg_name!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -647,8 +759,15 @@ abstract class TestWKUserContentControllerHostApi { final String? arg_name = (args[1] as String?); assert(arg_name != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.removeScriptMessageHandler was null, expected non-null String.'); - api.removeScriptMessageHandler(arg_identifier!, arg_name!); - return []; + try { + api.removeScriptMessageHandler(arg_identifier!, arg_name!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -670,8 +789,15 @@ abstract class TestWKUserContentControllerHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.removeAllScriptMessageHandlers was null, expected non-null int.'); - api.removeAllScriptMessageHandlers(arg_identifier!); - return []; + try { + api.removeAllScriptMessageHandlers(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -697,8 +823,15 @@ abstract class TestWKUserContentControllerHostApi { (args[1] as WKUserScriptData?); assert(arg_userScript != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.addUserScript was null, expected non-null WKUserScriptData.'); - api.addUserScript(arg_identifier!, arg_userScript!); - return []; + try { + api.addUserScript(arg_identifier!, arg_userScript!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -720,8 +853,15 @@ abstract class TestWKUserContentControllerHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentControllerHostApi.removeAllUserScripts was null, expected non-null int.'); - api.removeAllUserScripts(arg_identifier!); - return []; + try { + api.removeAllUserScripts(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -764,9 +904,16 @@ abstract class TestWKPreferencesHostApi { final int? arg_configurationIdentifier = (args[1] as int?); assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKPreferencesHostApi.createFromWebViewConfiguration was null, expected non-null int.'); - api.createFromWebViewConfiguration( - arg_identifier!, arg_configurationIdentifier!); - return []; + try { + api.createFromWebViewConfiguration( + arg_identifier!, arg_configurationIdentifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -791,8 +938,15 @@ abstract class TestWKPreferencesHostApi { final bool? arg_enabled = (args[1] as bool?); assert(arg_enabled != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKPreferencesHostApi.setJavaScriptEnabled was null, expected non-null bool.'); - api.setJavaScriptEnabled(arg_identifier!, arg_enabled!); - return []; + try { + api.setJavaScriptEnabled(arg_identifier!, arg_enabled!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -829,8 +983,15 @@ abstract class TestWKScriptMessageHandlerHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessageHandlerHostApi.create was null, expected non-null int.'); - api.create(arg_identifier!); - return []; + try { + api.create(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -867,8 +1028,15 @@ abstract class TestWKNavigationDelegateHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegateHostApi.create was null, expected non-null int.'); - api.create(arg_identifier!); - return []; + try { + api.create(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -933,8 +1101,15 @@ abstract class TestNSObjectHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSObjectHostApi.dispose was null, expected non-null int.'); - api.dispose(arg_identifier!); - return []; + try { + api.dispose(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -967,9 +1142,16 @@ abstract class TestNSObjectHostApi { ?.cast(); assert(arg_options != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSObjectHostApi.addObserver was null, expected non-null List.'); - api.addObserver(arg_identifier!, arg_observerIdentifier!, - arg_keyPath!, arg_options!); - return []; + try { + api.addObserver(arg_identifier!, arg_observerIdentifier!, + arg_keyPath!, arg_options!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -997,9 +1179,16 @@ abstract class TestNSObjectHostApi { final String? arg_keyPath = (args[2] as String?); assert(arg_keyPath != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSObjectHostApi.removeObserver was null, expected non-null String.'); - api.removeObserver( - arg_identifier!, arg_observerIdentifier!, arg_keyPath!); - return []; + try { + api.removeObserver( + arg_identifier!, arg_observerIdentifier!, arg_keyPath!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1185,8 +1374,15 @@ abstract class TestWKWebViewHostApi { final int? arg_configurationIdentifier = (args[1] as int?); assert(arg_configurationIdentifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.create was null, expected non-null int.'); - api.create(arg_identifier!, arg_configurationIdentifier!); - return []; + try { + api.create(arg_identifier!, arg_configurationIdentifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1209,8 +1405,15 @@ abstract class TestWKWebViewHostApi { assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.setUIDelegate was null, expected non-null int.'); final int? arg_uiDelegateIdentifier = (args[1] as int?); - api.setUIDelegate(arg_identifier!, arg_uiDelegateIdentifier); - return []; + try { + api.setUIDelegate(arg_identifier!, arg_uiDelegateIdentifier); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1233,9 +1436,16 @@ abstract class TestWKWebViewHostApi { assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.setNavigationDelegate was null, expected non-null int.'); final int? arg_navigationDelegateIdentifier = (args[1] as int?); - api.setNavigationDelegate( - arg_identifier!, arg_navigationDelegateIdentifier); - return []; + try { + api.setNavigationDelegate( + arg_identifier!, arg_navigationDelegateIdentifier); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1257,8 +1467,15 @@ abstract class TestWKWebViewHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.getUrl was null, expected non-null int.'); - final String? output = api.getUrl(arg_identifier!); - return [output]; + try { + final String? output = api.getUrl(arg_identifier!); + return [output]; + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1280,8 +1497,15 @@ abstract class TestWKWebViewHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.getEstimatedProgress was null, expected non-null int.'); - final double output = api.getEstimatedProgress(arg_identifier!); - return [output]; + try { + final double output = api.getEstimatedProgress(arg_identifier!); + return [output]; + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1306,8 +1530,15 @@ abstract class TestWKWebViewHostApi { final NSUrlRequestData? arg_request = (args[1] as NSUrlRequestData?); assert(arg_request != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.loadRequest was null, expected non-null NSUrlRequestData.'); - api.loadRequest(arg_identifier!, arg_request!); - return []; + try { + api.loadRequest(arg_identifier!, arg_request!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1333,8 +1564,15 @@ abstract class TestWKWebViewHostApi { assert(arg_string != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.loadHtmlString was null, expected non-null String.'); final String? arg_baseUrl = (args[2] as String?); - api.loadHtmlString(arg_identifier!, arg_string!, arg_baseUrl); - return []; + try { + api.loadHtmlString(arg_identifier!, arg_string!, arg_baseUrl); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1362,8 +1600,15 @@ abstract class TestWKWebViewHostApi { final String? arg_readAccessUrl = (args[2] as String?); assert(arg_readAccessUrl != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.loadFileUrl was null, expected non-null String.'); - api.loadFileUrl(arg_identifier!, arg_url!, arg_readAccessUrl!); - return []; + try { + api.loadFileUrl(arg_identifier!, arg_url!, arg_readAccessUrl!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1388,8 +1633,15 @@ abstract class TestWKWebViewHostApi { final String? arg_key = (args[1] as String?); assert(arg_key != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.loadFlutterAsset was null, expected non-null String.'); - api.loadFlutterAsset(arg_identifier!, arg_key!); - return []; + try { + api.loadFlutterAsset(arg_identifier!, arg_key!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1411,8 +1663,15 @@ abstract class TestWKWebViewHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.canGoBack was null, expected non-null int.'); - final bool output = api.canGoBack(arg_identifier!); - return [output]; + try { + final bool output = api.canGoBack(arg_identifier!); + return [output]; + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1434,8 +1693,15 @@ abstract class TestWKWebViewHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.canGoForward was null, expected non-null int.'); - final bool output = api.canGoForward(arg_identifier!); - return [output]; + try { + final bool output = api.canGoForward(arg_identifier!); + return [output]; + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1457,8 +1723,15 @@ abstract class TestWKWebViewHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.goBack was null, expected non-null int.'); - api.goBack(arg_identifier!); - return []; + try { + api.goBack(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1480,8 +1753,15 @@ abstract class TestWKWebViewHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.goForward was null, expected non-null int.'); - api.goForward(arg_identifier!); - return []; + try { + api.goForward(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1503,8 +1783,15 @@ abstract class TestWKWebViewHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.reload was null, expected non-null int.'); - api.reload(arg_identifier!); - return []; + try { + api.reload(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1526,8 +1813,15 @@ abstract class TestWKWebViewHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.getTitle was null, expected non-null int.'); - final String? output = api.getTitle(arg_identifier!); - return [output]; + try { + final String? output = api.getTitle(arg_identifier!); + return [output]; + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1552,9 +1846,16 @@ abstract class TestWKWebViewHostApi { final bool? arg_allow = (args[1] as bool?); assert(arg_allow != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.setAllowsBackForwardNavigationGestures was null, expected non-null bool.'); - api.setAllowsBackForwardNavigationGestures( - arg_identifier!, arg_allow!); - return []; + try { + api.setAllowsBackForwardNavigationGestures( + arg_identifier!, arg_allow!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1577,8 +1878,15 @@ abstract class TestWKWebViewHostApi { assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.setCustomUserAgent was null, expected non-null int.'); final String? arg_userAgent = (args[1] as String?); - api.setCustomUserAgent(arg_identifier!, arg_userAgent); - return []; + try { + api.setCustomUserAgent(arg_identifier!, arg_userAgent); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1603,9 +1911,16 @@ abstract class TestWKWebViewHostApi { final String? arg_javaScriptString = (args[1] as String?); assert(arg_javaScriptString != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.evaluateJavaScript was null, expected non-null String.'); - final Object? output = await api.evaluateJavaScript( - arg_identifier!, arg_javaScriptString!); - return [output]; + try { + final Object? output = await api.evaluateJavaScript( + arg_identifier!, arg_javaScriptString!); + return [output]; + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1630,8 +1945,15 @@ abstract class TestWKWebViewHostApi { final bool? arg_inspectable = (args[1] as bool?); assert(arg_inspectable != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.setInspectable was null, expected non-null bool.'); - api.setInspectable(arg_identifier!, arg_inspectable!); - return []; + try { + api.setInspectable(arg_identifier!, arg_inspectable!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1653,8 +1975,15 @@ abstract class TestWKWebViewHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewHostApi.getCustomUserAgent was null, expected non-null int.'); - final String? output = api.getCustomUserAgent(arg_identifier!); - return [output]; + try { + final String? output = api.getCustomUserAgent(arg_identifier!); + return [output]; + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1691,8 +2020,15 @@ abstract class TestWKUIDelegateHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegateHostApi.create was null, expected non-null int.'); - api.create(arg_identifier!); - return []; + try { + api.create(arg_identifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1764,9 +2100,16 @@ abstract class TestWKHttpCookieStoreHostApi { final int? arg_websiteDataStoreIdentifier = (args[1] as int?); assert(arg_websiteDataStoreIdentifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKHttpCookieStoreHostApi.createFromWebsiteDataStore was null, expected non-null int.'); - api.createFromWebsiteDataStore( - arg_identifier!, arg_websiteDataStoreIdentifier!); - return []; + try { + api.createFromWebsiteDataStore( + arg_identifier!, arg_websiteDataStoreIdentifier!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1791,8 +2134,15 @@ abstract class TestWKHttpCookieStoreHostApi { final NSHttpCookieData? arg_cookie = (args[1] as NSHttpCookieData?); assert(arg_cookie != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKHttpCookieStoreHostApi.setCookie was null, expected non-null NSHttpCookieData.'); - await api.setCookie(arg_identifier!, arg_cookie!); - return []; + try { + await api.setCookie(arg_identifier!, arg_cookie!); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } @@ -1832,8 +2182,15 @@ abstract class TestNSUrlHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.NSUrlHostApi.getAbsoluteString was null, expected non-null int.'); - final String? output = api.getAbsoluteString(arg_identifier!); - return [output]; + try { + final String? output = api.getAbsoluteString(arg_identifier!); + return [output]; + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } }