|
|
@@ -185,6 +185,7 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
|
|
|
private var chatThinkingRowHost: NSView?
|
|
|
private let jobSearchService = OpenAIJobSearchService()
|
|
|
private var premiumPlansWindowController: PremiumPlansWindowController?
|
|
|
+ private var isPreparingPremiumPlansSheet = false
|
|
|
private var indeedJobBrowserViewController: IndeedJobBrowserViewController?
|
|
|
private var isIndeedJobBrowserPresented = false
|
|
|
private weak var sidebarUpgradeCard: NSView?
|
|
|
@@ -777,31 +778,41 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
|
|
|
|
|
|
private func presentPremiumPlansSheet() {
|
|
|
guard let hostWindow = window else { return }
|
|
|
+ if isPreparingPremiumPlansSheet { return }
|
|
|
|
|
|
- if premiumPlansWindowController == nil {
|
|
|
- premiumPlansWindowController = PremiumPlansWindowController()
|
|
|
- }
|
|
|
- guard let paywallWindow = premiumPlansWindowController?.window else { return }
|
|
|
+ isPreparingPremiumPlansSheet = true
|
|
|
+ Task { @MainActor [weak self] in
|
|
|
+ defer { self?.isPreparingPremiumPlansSheet = false }
|
|
|
+ guard let self else { return }
|
|
|
|
|
|
- if hostWindow.attachedSheet === paywallWindow {
|
|
|
- return
|
|
|
- }
|
|
|
+ if self.premiumPlansWindowController == nil {
|
|
|
+ self.premiumPlansWindowController = PremiumPlansWindowController()
|
|
|
+ }
|
|
|
+ guard let controller = self.premiumPlansWindowController else { return }
|
|
|
+ await controller.prepareForPresentation()
|
|
|
|
|
|
- paywallWindow.styleMask = [.borderless, .closable, .resizable]
|
|
|
- paywallWindow.isOpaque = true
|
|
|
- paywallWindow.backgroundColor = PremiumPlansWindowController.paywallSheetBackground
|
|
|
+ guard let paywallWindow = controller.window else { return }
|
|
|
|
|
|
- let hostContentRect = hostWindow.contentRect(forFrameRect: hostWindow.frame)
|
|
|
- let overscan = PremiumSheetLayout.overscanPerEdge
|
|
|
- var expandedContentRect = hostContentRect.insetBy(dx: -overscan, dy: -overscan)
|
|
|
- expandedContentRect.size.height += PremiumSheetLayout.overscanExtraTop
|
|
|
- let paywallFrame = paywallWindow.frameRect(forContentRect: expandedContentRect)
|
|
|
- paywallWindow.setFrame(paywallFrame, display: false)
|
|
|
- let lockedSize = paywallWindow.frame.size
|
|
|
- paywallWindow.minSize = lockedSize
|
|
|
- paywallWindow.maxSize = lockedSize
|
|
|
+ if hostWindow.attachedSheet === paywallWindow {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ paywallWindow.styleMask = [.borderless, .closable, .resizable]
|
|
|
+ paywallWindow.isOpaque = true
|
|
|
+ paywallWindow.backgroundColor = PremiumPlansWindowController.paywallSheetBackground
|
|
|
|
|
|
- hostWindow.beginSheet(paywallWindow)
|
|
|
+ let hostContentRect = hostWindow.contentRect(forFrameRect: hostWindow.frame)
|
|
|
+ let overscan = PremiumSheetLayout.overscanPerEdge
|
|
|
+ var expandedContentRect = hostContentRect.insetBy(dx: -overscan, dy: -overscan)
|
|
|
+ expandedContentRect.size.height += PremiumSheetLayout.overscanExtraTop
|
|
|
+ let paywallFrame = paywallWindow.frameRect(forContentRect: expandedContentRect)
|
|
|
+ paywallWindow.setFrame(paywallFrame, display: false)
|
|
|
+ let lockedSize = paywallWindow.frame.size
|
|
|
+ paywallWindow.minSize = lockedSize
|
|
|
+ paywallWindow.maxSize = lockedSize
|
|
|
+
|
|
|
+ await hostWindow.beginSheet(paywallWindow)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private func configureFeatureShortcutCards() {
|