[PM-1608] Changed safari extension save dialog (#5127)
* PS-1608 - Changed safari extension save dialog * PM-1608 moved setActivationPolicy to constructor
This commit is contained in:
parent
3300a4cc15
commit
e08dafcf5f
|
@ -8,6 +8,11 @@ let ServiceNameBiometric = ServiceName + "_biometric"
|
|||
|
||||
class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling {
|
||||
|
||||
override init() {
|
||||
super.init();
|
||||
NSApplication.shared.setActivationPolicy(.accessory)
|
||||
}
|
||||
|
||||
func beginRequest(with context: NSExtensionContext) {
|
||||
let item = context.inputItems[0] as! NSExtensionItem
|
||||
let message = item.userInfo?[SFExtensionMessageKey] as AnyObject?
|
||||
|
@ -54,11 +59,12 @@ class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling {
|
|||
guard let data = blobData else {
|
||||
return
|
||||
}
|
||||
|
||||
let panel = NSSavePanel()
|
||||
panel.isFloatingPanel = true
|
||||
panel.canCreateDirectories = true
|
||||
panel.nameFieldStringValue = dlMsg.fileName
|
||||
panel.begin { response in
|
||||
let response = panel.runModal();
|
||||
|
||||
if response == NSApplication.ModalResponse.OK {
|
||||
if let url = panel.url {
|
||||
do {
|
||||
|
@ -74,7 +80,6 @@ class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
case "sleep":
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 10) {
|
||||
|
|
Loading…
Reference in New Issue