From 5240582f73c2ee4940072237d07eb899cbba6d6c Mon Sep 17 00:00:00 2001 From: Hailey Date: Mon, 17 Jun 2024 15:39:41 -0700 Subject: [PATCH] native tweaks --- modules/BlueskyClip/AppDelegate.swift | 10 +++++----- modules/BlueskyClip/ViewController.swift | 7 ++----- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/modules/BlueskyClip/AppDelegate.swift b/modules/BlueskyClip/AppDelegate.swift index 43581ab2ed..684194953c 100644 --- a/modules/BlueskyClip/AppDelegate.swift +++ b/modules/BlueskyClip/AppDelegate.swift @@ -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 } diff --git a/modules/BlueskyClip/ViewController.swift b/modules/BlueskyClip/ViewController.swift index f1037d675b..bed1cbe7bb 100644 --- a/modules/BlueskyClip/ViewController.swift +++ b/modules/BlueskyClip/ViewController.swift @@ -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 }