Telerik-Verified-Plugins / WKWebView

DEPRECATED - this plugin served a purpose in the past, but there are better implementation now
832 stars 149 forks source link

support for cordova ios 4 ? #249

Open matrixreal opened 8 years ago

matrixreal commented 8 years ago

Hi, i would like to know if this plugin will be compatible with cordova ios 4? thanks

EddyVerbruggen commented 8 years ago

With iOS 10's first developer preview we've seen that WKWebView no longer respects user-scalable=no so even Cordova app using it will be zoomable. If that remains the case during beta's I won't be investing another minute in WKWebView.

matrixreal commented 8 years ago

ok but cordova ios 4 is supporting ios 8.X and up so maybe it can be compatible ... bad luck since cordova ios 4.X is much better and faster so i was thinking that if we use this plugin it will be much better

EddyVerbruggen commented 8 years ago

Just curious: how is Cordova-iOS 4.x much better and (especially) faster?

matrixreal commented 8 years ago

i did small test with html5 games and i see that it use less memory and its faster in start app and have good fsp than 3.X

EddyVerbruggen commented 8 years ago

Thanks. The difference in the test you ran was only swapping cordova-ios 3 for 4? Both with UIWebView or WKWebView?

damrbaby commented 8 years ago

@EddyVerbruggen is there a ticket filed with apple regarding the user-scalable regression on iOS 10? That is unfortunate.

EddyVerbruggen commented 8 years ago

Google it. There's probably a radar.. But it can never hurt to file a dupe. But they did it on purpose for websites - just shouldn't do it for embedded webviews..

damrbaby commented 8 years ago

@EddyVerbruggen I really appreciate knowing this, as we're migrating to WKWebView using your plugin as we currently speak. Your plugin is preferred over the cordova one since cordova doesn't copy over localStorage. We are looking for the performance benefits of WKWebView.

Just so I understand the risks and impact on user experience, if the betas don't fix this issue, that means that the user will be able to zoom on the webview as if it were a website, but the other meta attributes (e.g. width=device-width,initial-scale=1, maximum-scale=1) are still respected?

Also wondering if there is some other way to prevent scale/zoom.

damrbaby commented 8 years ago

Also, it's not easy to find information about this on google https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=user-scalable+ios+10+wkwebview&safe=off&start=10

EddyVerbruggen commented 8 years ago

This is wat triggered me: https://news.ycombinator.com/item?id=11898649 Then reproduced it on my iOS 10 developer preview device and simulator.

The other properties are still respected indeed. But if I would start a new app I'd stick with UIWebView for now.

keenan35i commented 8 years ago

yikes, but i think the scaleibility thing should be fixed, so far all we have is beta 1, i just filed a bug report about it on apples site just in case, however being able to support new cordova versions is pretty important as new features start to come out and i would like to continue to use this plugin as it supports ios 8 as well as 9 very well (hopefully 10 too).

matrixreal commented 8 years ago

@keenan35i exactly ... agree

LukePulverenti commented 8 years ago

Is localStorage migration the only reason you want to use this plugin over the default webview in Cordova 4.X? What else is it missing? Don't get me wrong this plugin has been great for my app but I think eventually we'd all like to use the stock webview in 4.X. The plugin helped raise the bar and forced improvements within the Cordova core, and deserves a lot of credit for that.

kristfal commented 8 years ago

@LukePulverenti Does the official plugin provide crash recovery? If not, then I'd say that is the main selling point of this plugin.

iOS has a bad tendency to crash the WkWebView individually when it experiences memory issues (instead of closing the entire app). This plugin has a (semi)-working crash recovery that will detect a crashed webview and attempt to relaunch it.

keenan35i commented 8 years ago

btw i found a solution for "user-scalable=no" ignore on ios 10 beta, its not an issue anymore.

EddyVerbruggen commented 8 years ago

@keenan35i Can you share it with us?

keenan35i commented 8 years ago

lol idk if i want to put it out there before the release of ios10 and give them a chance to fix it but if you want you can pm me ill tell you what it is. @EddyVerbruggen

damrbaby commented 8 years ago

