Awful / Awful.app

Something Awful Forums browser for iOS
https://forums.somethingawful.com/showthread.php?threadid=3837546&perpage=40&noseen=1
142 stars 44 forks source link

Switch to RenderView (WKWebView) for rendering #669

Closed nolanw closed 6 years ago

nolanw commented 7 years ago

We currently use UIWebView for rendering posts and PMs. UIWebView has finally been deprecated in the iOS 12 SDK, so it's time to move to WKWebView.

Some stuff got moved over back when iOS 8 came out, but WKWebView was missing a few key features that meant our heaviest web view usage was stuck. The last feature to fall was custom url scheme support (we use URLProtocol which works in UIWebView), which we use in a few different ways and wasn't worth giving up. Happily, custom URL scheme handlers arrived in WKWebView in iOS 11, so we can give the full experience to everyone on iOS 11 and above (and for now, below, if we use some private API).

There's a lot of common pieces for Awful when rendering content in web views, so let's extract those into a RenderView. All relevant JavaScript can go into RenderView.js instead of having a bunch of .js files strewn about. Speaking of, zepto.js isn't giving us enough to bother including it, so let's just use what the browser gives us. Let's also aim to move document manipulation code from JavaScript into Swift. Finally, we won't need WebViewJavascriptBridge anymore because its functionality is built in to WKWebView.

This is a big task, so let's approach it incrementally. RenderView can start as the rendering facility for the new feature of showing announcements, then we can move screens of increasing complexity over to RenderView as time goes on.

The following issues may have been fixed during this PR (but double-check before closing):

nolanw commented 6 years ago

Forgot to mention it in the commit message but commit 1b5be396c9ad9ea9c78d5abba30633e1a22f50a6 works towards this PR.