Procházet zdrojové kódy

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 před 9 hodinami
rodič
revize
e9a2aee14a
1 změnil soubory, kde provedl 9 přidání a 44 odebrání
  1. 9 44
      smart_printer/PaywallView.swift

+ 9 - 44
smart_printer/PaywallView.swift

@@ -282,39 +282,6 @@ private final class PaywallPlanCard: NSControl {
282
     }
282
     }
283
 }
283
 }
284
 
284
 
285
-// MARK: - Close Button
286
-
287
-private final class PaywallCloseButton: NSButton {
288
-    var onClose: (() -> Void)?
289
-
290
-    init() {
291
-        super.init(frame: .zero)
292
-        isBordered = false
293
-        translatesAutoresizingMaskIntoConstraints = false
294
-        wantsLayer = true
295
-        layer?.backgroundColor = AppTheme.blueLight.cgColor
296
-        layer?.cornerRadius = 14
297
-        if let image = NSImage(systemSymbolName: "xmark", accessibilityDescription: "Close") {
298
-            let config = NSImage.SymbolConfiguration(pointSize: 11, weight: .semibold)
299
-            self.image = image.withSymbolConfiguration(config)
300
-        }
301
-        contentTintColor = AppTheme.blue
302
-        target = self
303
-        action = #selector(tapped)
304
-    }
305
-
306
-    @available(*, unavailable)
307
-    required init?(coder: NSCoder) { nil }
308
-
309
-    @objc private func tapped() {
310
-        onClose?()
311
-    }
312
-
313
-    override func resetCursorRects() {
314
-        addCursorRect(bounds, cursor: .pointingHand)
315
-    }
316
-}
317
-
318
 // MARK: - Footer Link
285
 // MARK: - Footer Link
319
 
286
 
320
 private final class PaywallFooterLink: NSButton {
287
 private final class PaywallFooterLink: NSButton {
@@ -496,9 +463,6 @@ final class PaywallView: NSView {
496
         let panel = NSView()
463
         let panel = NSView()
497
         panel.translatesAutoresizingMaskIntoConstraints = false
464
         panel.translatesAutoresizingMaskIntoConstraints = false
498
 
465
 
499
-        let closeButton = PaywallCloseButton()
500
-        closeButton.onClose = { [weak self] in self?.onClose?() }
501
-
502
         let title = NSTextField(labelWithString: "Go Premium")
466
         let title = NSTextField(labelWithString: "Go Premium")
503
         title.font = AppTheme.semiboldFont(size: 26)
467
         title.font = AppTheme.semiboldFont(size: 26)
504
         title.textColor = AppTheme.navy
468
         title.textColor = AppTheme.navy
@@ -539,7 +503,6 @@ final class PaywallView: NSView {
539
         let trustRow = makeTrustRow()
503
         let trustRow = makeTrustRow()
540
         let footerLinks = makeFooterLinks()
504
         let footerLinks = makeFooterLinks()
541
 
505
 
542
-        panel.addSubview(closeButton)
543
         panel.addSubview(title)
506
         panel.addSubview(title)
544
         panel.addSubview(subtitle)
507
         panel.addSubview(subtitle)
545
         panel.addSubview(plansStack)
508
         panel.addSubview(plansStack)
@@ -548,11 +511,6 @@ final class PaywallView: NSView {
548
         panel.addSubview(footerLinks)
511
         panel.addSubview(footerLinks)
549
 
512
 
550
         NSLayoutConstraint.activate([
513
         NSLayoutConstraint.activate([
551
-            closeButton.trailingAnchor.constraint(equalTo: panel.trailingAnchor, constant: -20),
552
-            closeButton.topAnchor.constraint(equalTo: panel.topAnchor, constant: 20),
553
-            closeButton.widthAnchor.constraint(equalToConstant: 28),
554
-            closeButton.heightAnchor.constraint(equalToConstant: 28),
555
-
556
             title.leadingAnchor.constraint(equalTo: panel.leadingAnchor, constant: 28),
514
             title.leadingAnchor.constraint(equalTo: panel.leadingAnchor, constant: 28),
557
             title.topAnchor.constraint(equalTo: panel.topAnchor, constant: 40),
515
             title.topAnchor.constraint(equalTo: panel.topAnchor, constant: 40),
558
             title.trailingAnchor.constraint(equalTo: panel.trailingAnchor, constant: -28),
516
             title.trailingAnchor.constraint(equalTo: panel.trailingAnchor, constant: -28),
@@ -626,7 +584,10 @@ final class PaywallView: NSView {
626
         let container = NSView()
584
         let container = NSView()
627
         container.translatesAutoresizingMaskIntoConstraints = false
585
         container.translatesAutoresizingMaskIntoConstraints = false
628
 
586
 
629
-        let manageSubscriptionLink = PaywallFooterLink(title: "Manage Subscription")
587
+        let continueWithFreePlanLink = PaywallFooterLink(title: "Continue with free plan")
588
+        continueWithFreePlanLink.target = self
589
+        continueWithFreePlanLink.action = #selector(continueWithFreePlanTapped)
590
+
630
         let restoreLink = PaywallFooterLink(title: "Restore Purchase")
591
         let restoreLink = PaywallFooterLink(title: "Restore Purchase")
631
         restoreLink.target = self
592
         restoreLink.target = self
632
         restoreLink.action = #selector(restoreTapped)
593
         restoreLink.action = #selector(restoreTapped)
@@ -641,7 +602,7 @@ final class PaywallView: NSView {
641
         let separator4 = makeFooterSeparator()
602
         let separator4 = makeFooterSeparator()
642
 
603
 
643
         let linksStack = NSStackView(views: [
604
         let linksStack = NSStackView(views: [
644
-            manageSubscriptionLink, separator1, restoreLink, separator2, privacyLink, separator3, termsLink, separator4, supportLink,
605
+            continueWithFreePlanLink, separator1, restoreLink, separator2, privacyLink, separator3, termsLink, separator4, supportLink,
645
         ])
606
         ])
646
         linksStack.orientation = .horizontal
607
         linksStack.orientation = .horizontal
647
         linksStack.spacing = 8
608
         linksStack.spacing = 8
@@ -688,6 +649,10 @@ final class PaywallView: NSView {
688
     @objc private func restoreTapped() {
649
     @objc private func restoreTapped() {
689
         onRestore?()
650
         onRestore?()
690
     }
651
     }
652
+
653
+    @objc private func continueWithFreePlanTapped() {
654
+        onClose?()
655
+    }
691
 }
656
 }
692
 
657
 
693
 // MARK: - Overlay Presenter
658
 // MARK: - Overlay Presenter