ollm commented on PR #1333:
URL: https://github.com/apache/cordova-ios/pull/1333#issuecomment-1573683009

   What do you think about something similar to this? This should avoid the 
problem of exposing the WebKit API and should allow you to extend it if a 
plugin needs other information in the future.
   
   ```objective-c
   @interface CDVWebViewOverrideLoadWithRequest : NSObject
   
   @property(nonatomic, readwrite) NSURLRequest * request;
   @property(nonatomic, readwrite) int navigationType;
   @property(nonatomic, readwrite) Boolean sourceFrameIsNil;
   //@property(nonatomic, readwrite) WKFrameInfo * sourceFrame;
   // ...
   
   @end
   
   @implementation CDVWebViewOverrideLoadWithRequest
   
   @end
   ```
   
   and
   
   ``` objective-c
   SEL selector2 = 
NSSelectorFromString(@"shouldOverrideLoadWithRequest:overrideLoadWithRequest:");
   if ([plugin respondsToSelector:selector2]) {
       anyPluginsResponded = YES;
       CDVWebViewOverrideLoadWithRequest *overrideLoadWithRequest = 
[[CDVWebViewOverrideLoadWithRequest alloc] init];
       overrideLoadWithRequest.request = navigationAction.request;
       overrideLoadWithRequest.navigationType = 
(int)navigationAction.navigationType;
       overrideLoadWithRequest.sourceFrameIsNil = (navigationAction.sourceFrame 
== nil) ? YES : NO;
       //...
       shouldAllowRequest = (((BOOL (*)(id, SEL, id, id))objc_msgSend)(plugin, 
selector2, navigationAction.request, overrideLoadWithRequest));
       if (!shouldAllowRequest) {
           break;
       }
   }
   ```
   
   Sorry if the code is not quite correct, I'm still learning how Objective-c 
works.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to