mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-23 11:56:00 +01:00
init vc and web view on app init
This commit is contained in:
parent
41be76a107
commit
8dbdfe96b1
@ -9,6 +9,11 @@
|
||||
import SafariServices
|
||||
|
||||
class SafariExtensionHandler: SFSafariExtensionHandler {
|
||||
override init() {
|
||||
super.init()
|
||||
SafariExtensionViewController.shared.initWebView()
|
||||
}
|
||||
|
||||
override func messageReceived(withName messageName: String, from page: SFSafariPage, userInfo: [String: Any]?) {
|
||||
// This method will be called when a content script provided by your extension calls safari.extension.dispatchMessage("message").
|
||||
if messageName == "bitwarden" {
|
||||
|
@ -11,6 +11,7 @@ import WebKit
|
||||
|
||||
class SafariExtensionViewController: SFSafariExtensionViewController, WKScriptMessageHandler, WKNavigationDelegate {
|
||||
var webView: WKWebView!
|
||||
var initedWebView: Bool = false
|
||||
|
||||
static let shared: SafariExtensionViewController = {
|
||||
let shared = SafariExtensionViewController()
|
||||
@ -19,6 +20,10 @@ class SafariExtensionViewController: SFSafariExtensionViewController, WKScriptMe
|
||||
}()
|
||||
|
||||
func initWebView() {
|
||||
if initedWebView {
|
||||
return
|
||||
}
|
||||
initedWebView = true
|
||||
let parentHeight = SafariExtensionViewController.shared.preferredContentSize.height
|
||||
let parentWidth = SafariExtensionViewController.shared.preferredContentSize.width
|
||||
let webViewConfig = WKWebViewConfiguration()
|
||||
|
Loading…
Reference in New Issue
Block a user