1
This commit is contained in:
parent
df25f94035
commit
aa526639c6
@ -129,9 +129,12 @@ class APWebLoginVC: NSViewController {
|
||||
}
|
||||
|
||||
func closeView() {
|
||||
guard let window = view.window, let parent = window.sheetParent
|
||||
else { return }
|
||||
guard let window = view.window else { return }
|
||||
if let parent = window.sheetParent {
|
||||
parent.endSheet(window)
|
||||
} else {
|
||||
window.close()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -10,6 +10,8 @@ import Cocoa
|
||||
|
||||
class APRootWC: NSWindowController {
|
||||
|
||||
private var loginWindowController: NSWindowController?
|
||||
|
||||
override func windowDidLoad() {
|
||||
super.windowDidLoad()
|
||||
setupUI()
|
||||
@ -57,11 +59,22 @@ class APRootWC: NSWindowController {
|
||||
if #available(macOS 11.0, *) {
|
||||
self?.window?.subtitle = UserCenter.shared.accountEmail
|
||||
}
|
||||
self?.loginWindowController = nil
|
||||
}
|
||||
let pannel = NSPanel(contentViewController: vc)
|
||||
pannel.minSize = NSSize(width: 900, height: 680)
|
||||
pannel.setFrame(NSRect(origin: .zero, size: NSSize(width: 980, height: 760)), display: true)
|
||||
window?.beginSheet(pannel, completionHandler: nil)
|
||||
vc.cancelHandle = { [weak self] in
|
||||
self?.loginWindowController = nil
|
||||
}
|
||||
|
||||
let loginWindow = NSWindow(contentViewController: vc)
|
||||
loginWindow.title = "App Store Connect"
|
||||
loginWindow.styleMask = [.titled, .closable, .miniaturizable, .resizable]
|
||||
loginWindow.minSize = NSSize(width: 900, height: 680)
|
||||
loginWindow.setFrame(NSScreen.main?.visibleFrame ?? NSRect(x: 0, y: 0, width: 1280, height: 800), display: true)
|
||||
|
||||
let loginWC = NSWindowController(window: loginWindow)
|
||||
loginWindowController = loginWC
|
||||
loginWC.showWindow(self)
|
||||
loginWindow.makeKeyAndOrderFront(self)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user