|
|
@@ -6718,6 +6718,34 @@ private extension ViewController {
|
|
6718
|
6718
|
openURLWithRouting(url, policy: inAppBrowserDefaultPolicy)
|
|
6719
|
6719
|
}
|
|
6720
|
6720
|
|
|
|
6721
|
+ private func addPremiumLockOverlayToClassCard(_ card: NSView, message: String) {
|
|
|
6722
|
+ let lockOverlay = NSVisualEffectView()
|
|
|
6723
|
+ lockOverlay.translatesAutoresizingMaskIntoConstraints = false
|
|
|
6724
|
+ lockOverlay.material = darkModeEnabled ? .hudWindow : .popover
|
|
|
6725
|
+ lockOverlay.blendingMode = .withinWindow
|
|
|
6726
|
+ lockOverlay.state = .active
|
|
|
6727
|
+ lockOverlay.wantsLayer = true
|
|
|
6728
|
+ lockOverlay.layer?.cornerRadius = 14
|
|
|
6729
|
+ lockOverlay.layer?.masksToBounds = true
|
|
|
6730
|
+ lockOverlay.layer?.backgroundColor = NSColor.black.withAlphaComponent(darkModeEnabled ? 0.28 : 0.12).cgColor
|
|
|
6731
|
+
|
|
|
6732
|
+ let lockLabel = textLabel(message, font: NSFont.systemFont(ofSize: 12, weight: .semibold), color: darkModeEnabled ? .white : .black)
|
|
|
6733
|
+ lockLabel.alignment = .center
|
|
|
6734
|
+
|
|
|
6735
|
+ card.addSubview(lockOverlay)
|
|
|
6736
|
+ lockOverlay.addSubview(lockLabel)
|
|
|
6737
|
+ NSLayoutConstraint.activate([
|
|
|
6738
|
+ lockOverlay.leadingAnchor.constraint(equalTo: card.leadingAnchor),
|
|
|
6739
|
+ lockOverlay.trailingAnchor.constraint(equalTo: card.trailingAnchor),
|
|
|
6740
|
+ lockOverlay.topAnchor.constraint(equalTo: card.topAnchor),
|
|
|
6741
|
+ lockOverlay.bottomAnchor.constraint(equalTo: card.bottomAnchor),
|
|
|
6742
|
+ lockLabel.centerXAnchor.constraint(equalTo: lockOverlay.centerXAnchor),
|
|
|
6743
|
+ lockLabel.centerYAnchor.constraint(equalTo: lockOverlay.centerYAnchor),
|
|
|
6744
|
+ lockLabel.leadingAnchor.constraint(greaterThanOrEqualTo: lockOverlay.leadingAnchor, constant: 10),
|
|
|
6745
|
+ lockLabel.trailingAnchor.constraint(lessThanOrEqualTo: lockOverlay.trailingAnchor, constant: -10)
|
|
|
6746
|
+ ])
|
|
|
6747
|
+ }
|
|
|
6748
|
+
|
|
6721
|
6749
|
private func renderEnrolledClassCards(_ courses: [ClassroomCourse]) {
|
|
6722
|
6750
|
guard let stack = enrolledPageCardsStack else { return }
|
|
6723
|
6751
|
enrolledCourseByCardID.removeAll()
|
|
|
@@ -6823,19 +6851,37 @@ private extension ViewController {
|
|
6823
|
6851
|
let base = self.palette.sectionCard
|
|
6824
|
6852
|
let hoverBlend = self.darkModeEnabled ? NSColor.white : NSColor.black
|
|
6825
|
6853
|
let hover = base.blended(withFraction: 0.10, of: hoverBlend) ?? base
|
|
6826
|
|
- card.layer?.backgroundColor = (hovering ? hover : base).cgColor
|
|
|
6854
|
+ if self.storeKitCoordinator.hasPremiumAccess {
|
|
|
6855
|
+ card.layer?.backgroundColor = (hovering ? hover : base).cgColor
|
|
|
6856
|
+ } else {
|
|
|
6857
|
+ card.layer?.backgroundColor = base.cgColor
|
|
|
6858
|
+ }
|
|
6827
|
6859
|
}
|
|
6828
|
6860
|
hit.onHoverChanged?(false)
|
|
|
6861
|
+
|
|
|
6862
|
+ if !storeKitCoordinator.hasPremiumAccess {
|
|
|
6863
|
+ addPremiumLockOverlayToClassCard(card, message: "Get Premium to see classes")
|
|
|
6864
|
+ hit.toolTip = "Premium required. Click to open paywall."
|
|
|
6865
|
+ }
|
|
|
6866
|
+
|
|
6829
|
6867
|
return hit
|
|
6830
|
6868
|
}
|
|
6831
|
6869
|
|
|
6832
|
6870
|
@objc private func enrolledCardButtonPressed(_ sender: NSButton) {
|
|
|
6871
|
+ guard storeKitCoordinator.hasPremiumAccess else {
|
|
|
6872
|
+ showPaywall()
|
|
|
6873
|
+ return
|
|
|
6874
|
+ }
|
|
6833
|
6875
|
guard let courseID = sender.identifier?.rawValue,
|
|
6834
|
6876
|
let course = enrolledCourseByCardID[courseID] else { return }
|
|
6835
|
6877
|
enrolledClassCardClicked(view: sender, course: course)
|
|
6836
|
6878
|
}
|
|
6837
|
6879
|
|
|
6838
|
6880
|
@objc private func teachingCardButtonPressed(_ sender: NSButton) {
|
|
|
6881
|
+ guard storeKitCoordinator.hasPremiumAccess else {
|
|
|
6882
|
+ showPaywall()
|
|
|
6883
|
+ return
|
|
|
6884
|
+ }
|
|
6839
|
6885
|
guard let courseID = sender.identifier?.rawValue,
|
|
6840
|
6886
|
let course = teachingCourseByCardID[courseID] else { return }
|
|
6841
|
6887
|
enrolledClassCardClicked(view: sender, course: course)
|
|
|
@@ -6913,9 +6959,19 @@ private extension ViewController {
|
|
6913
|
6959
|
let base = self.palette.sectionCard
|
|
6914
|
6960
|
let hoverBlend = self.darkModeEnabled ? NSColor.white : NSColor.black
|
|
6915
|
6961
|
let hover = base.blended(withFraction: 0.10, of: hoverBlend) ?? base
|
|
6916
|
|
- card.layer?.backgroundColor = (hovering ? hover : base).cgColor
|
|
|
6962
|
+ if self.storeKitCoordinator.hasPremiumAccess {
|
|
|
6963
|
+ card.layer?.backgroundColor = (hovering ? hover : base).cgColor
|
|
|
6964
|
+ } else {
|
|
|
6965
|
+ card.layer?.backgroundColor = base.cgColor
|
|
|
6966
|
+ }
|
|
6917
|
6967
|
}
|
|
6918
|
6968
|
hit.onHoverChanged?(false)
|
|
|
6969
|
+
|
|
|
6970
|
+ if !storeKitCoordinator.hasPremiumAccess {
|
|
|
6971
|
+ addPremiumLockOverlayToClassCard(card, message: "Get Premium to see classes")
|
|
|
6972
|
+ hit.toolTip = "Premium required. Click to open paywall."
|
|
|
6973
|
+ }
|
|
|
6974
|
+
|
|
6919
|
6975
|
return hit
|
|
6920
|
6976
|
}
|
|
6921
|
6977
|
|