Sfoglia il codice sorgente

Remove paywall close button and add Continue with free plan.

Users can dismiss the paywall via the footer link, which returns them to the home screen.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 1 mese fa
parent
commit
e9a2aee14a
1 ha cambiato i file con 9 aggiunte e 44 eliminazioni
  1. 9 44
      smart_printer/PaywallView.swift

+ 9 - 44
smart_printer/PaywallView.swift

@@ -282,39 +282,6 @@ private final class PaywallPlanCard: NSControl {
     }
 }
 
-// MARK: - Close Button
-
-private final class PaywallCloseButton: NSButton {
-    var onClose: (() -> Void)?
-
-    init() {
-        super.init(frame: .zero)
-        isBordered = false
-        translatesAutoresizingMaskIntoConstraints = false
-        wantsLayer = true
-        layer?.backgroundColor = AppTheme.blueLight.cgColor
-        layer?.cornerRadius = 14
-        if let image = NSImage(systemSymbolName: "xmark", accessibilityDescription: "Close") {
-            let config = NSImage.SymbolConfiguration(pointSize: 11, weight: .semibold)
-            self.image = image.withSymbolConfiguration(config)
-        }
-        contentTintColor = AppTheme.blue
-        target = self
-        action = #selector(tapped)
-    }
-
-    @available(*, unavailable)
-    required init?(coder: NSCoder) { nil }
-
-    @objc private func tapped() {
-        onClose?()
-    }
-
-    override func resetCursorRects() {
-        addCursorRect(bounds, cursor: .pointingHand)
-    }
-}
-
 // MARK: - Footer Link
 
 private final class PaywallFooterLink: NSButton {
@@ -496,9 +463,6 @@ final class PaywallView: NSView {
         let panel = NSView()
         panel.translatesAutoresizingMaskIntoConstraints = false
 
-        let closeButton = PaywallCloseButton()
-        closeButton.onClose = { [weak self] in self?.onClose?() }
-
         let title = NSTextField(labelWithString: "Go Premium")
         title.font = AppTheme.semiboldFont(size: 26)
         title.textColor = AppTheme.navy
@@ -539,7 +503,6 @@ final class PaywallView: NSView {
         let trustRow = makeTrustRow()
         let footerLinks = makeFooterLinks()
 
-        panel.addSubview(closeButton)
         panel.addSubview(title)
         panel.addSubview(subtitle)
         panel.addSubview(plansStack)
@@ -548,11 +511,6 @@ final class PaywallView: NSView {
         panel.addSubview(footerLinks)
 
         NSLayoutConstraint.activate([
-            closeButton.trailingAnchor.constraint(equalTo: panel.trailingAnchor, constant: -20),
-            closeButton.topAnchor.constraint(equalTo: panel.topAnchor, constant: 20),
-            closeButton.widthAnchor.constraint(equalToConstant: 28),
-            closeButton.heightAnchor.constraint(equalToConstant: 28),
-
             title.leadingAnchor.constraint(equalTo: panel.leadingAnchor, constant: 28),
             title.topAnchor.constraint(equalTo: panel.topAnchor, constant: 40),
             title.trailingAnchor.constraint(equalTo: panel.trailingAnchor, constant: -28),
@@ -626,7 +584,10 @@ final class PaywallView: NSView {
         let container = NSView()
         container.translatesAutoresizingMaskIntoConstraints = false
 
-        let manageSubscriptionLink = PaywallFooterLink(title: "Manage Subscription")
+        let continueWithFreePlanLink = PaywallFooterLink(title: "Continue with free plan")
+        continueWithFreePlanLink.target = self
+        continueWithFreePlanLink.action = #selector(continueWithFreePlanTapped)
+
         let restoreLink = PaywallFooterLink(title: "Restore Purchase")
         restoreLink.target = self
         restoreLink.action = #selector(restoreTapped)
@@ -641,7 +602,7 @@ final class PaywallView: NSView {
         let separator4 = makeFooterSeparator()
 
         let linksStack = NSStackView(views: [
-            manageSubscriptionLink, separator1, restoreLink, separator2, privacyLink, separator3, termsLink, separator4, supportLink,
+            continueWithFreePlanLink, separator1, restoreLink, separator2, privacyLink, separator3, termsLink, separator4, supportLink,
         ])
         linksStack.orientation = .horizontal
         linksStack.spacing = 8
@@ -688,6 +649,10 @@ final class PaywallView: NSView {
     @objc private func restoreTapped() {
         onRestore?()
     }
+
+    @objc private func continueWithFreePlanTapped() {
+        onClose?()
+    }
 }
 
 // MARK: - Overlay Presenter