|
@@ -127,6 +127,9 @@ final class DashboardView: NSView, NSTextFieldDelegate {
|
|
|
private let jobSearchService = OpenAIJobSearchService()
|
|
private let jobSearchService = OpenAIJobSearchService()
|
|
|
private var premiumPlansWindowController: PremiumPlansWindowController?
|
|
private var premiumPlansWindowController: PremiumPlansWindowController?
|
|
|
private weak var sidebarUpgradeCard: NSView?
|
|
private weak var sidebarUpgradeCard: NSView?
|
|
|
|
|
+ private weak var sidebarUpgradeHeadline: NSTextField?
|
|
|
|
|
+ private weak var sidebarUpgradeDescription: NSTextField?
|
|
|
|
|
+ private weak var sidebarUpgradeButton: HoverableButton?
|
|
|
private var subscriptionObserver: NSObjectProtocol?
|
|
private var subscriptionObserver: NSObjectProtocol?
|
|
|
|
|
|
|
|
/// Upper bound sent to the model per request (was fixed at 8 in the prompt). Clamped when calling the API.
|
|
/// Upper bound sent to the model per request (was fixed at 8 in the prompt). Clamped when calling the API.
|
|
@@ -158,7 +161,7 @@ final class DashboardView: NSView, NSTextFieldDelegate {
|
|
|
super.viewDidMoveToWindow()
|
|
super.viewDidMoveToWindow()
|
|
|
guard window != nil else { return }
|
|
guard window != nil else { return }
|
|
|
Task { @MainActor in
|
|
Task { @MainActor in
|
|
|
- await SubscriptionStore.shared.refreshEntitlements()
|
|
|
|
|
|
|
+ await SubscriptionStore.shared.refreshEntitlements(deep: true)
|
|
|
self.applyProSubscriptionToSidebar()
|
|
self.applyProSubscriptionToSidebar()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -363,7 +366,24 @@ final class DashboardView: NSView, NSTextFieldDelegate {
|
|
|
|
|
|
|
|
private func applyProSubscriptionToSidebar() {
|
|
private func applyProSubscriptionToSidebar() {
|
|
|
let active = SubscriptionStore.shared.isProActive
|
|
let active = SubscriptionStore.shared.isProActive
|
|
|
- sidebarUpgradeCard?.isHidden = active
|
|
|
|
|
|
|
+ sidebarUpgradeCard?.isHidden = false
|
|
|
|
|
+
|
|
|
|
|
+ guard let headline = sidebarUpgradeHeadline,
|
|
|
|
|
+ let upgradeDescription = sidebarUpgradeDescription,
|
|
|
|
|
+ let upgradeButton = sidebarUpgradeButton else { return }
|
|
|
|
|
+
|
|
|
|
|
+ let descriptionWidth: CGFloat = 158
|
|
|
|
|
+ if active {
|
|
|
|
|
+ headline.stringValue = "You're on Pro"
|
|
|
|
|
+ upgradeDescription.stringValue = "Manage billing, renewals, and plans in the App Store."
|
|
|
|
|
+ upgradeDescription.preferredMaxLayoutWidth = descriptionWidth
|
|
|
|
|
+ upgradeButton.title = "Manage Subscription"
|
|
|
|
|
+ } else {
|
|
|
|
|
+ headline.stringValue = "Upgrade to Pro"
|
|
|
|
|
+ upgradeDescription.stringValue = "Unlimited AI matches, smart alerts, and interview prep—all in one place."
|
|
|
|
|
+ upgradeDescription.preferredMaxLayoutWidth = descriptionWidth
|
|
|
|
|
+ upgradeButton.title = "Try Pro"
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private func presentPremiumPlansSheet() {
|
|
private func presentPremiumPlansSheet() {
|
|
@@ -2073,7 +2093,7 @@ final class DashboardView: NSView, NSTextFieldDelegate {
|
|
|
let innerContentWidth = cardWidth - 28
|
|
let innerContentWidth = cardWidth - 28
|
|
|
upgradeDescription.preferredMaxLayoutWidth = innerContentWidth
|
|
upgradeDescription.preferredMaxLayoutWidth = innerContentWidth
|
|
|
|
|
|
|
|
- let upgradeButton = HoverableButton(title: "Upgrade to Pro", target: self, action: #selector(didTapUpgradeToPro))
|
|
|
|
|
|
|
+ let upgradeButton = HoverableButton(title: "Try Pro", target: self, action: #selector(didTapUpgradeToPro))
|
|
|
upgradeButton.isBordered = false
|
|
upgradeButton.isBordered = false
|
|
|
upgradeButton.bezelStyle = .rounded
|
|
upgradeButton.bezelStyle = .rounded
|
|
|
upgradeButton.font = .systemFont(ofSize: 13, weight: .bold)
|
|
upgradeButton.font = .systemFont(ofSize: 13, weight: .bold)
|
|
@@ -2115,11 +2135,23 @@ final class DashboardView: NSView, NSTextFieldDelegate {
|
|
|
|
|
|
|
|
sidebar.addArrangedSubview(upgradeCard)
|
|
sidebar.addArrangedSubview(upgradeCard)
|
|
|
sidebarUpgradeCard = upgradeCard
|
|
sidebarUpgradeCard = upgradeCard
|
|
|
|
|
+ sidebarUpgradeHeadline = headline
|
|
|
|
|
+ sidebarUpgradeDescription = upgradeDescription
|
|
|
|
|
+ sidebarUpgradeButton = upgradeButton
|
|
|
applyProSubscriptionToSidebar()
|
|
applyProSubscriptionToSidebar()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@objc private func didTapUpgradeToPro() {
|
|
@objc private func didTapUpgradeToPro() {
|
|
|
- presentPremiumPlansSheet()
|
|
|
|
|
|
|
+ Task { @MainActor in
|
|
|
|
|
+ await SubscriptionStore.shared.refreshEntitlements(deep: true)
|
|
|
|
|
+ applyProSubscriptionToSidebar()
|
|
|
|
|
+ guard SubscriptionStore.shared.isProActive else {
|
|
|
|
|
+ presentPremiumPlansSheet()
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ guard let url = URL(string: "https://apps.apple.com/account/subscriptions") else { return }
|
|
|
|
|
+ NSWorkspace.shared.open(url)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@objc private func didChangeThemeSelection(_ sender: NSSegmentedControl) {
|
|
@objc private func didChangeThemeSelection(_ sender: NSSegmentedControl) {
|