native tweaks
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
import UIKit
|
||||
|
||||
// https://dc19-24-237-65-73.ngrok-free.app/start/haileyok.com/3kuw7byr7gd2x
|
||||
|
||||
@main
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
var window: UIWindow?
|
||||
var controller: ViewController?
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
let window = UIWindow()
|
||||
self.window = UIWindow()
|
||||
|
||||
self.controller = ViewController(window: self.window!)
|
||||
let controller = ViewController(window: window)
|
||||
self.controller = controller
|
||||
|
||||
self.window?.rootViewController = self.controller
|
||||
self.window?.makeKeyAndVisible()
|
||||
window.rootViewController = self.controller
|
||||
window.makeKeyAndVisible()
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ class ViewController: UIViewController, WKScriptMessageHandler {
|
||||
|
||||
var window: UIWindow
|
||||
var webView: WKWebView?
|
||||
var userContentController: WKUserContentController?
|
||||
|
||||
var starterPackUrl: URL?
|
||||
|
||||
@@ -31,16 +30,14 @@ class ViewController: UIViewController, WKScriptMessageHandler {
|
||||
let webView = WKWebView(frame: self.view.bounds, configuration: configuration)
|
||||
webView.translatesAutoresizingMaskIntoConstraints = false
|
||||
webView.contentMode = .scaleToFill
|
||||
|
||||
self.view.addSubview(webView)
|
||||
self.webView = webView
|
||||
}
|
||||
|
||||
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
|
||||
guard let response = message.body as? String,
|
||||
let data = response.data(using: .utf8, allowLossyConversion: false),
|
||||
let payload = try? JSONDecoder().decode(WebViewActionPayload.self, from: data)
|
||||
else {
|
||||
let data = response.data(using: .utf8),
|
||||
let payload = try? JSONDecoder().decode(WebViewActionPayload.self, from: data) else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user