|
|
@@ -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
|
285
|
// MARK: - Footer Link
|
|
319
|
286
|
|
|
320
|
287
|
private final class PaywallFooterLink: NSButton {
|
|
|
@@ -496,9 +463,6 @@ final class PaywallView: NSView {
|
|
496
|
463
|
let panel = NSView()
|
|
497
|
464
|
panel.translatesAutoresizingMaskIntoConstraints = false
|
|
498
|
465
|
|
|
499
|
|
- let closeButton = PaywallCloseButton()
|
|
500
|
|
- closeButton.onClose = { [weak self] in self?.onClose?() }
|
|
501
|
|
-
|
|
502
|
466
|
let title = NSTextField(labelWithString: "Go Premium")
|
|
503
|
467
|
title.font = AppTheme.semiboldFont(size: 26)
|
|
504
|
468
|
title.textColor = AppTheme.navy
|
|
|
@@ -539,7 +503,6 @@ final class PaywallView: NSView {
|
|
539
|
503
|
let trustRow = makeTrustRow()
|
|
540
|
504
|
let footerLinks = makeFooterLinks()
|
|
541
|
505
|
|
|
542
|
|
- panel.addSubview(closeButton)
|
|
543
|
506
|
panel.addSubview(title)
|
|
544
|
507
|
panel.addSubview(subtitle)
|
|
545
|
508
|
panel.addSubview(plansStack)
|
|
|
@@ -548,11 +511,6 @@ final class PaywallView: NSView {
|
|
548
|
511
|
panel.addSubview(footerLinks)
|
|
549
|
512
|
|
|
550
|
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
|
514
|
title.leadingAnchor.constraint(equalTo: panel.leadingAnchor, constant: 28),
|
|
557
|
515
|
title.topAnchor.constraint(equalTo: panel.topAnchor, constant: 40),
|
|
558
|
516
|
title.trailingAnchor.constraint(equalTo: panel.trailingAnchor, constant: -28),
|
|
|
@@ -626,7 +584,10 @@ final class PaywallView: NSView {
|
|
626
|
584
|
let container = NSView()
|
|
627
|
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
|
591
|
let restoreLink = PaywallFooterLink(title: "Restore Purchase")
|
|
631
|
592
|
restoreLink.target = self
|
|
632
|
593
|
restoreLink.action = #selector(restoreTapped)
|
|
|
@@ -641,7 +602,7 @@ final class PaywallView: NSView {
|
|
641
|
602
|
let separator4 = makeFooterSeparator()
|
|
642
|
603
|
|
|
643
|
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
|
607
|
linksStack.orientation = .horizontal
|
|
647
|
608
|
linksStack.spacing = 8
|
|
|
@@ -688,6 +649,10 @@ final class PaywallView: NSView {
|
|
688
|
649
|
@objc private func restoreTapped() {
|
|
689
|
650
|
onRestore?()
|
|
690
|
651
|
}
|
|
|
652
|
+
|
|
|
653
|
+ @objc private func continueWithFreePlanTapped() {
|
|
|
654
|
+ onClose?()
|
|
|
655
|
+ }
|
|
691
|
656
|
}
|
|
692
|
657
|
|
|
693
|
658
|
// MARK: - Overlay Presenter
|