1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-07 09:31:31 +01:00

swift cleanup

This commit is contained in:
Kyle Spearrin 2019-08-16 17:21:35 -04:00
parent a7dabc45f1
commit 42c44c381a
2 changed files with 2 additions and 11 deletions

View File

@ -37,10 +37,6 @@
</array>
<key>SFSafariContentScript</key>
<array>
<dict>
<key>Script</key>
<string>script.js</string>
</dict>
<dict>
<key>Script</key>
<string>app/content/autofill.js</string>

View File

@ -12,24 +12,19 @@ class SafariExtensionHandler: SFSafariExtensionHandler {
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") {
page.getPropertiesWithCompletionHandler { properties in
NSLog("The extension received a message (\(messageName)) from a script injected into (\(String(describing: properties?.url))) with userInfo (\(userInfo ?? [:]))")
// NSLog("The extension received a message (\(messageName)) from a script injected into (\(String(describing: properties?.url))) with userInfo (\(userInfo ?? [:]))")
DispatchQueue.main.async {
SafariExtensionViewController.shared.replyMessageFromScript(msg: userInfo)
}
}
}
// page.dispatchMessageToScript(withName: "getInfo", userInfo: ["hello": "world", "foo": "bar"])
}
override func toolbarItemClicked(in window: SFSafariWindow) {
// This method will be called when your toolbar item is clicked.
NSLog("The extension's toolbar item was clicked")
// NSLog("The extension's toolbar item was clicked")
}
override func validateToolbarItem(in window: SFSafariWindow, validationHandler: @escaping ((Bool, String) -> Void)) {