Skip to content

Commit

Permalink
Removed PsiCash product description UI
Browse files Browse the repository at this point in the history
  • Loading branch information
adotkhan committed Oct 28, 2022
1 parent 7e19643 commit eeadc9a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Psiphon/ProductRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ var viewModel: PsiCashPurchasableViewModel? {
'\(product.productID)' is not a supported product
""")
}
guard let title = formatter.string(from: psiCashProductID.psiCashAmount) else {
guard let formattedPsiCashAmount = formatter.string(from: psiCashProductID.psiCashAmount) else {
return .parseError(reason:
"Failed to format '\(psiCashProductID.psiCashAmount)' into string")
}
return .purchasable(
PsiCashPurchasableViewModel(
product: .product(product),
title: title,
title: UserStrings.PsiCash_with_amount(formattedPsiCashAmount),
subtitle: product.localizedDescription,
localizedPrice: product.price,
clearedForSale: true
Expand Down
8 changes: 8 additions & 0 deletions Psiphon/UserStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ import Foundation
return "PsiCash"
}

@objc static func PsiCash_with_amount(_ amount: String) -> String {
let format = NSLocalizedString("PSICASH_WITH_AMOUNT", tableName: nil, bundle: .main,
value: "%@ PsiCash",
comment: "Do not translate or transliterate 'PsiCash'. PsiCash is a unit of currency here. Reorder the format specifier '%@' if in the translated language ordering of unit and amount is different from English.")

return String.localizedStringWithFormat(format, amount);
}

static func PsiCash_balance() -> String {
return NSLocalizedString("PSICASH_BALANCE", tableName: nil, bundle: Bundle.main,
value: "PsiCash Balance:",
Expand Down
7 changes: 1 addition & 6 deletions Psiphon/View/PsiCashView/PsiCashCoinPurchaseTable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ fileprivate final class PurchaseCellContent: UIView, Bindable {
private let bottomPad: Float = -14
private let priceFormatter: CurrencyFormatter
private let titleLabel: UILabel
private let subtitleLabel: UILabel
private let button: GradientButton
private let spinner: UIActivityIndicatorView
private let clickHandler: (PsiCashPurchasableViewModel.ProductType) -> Void
Expand All @@ -183,7 +182,6 @@ fileprivate final class PurchaseCellContent: UIView, Bindable {
self.clickHandler = clickHandler

titleLabel = UILabel.make(fontSize: .h3, typeface: .bold)
subtitleLabel = UILabel.make(fontSize: .subtitle, numberOfLines: 0)
button = GradientButton(shadow: .light, contentShadow: false, gradient: .grey)
spinner = .init(style: .gray)
super.init(frame: .zero)
Expand Down Expand Up @@ -226,8 +224,7 @@ fileprivate final class PurchaseCellContent: UIView, Bindable {
}

titleStack.addArrangedSubviews(
titleLabel,
subtitleLabel
titleLabel
)

hStack.addArrangedSubviews(
Expand Down Expand Up @@ -280,11 +277,9 @@ fileprivate final class PurchaseCellContent: UIView, Bindable {
// Forces title and subtitle text alignment, since they may not have translations.
if case .rightToLeft = UIApplication.shared.userInterfaceLayoutDirection {
titleLabel.textAlignment = .right
subtitleLabel.textAlignment = .right
}

titleLabel.text = newValue.title
subtitleLabel.text = newValue.subtitle

button.setEventHandler { [unowned self] in
self.clickHandler(newValue.product)
Expand Down
3 changes: 3 additions & 0 deletions Shared/Strings/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,9 @@
/* Message when the user has made a purchase, and paid successfully, however the transaction is not complete yet and is pending verification */
"PSICASH_WAIT_TRANSACTION_VERIFIED" = "Please wait while your transaction is being verified";

/* Do not translate or transliterate 'PsiCash'. PsiCash is a unit of currency here. Reorder the format specifier '%@' if in the translated language ordering of unit and amount is different from English. */
"PSICASH_WITH_AMOUNT" = "%@ PsiCash";

/* Alert message informing user that a Psiphon connection is required */
"PSIPHON_CONNECTION_REQUIRED" = "Psiphon Connection Required";

Expand Down

0 comments on commit eeadc9a

Please sign in to comment.