|
|
@@ -515,18 +515,15 @@ private final class PremiumPlansViewController: NSViewController {
|
|
515
|
515
|
)
|
|
516
|
516
|
subscriptionPrimaryFooterButton = primary.button
|
|
517
|
517
|
|
|
518
|
|
- let entries: [(text: String, action: Selector?)] = [
|
|
|
518
|
+ let entries: [(text: String, action: Selector)] = [
|
|
519
|
519
|
("Restore Purchase", #selector(didTapRestorePurchases)),
|
|
520
|
|
- ("Privacy Policy", nil),
|
|
521
|
|
- ("Terms of Services", nil),
|
|
522
|
|
- ("Support", nil)
|
|
|
520
|
+ ("Privacy Policy", #selector(didTapFooterPrivacyPolicy)),
|
|
|
521
|
+ ("Terms of Services", #selector(didTapFooterTermsOfServices)),
|
|
|
522
|
+ ("Support", #selector(didTapFooterSupport))
|
|
523
|
523
|
]
|
|
524
|
524
|
|
|
525
|
525
|
let cells = [primary.container] + entries.enumerated().map { index, entry in
|
|
526
|
|
- if let action = entry.action {
|
|
527
|
|
- return footerActionCell(title: entry.text, action: action, showsTrailingDivider: index < entries.count - 1).container
|
|
528
|
|
- }
|
|
529
|
|
- return footerCell(text: entry.text, showsTrailingDivider: index < entries.count - 1)
|
|
|
526
|
+ footerActionCell(title: entry.text, action: entry.action, showsTrailingDivider: index < entries.count - 1).container
|
|
530
|
527
|
}
|
|
531
|
528
|
|
|
532
|
529
|
let links = NSStackView(views: cells)
|
|
|
@@ -577,33 +574,6 @@ private final class PremiumPlansViewController: NSViewController {
|
|
577
|
574
|
subscriptionPrimaryFooterButton?.title = subscriptionPrimaryFooterTitle()
|
|
578
|
575
|
}
|
|
579
|
576
|
|
|
580
|
|
- private func footerCell(text: String, showsTrailingDivider: Bool) -> NSView {
|
|
581
|
|
- let container = NSView()
|
|
582
|
|
- container.translatesAutoresizingMaskIntoConstraints = false
|
|
583
|
|
-
|
|
584
|
|
- let label = footerLink(text)
|
|
585
|
|
- label.translatesAutoresizingMaskIntoConstraints = false
|
|
586
|
|
- label.alignment = .center
|
|
587
|
|
- container.addSubview(label)
|
|
588
|
|
-
|
|
589
|
|
- var constraints = [
|
|
590
|
|
- label.centerXAnchor.constraint(equalTo: container.centerXAnchor),
|
|
591
|
|
- label.centerYAnchor.constraint(equalTo: container.centerYAnchor)
|
|
592
|
|
- ]
|
|
593
|
|
-
|
|
594
|
|
- if showsTrailingDivider {
|
|
595
|
|
- let divider = footerDivider()
|
|
596
|
|
- container.addSubview(divider)
|
|
597
|
|
- constraints.append(contentsOf: [
|
|
598
|
|
- divider.trailingAnchor.constraint(equalTo: container.trailingAnchor),
|
|
599
|
|
- divider.centerYAnchor.constraint(equalTo: container.centerYAnchor)
|
|
600
|
|
- ])
|
|
601
|
|
- }
|
|
602
|
|
-
|
|
603
|
|
- NSLayoutConstraint.activate(constraints)
|
|
604
|
|
- return container
|
|
605
|
|
- }
|
|
606
|
|
-
|
|
607
|
577
|
private func trustBadge(icon: String, title: String, subtitle: String) -> NSView {
|
|
608
|
578
|
let image = NSImageView()
|
|
609
|
579
|
image.translatesAutoresizingMaskIntoConstraints = false
|
|
|
@@ -633,13 +603,6 @@ private final class PremiumPlansViewController: NSViewController {
|
|
633
|
603
|
return stack
|
|
634
|
604
|
}
|
|
635
|
605
|
|
|
636
|
|
- private func footerLink(_ text: String) -> NSTextField {
|
|
637
|
|
- let label = NSTextField(labelWithString: text)
|
|
638
|
|
- label.font = .systemFont(ofSize: 12, weight: .medium)
|
|
639
|
|
- label.textColor = Theme.secondaryText
|
|
640
|
|
- return label
|
|
641
|
|
- }
|
|
642
|
|
-
|
|
643
|
606
|
private func footerDivider() -> NSBox {
|
|
644
|
607
|
let divider = NSBox()
|
|
645
|
608
|
divider.boxType = .separator
|
|
|
@@ -668,6 +631,31 @@ private final class PremiumPlansViewController: NSViewController {
|
|
668
|
631
|
Task { await restorePurchases() }
|
|
669
|
632
|
}
|
|
670
|
633
|
|
|
|
634
|
+ @objc private func didTapFooterPrivacyPolicy() {
|
|
|
635
|
+ presentFooterPlaceholderAlert(for: "Privacy Policy")
|
|
|
636
|
+ }
|
|
|
637
|
+
|
|
|
638
|
+ @objc private func didTapFooterTermsOfServices() {
|
|
|
639
|
+ presentFooterPlaceholderAlert(for: "Terms of Services")
|
|
|
640
|
+ }
|
|
|
641
|
+
|
|
|
642
|
+ @objc private func didTapFooterSupport() {
|
|
|
643
|
+ presentFooterPlaceholderAlert(for: "Support")
|
|
|
644
|
+ }
|
|
|
645
|
+
|
|
|
646
|
+ private func presentFooterPlaceholderAlert(for featureName: String) {
|
|
|
647
|
+ let alert = NSAlert()
|
|
|
648
|
+ alert.messageText = "\(featureName) coming soon"
|
|
|
649
|
+ alert.informativeText = "This section is a placeholder for now."
|
|
|
650
|
+ alert.alertStyle = .informational
|
|
|
651
|
+ alert.addButton(withTitle: "OK")
|
|
|
652
|
+ if let window = view.window {
|
|
|
653
|
+ alert.beginSheetModal(for: window)
|
|
|
654
|
+ } else {
|
|
|
655
|
+ alert.runModal()
|
|
|
656
|
+ }
|
|
|
657
|
+ }
|
|
|
658
|
+
|
|
671
|
659
|
private func loadStoreProducts() async {
|
|
672
|
660
|
await subscriptionStore.loadProducts()
|
|
673
|
661
|
applyStorePricing()
|