mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-19 04:46:08 +00:00
Fix cant close qr if opened manually
This commit is contained in:
1 parent
b5d1233778
commit
8ebebbda15
1 file changed
+21
-19
@@ -151,26 +151,28 @@ class ShareViewController: NSViewController, ShareExtensionDelegate{
|
|||||||
|
|
||||||
|
|
||||||
private func openQrCodeView() {
|
private func openQrCodeView() {
|
||||||
let contentView = QrCodeView {
|
if qrCodeSheetView != nil {
|
||||||
self.closeQrCodeView()
|
let contentView = QrCodeView {
|
||||||
}
|
self.closeQrCodeView()
|
||||||
|
}
|
||||||
let hostingView = NSHostingView(rootView: contentView)
|
|
||||||
|
|
||||||
let panel = NSPanel(contentRect: NSRect(x: 0, y: 0, width: qrCodeViewSize.width, height: qrCodeViewSize.height),
|
|
||||||
styleMask: [.titled, .closable, .utilityWindow],
|
|
||||||
backing: .buffered,
|
|
||||||
defer: false)
|
|
||||||
|
|
||||||
panel.title = "SwiftUI Sheet"
|
|
||||||
panel.contentView = hostingView
|
|
||||||
|
|
||||||
self.qrCodeSheetView = panel
|
|
||||||
|
|
||||||
if let mainWindow = NSApp.mainWindow {
|
|
||||||
|
|
||||||
self.sheetAttachedWindow = mainWindow
|
let hostingView = NSHostingView(rootView: contentView)
|
||||||
mainWindow.beginSheet(panel) { _ in }
|
|
||||||
|
let panel = NSPanel(contentRect: NSRect(x: 0, y: 0, width: qrCodeViewSize.width, height: qrCodeViewSize.height),
|
||||||
|
styleMask: [.titled, .closable, .utilityWindow],
|
||||||
|
backing: .buffered,
|
||||||
|
defer: false)
|
||||||
|
|
||||||
|
panel.title = "SwiftUI Sheet"
|
||||||
|
panel.contentView = hostingView
|
||||||
|
|
||||||
|
self.qrCodeSheetView = panel
|
||||||
|
|
||||||
|
if let mainWindow = NSApp.mainWindow {
|
||||||
|
|
||||||
|
self.sheetAttachedWindow = mainWindow
|
||||||
|
mainWindow.beginSheet(panel) { _ in }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user