|
|
@@ -127,6 +127,9 @@ final class DashboardView: NSView, NSTextFieldDelegate {
|
|
127
|
127
|
private let jobSearchService = OpenAIJobSearchService()
|
|
128
|
128
|
private var premiumPlansWindowController: PremiumPlansWindowController?
|
|
129
|
129
|
private weak var sidebarUpgradeCard: NSView?
|
|
|
130
|
+ private weak var sidebarUpgradeHeadline: NSTextField?
|
|
|
131
|
+ private weak var sidebarUpgradeDescription: NSTextField?
|
|
|
132
|
+ private weak var sidebarUpgradeButton: HoverableButton?
|
|
130
|
133
|
private var subscriptionObserver: NSObjectProtocol?
|
|
131
|
134
|
|
|
132
|
135
|
/// 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 {
|
|
158
|
161
|
super.viewDidMoveToWindow()
|
|
159
|
162
|
guard window != nil else { return }
|
|
160
|
163
|
Task { @MainActor in
|
|
161
|
|
- await SubscriptionStore.shared.refreshEntitlements()
|
|
|
164
|
+ await SubscriptionStore.shared.refreshEntitlements(deep: true)
|
|
162
|
165
|
self.applyProSubscriptionToSidebar()
|
|
163
|
166
|
}
|
|
164
|
167
|
}
|
|
|
@@ -363,7 +366,24 @@ final class DashboardView: NSView, NSTextFieldDelegate {
|
|
363
|
366
|
|
|
364
|
367
|
private func applyProSubscriptionToSidebar() {
|
|
365
|
368
|
let active = SubscriptionStore.shared.isProActive
|
|
366
|
|
- sidebarUpgradeCard?.isHidden = active
|
|
|
369
|
+ sidebarUpgradeCard?.isHidden = false
|
|
|
370
|
+
|
|
|
371
|
+ guard let headline = sidebarUpgradeHeadline,
|
|
|
372
|
+ let upgradeDescription = sidebarUpgradeDescription,
|
|
|
373
|
+ let upgradeButton = sidebarUpgradeButton else { return }
|
|
|
374
|
+
|
|
|
375
|
+ let descriptionWidth: CGFloat = 158
|
|
|
376
|
+ if active {
|
|
|
377
|
+ headline.stringValue = "You're on Pro"
|
|
|
378
|
+ upgradeDescription.stringValue = "Manage billing, renewals, and plans in the App Store."
|
|
|
379
|
+ upgradeDescription.preferredMaxLayoutWidth = descriptionWidth
|
|
|
380
|
+ upgradeButton.title = "Manage Subscription"
|
|
|
381
|
+ } else {
|
|
|
382
|
+ headline.stringValue = "Upgrade to Pro"
|
|
|
383
|
+ upgradeDescription.stringValue = "Unlimited AI matches, smart alerts, and interview prep—all in one place."
|
|
|
384
|
+ upgradeDescription.preferredMaxLayoutWidth = descriptionWidth
|
|
|
385
|
+ upgradeButton.title = "Try Pro"
|
|
|
386
|
+ }
|
|
367
|
387
|
}
|
|
368
|
388
|
|
|
369
|
389
|
private func presentPremiumPlansSheet() {
|
|
|
@@ -2073,7 +2093,7 @@ final class DashboardView: NSView, NSTextFieldDelegate {
|
|
2073
|
2093
|
let innerContentWidth = cardWidth - 28
|
|
2074
|
2094
|
upgradeDescription.preferredMaxLayoutWidth = innerContentWidth
|
|
2075
|
2095
|
|
|
2076
|
|
- let upgradeButton = HoverableButton(title: "Upgrade to Pro", target: self, action: #selector(didTapUpgradeToPro))
|
|
|
2096
|
+ let upgradeButton = HoverableButton(title: "Try Pro", target: self, action: #selector(didTapUpgradeToPro))
|
|
2077
|
2097
|
upgradeButton.isBordered = false
|
|
2078
|
2098
|
upgradeButton.bezelStyle = .rounded
|
|
2079
|
2099
|
upgradeButton.font = .systemFont(ofSize: 13, weight: .bold)
|
|
|
@@ -2115,11 +2135,23 @@ final class DashboardView: NSView, NSTextFieldDelegate {
|
|
2115
|
2135
|
|
|
2116
|
2136
|
sidebar.addArrangedSubview(upgradeCard)
|
|
2117
|
2137
|
sidebarUpgradeCard = upgradeCard
|
|
|
2138
|
+ sidebarUpgradeHeadline = headline
|
|
|
2139
|
+ sidebarUpgradeDescription = upgradeDescription
|
|
|
2140
|
+ sidebarUpgradeButton = upgradeButton
|
|
2118
|
2141
|
applyProSubscriptionToSidebar()
|
|
2119
|
2142
|
}
|
|
2120
|
2143
|
|
|
2121
|
2144
|
@objc private func didTapUpgradeToPro() {
|
|
2122
|
|
- presentPremiumPlansSheet()
|
|
|
2145
|
+ Task { @MainActor in
|
|
|
2146
|
+ await SubscriptionStore.shared.refreshEntitlements(deep: true)
|
|
|
2147
|
+ applyProSubscriptionToSidebar()
|
|
|
2148
|
+ guard SubscriptionStore.shared.isProActive else {
|
|
|
2149
|
+ presentPremiumPlansSheet()
|
|
|
2150
|
+ return
|
|
|
2151
|
+ }
|
|
|
2152
|
+ guard let url = URL(string: "https://apps.apple.com/account/subscriptions") else { return }
|
|
|
2153
|
+ NSWorkspace.shared.open(url)
|
|
|
2154
|
+ }
|
|
2123
|
2155
|
}
|
|
2124
|
2156
|
|
|
2125
|
2157
|
@objc private func didChangeThemeSelection(_ sender: NSSegmentedControl) {
|