swift format
This commit is contained in:
parent
c6be0b31c1
commit
a8b454a50e
|
@ -13,7 +13,7 @@ class SafariExtensionHandler: SFSafariExtensionHandler {
|
||||||
super.init()
|
super.init()
|
||||||
SafariExtensionViewController.shared.initWebView()
|
SafariExtensionViewController.shared.initWebView()
|
||||||
}
|
}
|
||||||
|
|
||||||
override func messageReceived(withName messageName: String, from page: SFSafariPage, userInfo: [String: Any]?) {
|
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").
|
// This method will be called when a content script provided by your extension calls safari.extension.dispatchMessage("message").
|
||||||
if messageName == "bitwarden" {
|
if messageName == "bitwarden" {
|
||||||
|
@ -48,11 +48,11 @@ class SafariExtensionHandler: SFSafariExtensionHandler {
|
||||||
self.sendMessage(msg: ["command": "reloadPopup"], sender: nil)
|
self.sendMessage(msg: ["command": "reloadPopup"], sender: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override func popoverDidClose(in _: SFSafariWindow) {
|
override func popoverDidClose(in _: SFSafariWindow) {
|
||||||
SafariExtensionViewController.shared.popoverOpenCount -= 1
|
SafariExtensionViewController.shared.popoverOpenCount -= 1
|
||||||
}
|
}
|
||||||
|
|
||||||
func sendMessage(msg: [String: Any]?, sender: Tab? = nil) {
|
func sendMessage(msg: [String: Any]?, sender: Tab? = nil) {
|
||||||
if SafariExtensionViewController.shared.webView == nil {
|
if SafariExtensionViewController.shared.webView == nil {
|
||||||
return
|
return
|
||||||
|
|
|
@ -151,7 +151,7 @@ class SafariExtensionViewController: SFSafariExtensionViewController, WKScriptMe
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else if command == "isPopoverOpen" {
|
} else if command == "isPopoverOpen" {
|
||||||
m!.responseData = popoverOpenCount > 0 ? "true" : "false";
|
m!.responseData = popoverOpenCount > 0 ? "true" : "false"
|
||||||
replyMessage(message: m!)
|
replyMessage(message: m!)
|
||||||
} else if command == "createNewTab" {
|
} else if command == "createNewTab" {
|
||||||
if m!.data != nil {
|
if m!.data != nil {
|
||||||
|
|
Loading…
Reference in New Issue