Replace full version description with bullets

This commit is contained in:
Davide De Rosa 2019-11-09 18:03:07 +01:00
parent ebb486b6de
commit 6e0ad83520
4 changed files with 18 additions and 16 deletions

View File

@ -82,6 +82,12 @@ internal enum L10n {
/// Purchase
internal static let title = L10n.tr("App", "purchase.title")
internal enum Cells {
internal enum FullVersion {
/// \n- All providers (including those being added in the future)\n%@
internal static func extraDescription(_ p1: String) -> String {
return L10n.tr("App", "purchase.cells.full_version.extra_description", p1)
}
}
internal enum Restore {
/// If you bought this app or feature in the past, you can restore your purchases and this screen won't show again.
internal static let description = L10n.tr("App", "purchase.cells.restore.description")
@ -91,10 +97,8 @@ internal enum L10n {
}
internal enum Sections {
internal enum Products {
/// Every product is a one-time purchase.\n\n%@ entails:\n\n- All providers (including those being added in the future)\n%@
internal static func footer(_ p1: String, _ p2: String) -> String {
return L10n.tr("App", "purchase.sections.products.footer", p1, p2)
}
/// Every product is a one-time purchase.
internal static let footer = L10n.tr("App", "purchase.sections.products.footer")
}
}
}

View File

@ -61,6 +61,7 @@
"shortcuts.edit.cells.add_shortcut.caption" = "Add shortcut";
"purchase.title" = "Purchase";
"purchase.sections.products.footer" = "Every product is a one-time purchase.\n\n%@ entails:\n\n- All providers (including those being added in the future)\n%@";
"purchase.sections.products.footer" = "Every product is a one-time purchase.";
"purchase.cells.full_version.extra_description" = "- All providers (including those being added in the future)\n%@";
"purchase.cells.restore.title" = "Restore purchases";
"purchase.cells.restore.description" = "If you bought this app or feature in the past, you can restore your purchases and this screen won't show again.";

View File

@ -40,10 +40,10 @@ class PurchaseTableViewCell: UITableViewCell {
labelPrice?.applyAccent(.current)
}
func fill(product: SKProduct) {
func fill(product: SKProduct, customDescription: String? = nil) {
fill(
title: product.localizedTitle,
description: "\(product.localizedDescription)."
description: customDescription ?? "\(product.localizedDescription)."
)
labelPrice?.text = product.localizedPrice
}

View File

@ -38,17 +38,18 @@ class PurchaseViewController: UITableViewController, StrongTableHost {
private var skFeature: SKProduct?
private var skFullVersion: SKProduct?
private var fullVersionExtra: String?
// MARK: StrongTableHost
var model: StrongTableModel<SectionType, RowType> = StrongTableModel()
func reloadModel() {
let fullVersionString: String
model.clear()
model.add(.products)
model.setFooter(L10n.App.Purchase.Sections.Products.footer, forSection: .products)
var rows: [RowType] = []
let pm = ProductManager.shared
if let skFeature = pm.product(withIdentifier: feature) {
@ -58,10 +59,6 @@ class PurchaseViewController: UITableViewController, StrongTableHost {
if let skFullVersion = pm.product(withIdentifier: .fullVersion) {
self.skFullVersion = skFullVersion
rows.append(.fullVersion)
fullVersionString = skFullVersion.localizedTitle
} else {
fullVersionString = "Full version" // XXX
}
rows.append(.restore)
model.set(rows, forSection: .products)
@ -70,7 +67,7 @@ class PurchaseViewController: UITableViewController, StrongTableHost {
return "- \($0.localizedTitle)"
}.sortedCaseInsensitive()
let featureBullets = featureBulletsList.joined(separator: "\n")
model.setFooter(L10n.App.Purchase.Sections.Products.footer(fullVersionString, featureBullets), forSection: .products)
fullVersionExtra = L10n.App.Purchase.Cells.FullVersion.extraDescription(featureBullets)
}
// MARK: UIViewController
@ -196,7 +193,7 @@ extension PurchaseViewController {
guard let product = skFullVersion else {
fatalError("Loaded full version cell, yet no corresponding product?")
}
cell.fill(product: product)
cell.fill(product: product, customDescription: fullVersionExtra)
case .restore:
cell.fill(