|
|
@@ -515,18 +515,15 @@ private final class PremiumPlansViewController: NSViewController {
|
|
|
)
|
|
|
subscriptionPrimaryFooterButton = primary.button
|
|
|
|
|
|
- let entries: [(text: String, action: Selector?)] = [
|
|
|
+ let entries: [(text: String, action: Selector)] = [
|
|
|
("Restore Purchase", #selector(didTapRestorePurchases)),
|
|
|
- ("Privacy Policy", nil),
|
|
|
- ("Terms of Services", nil),
|
|
|
- ("Support", nil)
|
|
|
+ ("Privacy Policy", #selector(didTapFooterPrivacyPolicy)),
|
|
|
+ ("Terms of Services", #selector(didTapFooterTermsOfServices)),
|
|
|
+ ("Support", #selector(didTapFooterSupport))
|
|
|
]
|
|
|
|
|
|
let cells = [primary.container] + entries.enumerated().map { index, entry in
|
|
|
- if let action = entry.action {
|
|
|
- return footerActionCell(title: entry.text, action: action, showsTrailingDivider: index < entries.count - 1).container
|
|
|
- }
|
|
|
- return footerCell(text: entry.text, showsTrailingDivider: index < entries.count - 1)
|
|
|
+ footerActionCell(title: entry.text, action: entry.action, showsTrailingDivider: index < entries.count - 1).container
|
|
|
}
|
|
|
|
|
|
let links = NSStackView(views: cells)
|
|
|
@@ -577,33 +574,6 @@ private final class PremiumPlansViewController: NSViewController {
|
|
|
subscriptionPrimaryFooterButton?.title = subscriptionPrimaryFooterTitle()
|
|
|
}
|
|
|
|
|
|
- private func footerCell(text: String, showsTrailingDivider: Bool) -> NSView {
|
|
|
- let container = NSView()
|
|
|
- container.translatesAutoresizingMaskIntoConstraints = false
|
|
|
-
|
|
|
- let label = footerLink(text)
|
|
|
- label.translatesAutoresizingMaskIntoConstraints = false
|
|
|
- label.alignment = .center
|
|
|
- container.addSubview(label)
|
|
|
-
|
|
|
- var constraints = [
|
|
|
- label.centerXAnchor.constraint(equalTo: container.centerXAnchor),
|
|
|
- label.centerYAnchor.constraint(equalTo: container.centerYAnchor)
|
|
|
- ]
|
|
|
-
|
|
|
- if showsTrailingDivider {
|
|
|
- let divider = footerDivider()
|
|
|
- container.addSubview(divider)
|
|
|
- constraints.append(contentsOf: [
|
|
|
- divider.trailingAnchor.constraint(equalTo: container.trailingAnchor),
|
|
|
- divider.centerYAnchor.constraint(equalTo: container.centerYAnchor)
|
|
|
- ])
|
|
|
- }
|
|
|
-
|
|
|
- NSLayoutConstraint.activate(constraints)
|
|
|
- return container
|
|
|
- }
|
|
|
-
|
|
|
private func trustBadge(icon: String, title: String, subtitle: String) -> NSView {
|
|
|
let image = NSImageView()
|
|
|
image.translatesAutoresizingMaskIntoConstraints = false
|
|
|
@@ -633,13 +603,6 @@ private final class PremiumPlansViewController: NSViewController {
|
|
|
return stack
|
|
|
}
|
|
|
|
|
|
- private func footerLink(_ text: String) -> NSTextField {
|
|
|
- let label = NSTextField(labelWithString: text)
|
|
|
- label.font = .systemFont(ofSize: 12, weight: .medium)
|
|
|
- label.textColor = Theme.secondaryText
|
|
|
- return label
|
|
|
- }
|
|
|
-
|
|
|
private func footerDivider() -> NSBox {
|
|
|
let divider = NSBox()
|
|
|
divider.boxType = .separator
|
|
|
@@ -668,6 +631,31 @@ private final class PremiumPlansViewController: NSViewController {
|
|
|
Task { await restorePurchases() }
|
|
|
}
|
|
|
|
|
|
+ @objc private func didTapFooterPrivacyPolicy() {
|
|
|
+ presentFooterPlaceholderAlert(for: "Privacy Policy")
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc private func didTapFooterTermsOfServices() {
|
|
|
+ presentFooterPlaceholderAlert(for: "Terms of Services")
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc private func didTapFooterSupport() {
|
|
|
+ presentFooterPlaceholderAlert(for: "Support")
|
|
|
+ }
|
|
|
+
|
|
|
+ private func presentFooterPlaceholderAlert(for featureName: String) {
|
|
|
+ let alert = NSAlert()
|
|
|
+ alert.messageText = "\(featureName) coming soon"
|
|
|
+ alert.informativeText = "This section is a placeholder for now."
|
|
|
+ alert.alertStyle = .informational
|
|
|
+ alert.addButton(withTitle: "OK")
|
|
|
+ if let window = view.window {
|
|
|
+ alert.beginSheetModal(for: window)
|
|
|
+ } else {
|
|
|
+ alert.runModal()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private func loadStoreProducts() async {
|
|
|
await subscriptionStore.loadProducts()
|
|
|
applyStorePricing()
|