WordPress-Editor-iOS icon indicating copy to clipboard operation
WordPress-Editor-iOS copied to clipboard

Switch to WKWebView instead of UIWebView

Open bummytime opened this issue 11 years ago • 16 comments

Title has it. This is an iOS 8 only api, but we could consider regressing to UIWebView for iOS 7 users.

Marketing blurb:

WKWebView is the centerpiece of the modern WebKit API introduced in iOS 8 & OS X Yosemite. It replaces UIWebView in UIKit and WebView in AppKit, offering a consistent API across the two platforms.

Boasting responsive 60fps scrolling, built-in gestures, streamlined communication between app and webpage, and the same JavaScript engine as Safari, WKWebView is one of the most significant announcements to come out of WWDC 2014.

bummytime avatar Sep 26 '14 20:09 bummytime

Mattt Thompson has a nice breakdown of it here: http://nshipster.com/wkwebkit/

bummytime avatar Sep 26 '14 20:09 bummytime

I think this is worthwhile as there's a good chance we'll drop iOS 7 support.

sendhil avatar Sep 30 '14 05:09 sendhil

This is a status message posted by @SergioEstevao in an initial/tentative PR. I'm posting this here for context:

Trying to upgrade the uses of UIWebView to WKWevView, here a list of main issues to solve:

  • [x] Port the hack to have a read/write customAccessoryView from UIWebView to WKWebView
  • [ ] ~~Remove unnecessary hacks~~ (EDIT by Diego: let's leave this for v2).
  • [x] Make custom fonts load in the web view, because it looks it does;t have access to system ones.
  • [ ] ~~Port javascript html schema callbacks to use WKUserContentController~~ (EDIT by Diego: let's leave this for v2)

diegoreymendez avatar Feb 03 '16 14:02 diegoreymendez

Custom fonts are now loading in the web view.

diegoreymendez avatar Feb 03 '16 21:02 diegoreymendez

I'll be implementing native callbacks in a separate branch named feature/260-wkwebview-native-callbacks. That way we can either decide to merge them as part of this PR or in a separate one.

diegoreymendez avatar Feb 03 '16 21:02 diegoreymendez

When integrating this into WPiOS we have these issues:

  • [x] When posting, the last character typed is not saved.
  • [x] Can't update a post after editing it - the button remains greyed out.

diegoreymendez avatar Feb 04 '16 12:02 diegoreymendez

@SergioEstevao - Changing back and forth from source mode to regular mode should be working fine now. I just applied a fix for the issues you were seeing.

diegoreymendez avatar Feb 04 '16 17:02 diegoreymendez

Fixed the remaining issues we'd found. Will keep testing before creating a PR.

diegoreymendez avatar Feb 04 '16 18:02 diegoreymendez

Fixed an issue with device rotation by removing an old hack that seems not to be necessary anymore. Ping @bummytime to confirm.

diegoreymendez avatar Feb 05 '16 13:02 diegoreymendez

@rachelmcr, @bummytime: Added several fixes for the focusing issues and recovery. Also added a fix for the input accessory view issues when using an iPad.

More specifically:

  • The focus should now return after adding images.
  • The input accessory view should now be visible when using an iPad.

diegoreymendez avatar Feb 10 '16 19:02 diegoreymendez

Due to limitations in WKWebView, we're putting this idea on hold for now.

In particular we're not able to present images from private blogs, as there's no mechanism to add authentication cookies to those requests.

We'll keep this issue open and branch feature/260-wkwebview will be kept updated in case we find a solution for this problem.

More information: https://bugs.webkit.org/show_bug.cgi?id=140191

diegoreymendez avatar Feb 12 '16 12:02 diegoreymendez

I'm dissociating myself from this task for the time being, and until cookies-adding support for WKWebView comes out.

diegoreymendez avatar Feb 17 '16 14:02 diegoreymendez

Good work on this @diegoreymendez! We will keep our fingers crossed for real cookie support soon...

bummytime avatar Feb 17 '16 14:02 bummytime

Just leaving a note that the webkit bug was resolved a couple weeks ago, so hopefully it'll land on iOS 11

koke avatar Mar 31 '17 14:03 koke

WKWebView now has a cookie managing API in iOS 11 😄

nheagy avatar Jun 14 '17 20:06 nheagy