@LukePulverenti @kristfal The reason why i was looking at this plugin is because the default one in cordova 4.x does not seem to migrate localStorage (in my app at least) which is a deal-breaker. I would love to find a way to use it over this one because in the event we switch from the @EddyVerbruggen plugin to cordova 4.x (which may be inevitable) we'll still have the same problem (localStorage migration). Has anybody has success using the official 4.x cordova WKWebView while persisting localStorage from UIWebView?

LukePulverenti commented 8 years ago

@damrbaby but that is just a one-time situation, no? Couldn't you just look at how to accomplish that with your own code?

matrixreal commented 8 years ago

off topic :+1: i'm using construct 2 to made my games 1-when i use cordova ios 3.9.2 i get fps between 38~42 (my game has a lot of collisionsoa lot of calculcation) with this plugin to go to 48-52 wich is good 2-when i use cordova ios 4.1.2 i got fsp 48-57 with the same game ... imagine if we add this plugin i'm sure that we will get 58-59-60 stable fsp and i can share the 2 files (cordova ios 3.9.2 game and cordova 4.1.2 wth same game)

garygriswold commented 7 years ago

@EddyVerbruggen is there a current decision about cordova iOS 4 support? Your plugin has been running in our production application for about 4 months now with excellent results. Without your plugin I would have had to remove the infinite scroller feature from our App. At the moment, I am having cordova iOS 3.9 build problems to deploy on IOS 10 and hoping that I could use cordova iOS 4 soon. Thanks for the excellent job you have done on this.

LukePulverenti commented 7 years ago

You can get through the iOS 10 build issues. You'll have to manually re-target CordovaLib for iOS 8 and do a couple other things but it's not that bad. I'm up and running with it and I figure by the time i have to revisit it again, either this plugin will be updated, or the core Wkwebview support will have improved enough that I can switch to that.

keenan35i commented 7 years ago

btw in js if you do prevent default on document 'touchmove' but first check if there is two fingers on it, then there will be no zooming issue on ios 10.

kristfal commented 7 years ago

@keenan35i That workaround is no longer needed in iOS10. The viewport tag is honored in the final release. Your fix was only needed for a few of the betas.

keenan35i commented 7 years ago

ah lol even better haven't messed with it since :) @kristfal

kristfal commented 7 years ago

@EddyVerbruggen We're getting into the situation where more and more Cordova plugins have Cordova iOS 4 as a minimum requirement, and this plugin is the only one keeping us from upgrading.

Are you interested in / have time to upgrade this by yourself? If not, would you accept a PR which would remove support for Cordova versions < 4 and iOS versions < 8?

Also, given that LocalStorage is a real mess on iOS10, we would probably not include any code that attempts to work around LS restrictions and persistence in a potential PR.

What is your thoughts on this?

EddyVerbruggen commented 7 years ago

Hi @kristfal I would. I'm also contemplating blowing the entire repo in favor of Ionic's implementation. Have you tried that one? Pretty curious to learn what you guys think.

kristfal commented 7 years ago

Hey @EddyVerbruggen, I did give it a decent shot a couple of weeks back, but had quite a lot of issues with XHR and ended up going back to this plugin. In essence, any .js library you'd include that does something fancy with XHR (eg. a fetch polyfill) is likely to break.

In addition to the XHR issues, that plugin doesn't work with corodvoa-hot-code-push, making it a no go for us.

The core difference between that plugin and this is the XHR workaround. Your system level web-server approach seems a lot more solid than the XHR 'hack' used in the Ionic implementation, as you isolate any changes outside the webview.

I'm sticking with this plugin for now, and I think the fundamental approach of yours is better than Ionic's. If you blow this repo, I'm likely to maintain a public fork.

On top of my head, this is the next big things that we need/would work on:

1) A better crash recovery mechanism. The current recovery creates a new webview, while retaining the old. This leaks around 20MB on every crash. We've already fixed this internally. 2) Cordova iOS 4 support 3) didReceiveMemoryWarning propagation to the webview 4) Possibly remove the dormant UIWebView to reduce memory footprint

I'm a bit tight on time right now, but I (and possibly a couple of colleagues) will start working on this in a few weeks time.

matrixreal commented 7 years ago

@EddyVerbruggen @kristfal any news about cordova ios 4 support ? thank you

kashban commented 6 years ago

Eight months later and still no improvement on this? I am getting issues here because I have to update to Cordova 4 for other projects and this plugin is just not working with it.