Closed timbru31 closed 3 years ago
Great stuff, any chance of getting this pushed to npm, so we can start using it?
We don’t give ETAs on new releases, but as you can see we have resumed development of this plugin. There is a lot of testing and cleanup to do though.
Sent from my iPhone
On 27. Aug 2020, at 9:27 AM, Martin Bech notifications@github.com wrote:
Great stuff, any chance of getting this pushed to npm, so we can start using it?
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.
+1 to a fast release, as this is blocking builds.
@timbru31 this appears to break adding all the configured headers for me.
My assumption is that this call does not block untill the completionHandler is executed.
[self.webViewEngine evaluateJavaScript:@"navigator.userAgent" completionHandler:^(NSString* userAgent, NSError* error) {
I looked at https://developer.apple.com/documentation/webkit/wkwebview/1415017-evaluatejavascript but it does not indicate tell if it blocks till the completionHandler has run.
EDIT: I've added some NSLog statements and indeed it does not block when calling evaluateJavascript.
Thanks for investigating, I'll take a look.
That is a quick reply :)
I was considering moving the userAgent determination to the plugin is initialization. This would also reduce the amount of evaluateJavascript calls to just one instead of for each request.
Are you willing to prepare a PR for that? 👍
Seems that is also not possible. Since pluginInitialize is synchronous the same problem can occur.
Since the headers can be set from javascript, including the User-Agent
header. What about adding a default in javascript instead and removing the User-Agent from all the native code?
I've looked at the Android and Windows implementation, both do not add the User-Agent header in the plugin code.
Am I missing something or can it just be removed?
I've created https://github.com/apache/cordova-plugin-file-transfer/pull/284 for this issue.
This closes #263 This closes #258
Platforms affected
iOS
Motivation and Context
This solves the issue in #258 and makes the plugin compatible with cordova-ios@6.
It also re-implements the user agent overwrite.
Description
Sadly, there is no "nice" way to obtain the WKWebView user agent other than evaluating JavaScript.
Testing
My local fork compiles and has the correct user agent attached when making the network requests.
Checklist
(platform)
if this change only applies to one platform (e.g.(android)
)