-
Notifications
You must be signed in to change notification settings - Fork 987
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
feat: add CDVWebViewEngineConfigurationDelegate #1050
Conversation
In concept this looks good. I suspect |
Great, understanding this existing dependency is helpful. I can bring back the existing init alongside this new one. |
… conforming plugins use it
Codecov Report
@@ Coverage Diff @@
## master #1050 +/- ##
=======================================
Coverage 74.82% 74.82%
=======================================
Files 13 13
Lines 1720 1720
=======================================
Hits 1287 1287
Misses 433 433 Continue to review full report at Codecov.
|
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.
Does the addition of NS_ASSUME_NONNULL_BEGIN
and nullable
impact the public API for plugins that implement subclasses of CDVViewController and CDVWebViewEngineProtocol?
We need to be careful with public API to ensure (as much as possible) that we don't break existing plugins, otherwise people will just stay on older versions and keep opening issues requesting fixes be backported.
Short answer, no impact. Longer answer: Before the changes, the original code could actually return nil, but the consumer had no way to understand this without nullability specifiers. The consumers likely assumed that these methods never return nil. Adding the |
You've changed - (nullable instancetype)initWithFrame:(CGRect)frame; Will existing plugins that implement it without |
…ation with configuration
They may possibly see a warning (depending on project setup, and language used), but it is a good warning regarding unchanged code. The existing code could have always returned nil here. It should not stop anyone from compiling, even if they are treating warnings as errors in their own project. |
…iewWithFrame chore: clean up newCordovaViewWithFrame in order to extract initializ…
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 looks good to me.
@NiklasMerz @jcesarmobile Any thoughts/concerns here?
No concerns. This looks like a really good change for plugin authors. I am just not confident enough in ObjectiveC to review the code/find issues. |
I took a moment to go through existing (unchanged) methods that fall under the assumed "nonnull" but can actually return nil, and explicitly marked them as "nullable," so there's less ambiguity. |
* feat: add CDVWebViewEngineConfigurationDelegate to fully expose WKWebView configuration (apache#900) * fix: update the existing tests of the default behavior * chore: bring back initWithFrame, as existing CDVWebViewEngineProtocol conforming plugins use it * chore: clean up newCordovaViewWithFrame in order to extract initialization with configuration * chore: find existing methods that can return nil, and mark them as such for clarity
to fully expose WKWebView configuration (#900)
Platforms affected
cordova-ios
Motivation and Context
#900
Description
Allows the consumer to extend CDVViewController as a CDVWebViewEngineConfigurationDelegate and provide a WKWebViewConfiguration. This is useful for more complex configuration cases (i.e., ones where configuration through config.xml is insufficient).
Testing
I tested both the existing behavior:
And the new behavior:
Checklist
(platform)
if this change only applies to one platform (e.g.(android)
)