Fix a few issues with badge expiration body text
The Boost case used `String(format:...)` even though there aren’t any string replacements in the body text. We should avoid formatting strings that don’t have format specifiers. There was also a typo in the localized string key. This also separates the monthly donation call to action string so that it can be reused for gift badges.
This commit is contained in:
parent
455adf2119
commit
67a96cfc55
@ -65,11 +65,14 @@ public class BadgeExpirationSheetState {
|
||||
}
|
||||
}()
|
||||
|
||||
public lazy var body: Body = {
|
||||
func format(_ formatText: String) -> String {
|
||||
String(format: formatText, badge.localizedName)
|
||||
}
|
||||
private var monthlyDonationCallToAction: String {
|
||||
NSLocalizedString(
|
||||
"BADGE_EXPIRED_MONTHLY_CALL_TO_ACTION",
|
||||
comment: "Shown when a non-monthly badge expires to suggest starting a recurring donation."
|
||||
)
|
||||
}
|
||||
|
||||
public lazy var body: Body = {
|
||||
switch mode {
|
||||
case let .subscriptionExpiredBecauseOfChargeFailure(chargeFailure):
|
||||
let failureSpecificText = Self.getChargeFailureSpecificText(chargeFailure: chargeFailure)
|
||||
@ -79,17 +82,22 @@ public class BadgeExpirationSheetState {
|
||||
case .subscriptionExpiredBecauseNotRenewed:
|
||||
let formatText = NSLocalizedString("BADGE_SUBSCRIPTION_EXPIRED_BECAUSE_OF_INACTIVITY_BODY_FORMAT",
|
||||
comment: "Body of the sheet shown when your subscription is canceled due to inactivity")
|
||||
return Body(format(formatText), hasLearnMoreLink: true)
|
||||
return Body(String(format: formatText, badge.localizedName), hasLearnMoreLink: true)
|
||||
case let .boostExpired(hasCurrentSubscription):
|
||||
let formatText: String
|
||||
var bodyText = [String]()
|
||||
if hasCurrentSubscription {
|
||||
formatText = NSLocalizedString("BADGE_EXIPRED_BOOST_CURRENT_SUSTAINER_BODY_FORMAT",
|
||||
comment: "String explaining to the user that their boost badge has expired while they are a current subscription sustainer on the badge expiry sheet.")
|
||||
bodyText.append(NSLocalizedString(
|
||||
"BADGE_EXPIRED_BOOST_CURRENT_SUSTAINER_BODY",
|
||||
comment: "String explaining to the user that their boost badge has expired while they are a current subscription sustainer on the badge expiry sheet."
|
||||
))
|
||||
} else {
|
||||
formatText = NSLocalizedString("BADGE_EXIPRED_BOOST_BODY_FORMAT",
|
||||
comment: "String explaining to the user that their boost badge has expired on the badge expiry sheet.")
|
||||
bodyText.append(NSLocalizedString(
|
||||
"BADGE_EXPIRED_BOOST_BODY",
|
||||
comment: "String explaining to the user that their boost badge has expired on the badge expiry sheet."
|
||||
))
|
||||
bodyText.append(self.monthlyDonationCallToAction)
|
||||
}
|
||||
return Body(format(formatText))
|
||||
return Body(bodyText.joined(separator: "\n\n"))
|
||||
}
|
||||
}()
|
||||
|
||||
|
||||
@ -138,13 +138,16 @@ class BadgeExpirationSheetStateTest: XCTestCase {
|
||||
),
|
||||
(
|
||||
State(badge: getSubscriptionBadge(), mode: .boostExpired(hasCurrentSubscription: false)),
|
||||
NSLocalizedString("BADGE_EXIPRED_BOOST_BODY_FORMAT",
|
||||
comment: "String explaining to the user that their boost badge has expired on the badge expiry sheet."),
|
||||
NSLocalizedString("BADGE_EXPIRED_BOOST_BODY",
|
||||
comment: "String explaining to the user that their boost badge has expired on the badge expiry sheet.")
|
||||
+ "\n\n"
|
||||
+ NSLocalizedString("BADGE_EXPIRED_MONTHLY_CALL_TO_ACTION",
|
||||
comment: "Shown when a non-monthly badge expires to suggest starting a recurring donation."),
|
||||
false
|
||||
),
|
||||
(
|
||||
State(badge: getSubscriptionBadge(), mode: .boostExpired(hasCurrentSubscription: true)),
|
||||
NSLocalizedString("BADGE_EXIPRED_BOOST_CURRENT_SUSTAINER_BODY_FORMAT",
|
||||
NSLocalizedString("BADGE_EXPIRED_BOOST_CURRENT_SUSTAINER_BODY",
|
||||
comment: "String explaining to the user that their boost badge has expired while they are a current subscription sustainer on the badge expiry sheet."),
|
||||
false
|
||||
)
|
||||
|
||||
@ -368,10 +368,10 @@
|
||||
"BADGE_DETAILS_GIVE_A_BOOST" = "Give Signal a Boost";
|
||||
|
||||
/* String explaining to the user that their boost badge has expired on the badge expiry sheet. */
|
||||
"BADGE_EXIPRED_BOOST_BODY_FORMAT" = "Your Boost badge has expired and is no longer available to be displayed on your profile.\n\nYou can keep using Signal but to support technology that is built for you, consider becoming a sustainer by making a monthly donation.";
|
||||
"BADGE_EXPIRED_BOOST_BODY" = "Your Boost badge has expired and is no longer available to be displayed on your profile.";
|
||||
|
||||
/* String explaining to the user that their boost badge has expired while they are a current subscription sustainer on the badge expiry sheet. */
|
||||
"BADGE_EXIPRED_BOOST_CURRENT_SUSTAINER_BODY_FORMAT" = "Your Boost badge has expired and is no longer available to be displayed on your profile.\n\nYou can reactivate your Boost badge for another 30 days with a one-time contribution.";
|
||||
"BADGE_EXPIRED_BOOST_CURRENT_SUSTAINER_BODY" = "Your Boost badge has expired and is no longer available to be displayed on your profile.\n\nYou can reactivate your Boost badge for another 30 days with a one-time contribution.";
|
||||
|
||||
/* Button title for boost on the badge expiration sheet, used if the user is not already a sustainer. */
|
||||
"BADGE_EXPIRED_BOOST_RENEWAL_BUTTON" = "Become a Sustainer";
|
||||
@ -385,6 +385,9 @@
|
||||
/* Text for the 'learn more' link in the badge expiration sheet, shown when a badge expires due to a charge failure */
|
||||
"BADGE_EXPIRED_LEARN_MORE_LINK" = "Learn more.";
|
||||
|
||||
/* Shown when a non-monthly badge expires to suggest starting a recurring donation. */
|
||||
"BADGE_EXPIRED_MONTHLY_CALL_TO_ACTION" = "You can keep using Signal but to support technology that is built for you, consider becoming a sustainer by making a monthly donation.";
|
||||
|
||||
/* Button text when a badge expires, asking you to renew your subscription */
|
||||
"BADGE_EXPIRED_SUBSCRIPTION_RENEWAL_BUTTON" = "Renew Subscription";
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user