From bd2290d1fc9d49a18d6a2b6f395900d638a43ae5 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Thu, 11 Feb 2021 23:40:16 +0100 Subject: [PATCH] Tell old purchasers how to redeem full version --- .../App/iOS/Global/SwiftGen+Strings.swift | 2 +- .../App/macOS/Base.lproj/Purchase.storyboard | 48 ++++++++++++++----- .../App/macOS/Global/SwiftGen+Strings.swift | 12 ++++- .../Purchase/PurchaseViewController.swift | 22 ++++++++- Passepartout/App/macOS/en.lproj/App.strings | 2 + Passepartout/App/macOS/it.lproj/App.strings | 2 + 6 files changed, 73 insertions(+), 15 deletions(-) diff --git a/Passepartout/App/iOS/Global/SwiftGen+Strings.swift b/Passepartout/App/iOS/Global/SwiftGen+Strings.swift index 2d27d188..1e72a659 100644 --- a/Passepartout/App/iOS/Global/SwiftGen+Strings.swift +++ b/Passepartout/App/iOS/Global/SwiftGen+Strings.swift @@ -746,7 +746,7 @@ internal enum L10n { internal static let title = L10n.tr("Core", "purchase.title") internal enum Cells { internal enum FullVersion { - /// - All providers (including future ones)\n%@ + /// All providers (including future ones)\n%@ internal static func extraDescription(_ p1: Any) -> String { return L10n.tr("Core", "purchase.cells.full_version.extra_description", String(describing: p1)) } diff --git a/Passepartout/App/macOS/Base.lproj/Purchase.storyboard b/Passepartout/App/macOS/Base.lproj/Purchase.storyboard index 7817f413..a5416959 100644 --- a/Passepartout/App/macOS/Base.lproj/Purchase.storyboard +++ b/Passepartout/App/macOS/Base.lproj/Purchase.storyboard @@ -11,17 +11,17 @@ - + - + - + - + @@ -96,7 +96,7 @@ - + @@ -116,10 +116,10 @@ - + @@ -149,13 +149,25 @@ + + + + + + + + + + + + - + @@ -168,6 +180,8 @@ + + @@ -175,13 +189,23 @@ + + + + + + + + + + - + diff --git a/Passepartout/App/macOS/Global/SwiftGen+Strings.swift b/Passepartout/App/macOS/Global/SwiftGen+Strings.swift index 6ffa75ee..358fbd06 100644 --- a/Passepartout/App/macOS/Global/SwiftGen+Strings.swift +++ b/Passepartout/App/macOS/Global/SwiftGen+Strings.swift @@ -159,6 +159,16 @@ internal enum L10n { } } } + internal enum Purchase { + internal enum Sections { + internal enum Products { + internal enum Footer { + /// If you bought the old macOS app (1.14.0), skip this step. Instead, send your Apple invoice to this address to restore full version: + internal static let macLegacy = L10n.tr("App", "purchase.sections.products.footer.mac_legacy") + } + } + } + } internal enum Service { internal enum Cells { internal enum Addresses { @@ -768,7 +778,7 @@ internal enum L10n { internal static let title = L10n.tr("Core", "purchase.title") internal enum Cells { internal enum FullVersion { - /// - All providers (including future ones)\n%@ + /// All providers (including future ones)\n%@ internal static func extraDescription(_ p1: Any) -> String { return L10n.tr("Core", "purchase.cells.full_version.extra_description", String(describing: p1)) } diff --git a/Passepartout/App/macOS/Scenes/Purchase/PurchaseViewController.swift b/Passepartout/App/macOS/Scenes/Purchase/PurchaseViewController.swift index 32287638..cee1b8b2 100644 --- a/Passepartout/App/macOS/Scenes/Purchase/PurchaseViewController.swift +++ b/Passepartout/App/macOS/Scenes/Purchase/PurchaseViewController.swift @@ -40,6 +40,10 @@ class PurchaseViewController: NSViewController { static let product = NSUserInterfaceItemIdentifier("ProductCellIdentifier") } + private let legacyEmail = "issues+maclegacy@passepartoutvpn.app" + + private lazy var legacyEmailURL = URL(string: "mailto:\(legacyEmail)")! + @IBOutlet private weak var tableView: NSTableView! @IBOutlet private weak var labelFooter: NSTextField! @@ -52,6 +56,8 @@ class PurchaseViewController: NSViewController { @IBOutlet private weak var buttonRestore: NSButton! + @IBOutlet private weak var labelLegacy: NSTextField! + var feature: Product? weak var delegate: PurchaseViewControllerDelegate? @@ -105,6 +111,16 @@ class PurchaseViewController: NSViewController { labelRestore.stringValue = L10n.Core.Purchase.Cells.Restore.description buttonPurchase.title = L10n.Core.Purchase.title buttonRestore.title = L10n.Core.Purchase.Cells.Restore.title + + let legacyEmailLink = NSAttributedString( + string: legacyEmail, + attributes: [.link: legacyEmailURL] + ) + let legacyText = NSMutableAttributedString() + legacyText.append(NSAttributedString(string: L10n.App.Purchase.Sections.Products.Footer.macLegacy)) + legacyText.append(legacyEmailLink) + labelLegacy.attributedStringValue = legacyText + labelLegacy.addGestureRecognizer(NSClickGestureRecognizer(target: self, action: #selector(sendLegacyEmail))) tableView.usesAutomaticRowHeights = true tableView.reloadData() @@ -155,7 +171,11 @@ class PurchaseViewController: NSViewController { self?.dismiss(nil) } } - + + @objc private func sendLegacyEmail() { + NSWorkspace.shared.open(legacyEmailURL) + } + private func purchaseFeature() { guard let sk = skFeature else { return diff --git a/Passepartout/App/macOS/en.lproj/App.strings b/Passepartout/App/macOS/en.lproj/App.strings index 8f636c64..32b73057 100644 --- a/Passepartout/App/macOS/en.lproj/App.strings +++ b/Passepartout/App/macOS/en.lproj/App.strings @@ -71,3 +71,5 @@ "menu.support.title" = "Support"; "menu.quit.title" = "Quit %@"; "menu.quit.messages.confirm" = "The VPN, if enabled, will still run in the background. Do you want to quit?"; + +"purchase.sections.products.footer.mac_legacy" = "If you bought the old macOS app (1.14.0), skip this step. Instead, send your Apple invoice to this address to restore full version: "; diff --git a/Passepartout/App/macOS/it.lproj/App.strings b/Passepartout/App/macOS/it.lproj/App.strings index 1f0688ca..daf1cabe 100644 --- a/Passepartout/App/macOS/it.lproj/App.strings +++ b/Passepartout/App/macOS/it.lproj/App.strings @@ -71,3 +71,5 @@ "menu.support.title" = "Supporto"; "menu.quit.title" = "Esci da %@"; "menu.quit.messages.confirm" = "La VPN, se abilitata, continuerà ad essere attiva in background. Vuoi comunque uscire?"; + +"purchase.sections.products.footer.mac_legacy" = "Se hai acquistato la vecchia app macOS (1.14.0), ignora questo passaggio. Piuttosto, inoltra la tua ricevuta Apple a questo indirizzo per ripristinare la versione completa: ";