open tab on create new tab message
This commit is contained in:
parent
fc7bbed965
commit
78343d3e60
|
@ -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!)
|
||||||
|
|
Loading…
Reference in New Issue