-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[webview_flutter_wkwebview] Updates the internal wrapper to use @ProxyApi
from pigeon
#8311
base: main
Are you sure you want to change the base?
Conversation
@ProxyApi
from pigeon
return instance | ||
} | ||
|
||
#if compiler(>=6.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MainActor
was required for local development with Xcode 16, but our CI doesn't recognize the method because it uses XCode 15. Related to: flutter/flutter#148870
/// Creates an error when a method is called on an unsupported version. | ||
func createUnsupportedVersionError(method: String, versionRequirements: String) -> PigeonError { | ||
return PigeonError( | ||
code: "FWFUnsupportedVersionError", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeps error code consistent with previous implementation.
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#if os(iOS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: These could be changed to canImport(UIKit)
so that other platforms, like tvOS, could be used without changes. But I went with what was used in the Objective-C
implementation.
/// | ||
/// Since `URLRequest` is a struct, it is pass by value instead of pass by reference. This makes | ||
/// it not possible to modify the properties of a struct with the typical ProxyAPI system. | ||
class URLRequestWrapper { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting FYI for anyone curious and additional context that I can add to the comment if needed:
The Swift URLRequest
represents the Objective-C NSURLRequest
and MutableNSURLRequest
and converts to one or the other depending on the context.
This is different from URL
and NSURL
, which doesn't have a mutable equivalent. So a URL
would always convert to the same NSURL
instance when needed.
This distinction might come up when wrapping other structs.
/// change of the plugin. Native code other than this external API does not follow breaking change | ||
/// conventions, so app or plugin clients should not use any other native APIs. | ||
@objc(WebViewFlutterWKWebViewExternalAPI) | ||
public class FWFWebViewFlutterWKWebViewExternalAPI: NSObject { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class was converted to Swift, but the @objc
annotations should provide the equivalent method (I wrote the swift test before creating the class).
8FB79B842820A3A400C101D3 /* FWFUIDelegateHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = FWFUIDelegateHostApiTests.m; path = ../../darwin/Tests/FWFUIDelegateHostApiTests.m; sourceTree = SOURCE_ROOT; }; | ||
8FB79B8E2820BAB300C101D3 /* FWFScrollViewHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = FWFScrollViewHostApiTests.m; path = ../../darwin/Tests/FWFScrollViewHostApiTests.m; sourceTree = SOURCE_ROOT; }; | ||
8FB79B902820BAC700C101D3 /* FWFUIViewHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = FWFUIViewHostApiTests.m; path = ../../darwin/Tests/FWFUIViewHostApiTests.m; sourceTree = SOURCE_ROOT; }; | ||
8FB79B962821985200C101D3 /* FWFObjectHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = FWFObjectHostApiTests.m; path = ../../darwin/Tests/FWFObjectHostApiTests.m; sourceTree = SOURCE_ROOT; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stuartmorgan How were you able to get a relative path for the files in darwin/Tests
? I had to manually change all the paths in this file.
Also fixes flutter/flutter#152352
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style, or this PR is exempt from CHANGELOG changes.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.