Skip to content
This repository was archived by the owner on Aug 12, 2022. It is now read-only.

Conversation

@yueyuzhao
Copy link
Contributor

@yueyuzhao yueyuzhao commented Aug 2, 2020

Resolves

upgrade UIWebView to WKWebView

Proposed Changes

WKWebView differs from UIWebView very much, we can't get result from the native
codes directly. I introduced Promise for javascript native calling and async/await
to reduce complexity.

nothing needs to be changed for android.

Reason for Changes

  • .gitignore package-lock.json is not upload to the codebase and should be ignore.
  • package.json @babel/polyfill and babel-preset-stage-3 helps compile async/await to es2015 stage-3
  • JsBridge.m, bridging JS messages and implementing WKScriptMessageHandler
  • JsRequest.m, wrapping messages that JS sent and return the native result
  • View.xib, no UIWebView needed anymore, replace it with a normal View file
  • iOS.js, adapting javascript call to native code.

Test Coverage

  • display/create/edit/delete projects
  • recording/playing sounds
  • GUI sounds
  • taking pictures
  • share project via Airdrop
  • share project via Email
  • open project via Airdrop
  • open project via Email

@yueyuzhao yueyuzhao marked this pull request as ready for review August 2, 2020 22:57
@chrisgarrity
Copy link
Contributor

chrisgarrity commented Aug 10, 2020

@yueyuzhao thank you for the PR. That's a very elegant solution for the didReceiveScriptMessage handler, and the stackoverflow link has such a thorough explanation! Unfortunately, we can't accept this PR as is as it will create conflicts with our work. I decided that it was finally time to refactor the interface layer so that it stopped being 'iOS' everywhere. The PR that refactors the interface is up now. Since we're splitting the iOS and Android interfaces, there's no need to try to maintain the tabletinterface calls with async/await. We're also free to change how iOS.js deals with the WKWebview calls.

This was referenced Aug 14, 2020
@chrisgarrity
Copy link
Contributor

Closing in favor of https://github.com/LLK/scratchjr/pull/291. Thanks @yueyuzhao.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade to WKWebView on iOS

2 participants