open tab on create new tab message

This commit is contained in:
Kyle Spearrin 2019-08-20 15:23:05 -04:00
parent fc7bbed965
commit 78343d3e60
1 changed files with 7 additions and 2 deletions

View File

@ -152,8 +152,13 @@ class SafariExtensionViewController: SFSafariExtensionViewController, WKScriptMe
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" {
// TODO if m!.data != nil {
replyMessage(message: m!) SFSafariApplication.getActiveWindow { win in
win?.openTab(with: URL(string: m!.data!)!, makeActiveIfPossible: true, completionHandler: { _ in
// Tab opened
})
}
}
} else if command == "reloadExtension" { } else if command == "reloadExtension" {
webView?.reload() webView?.reload()
replyMessage(message: m!) replyMessage(message: m!)