diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index c8e74463df..277e5f1653 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -750,7 +750,6 @@ 500FE490288615BA00FA090C /* CachedBadge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 500FE48E2886148800FA090C /* CachedBadge.swift */; }; 500FE4E0288A11B000FA090C /* ConversationViewController+GiftBadges.swift in Sources */ = {isa = PBXBuildFile; fileRef = 500FE4DF288A11AF00FA090C /* ConversationViewController+GiftBadges.swift */; }; 500FE4E2288A373100FA090C /* BadgeGiftingAlreadyRedeemedSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 500FE4E1288A373100FA090C /* BadgeGiftingAlreadyRedeemedSheet.swift */; }; - 500FE5042890510800FA090C /* BadgeGiftingStrings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 500FE5032890510800FA090C /* BadgeGiftingStrings.swift */; }; 5011D1CB293FC7E000064098 /* DomainFrontingCountryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5011D1CA293FC7E000064098 /* DomainFrontingCountryViewController.swift */; }; 5011D1CD29400E7300064098 /* DeviceProvisioningURL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5011D1CC29400E7300064098 /* DeviceProvisioningURL.swift */; }; 50169695291B0627007AD709 /* ContactDiscoveryManagerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50169694291B0627007AD709 /* ContactDiscoveryManagerTest.swift */; }; @@ -3056,7 +3055,6 @@ 500FE48E2886148800FA090C /* CachedBadge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CachedBadge.swift; sourceTree = ""; }; 500FE4DF288A11AF00FA090C /* ConversationViewController+GiftBadges.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ConversationViewController+GiftBadges.swift"; sourceTree = ""; }; 500FE4E1288A373100FA090C /* BadgeGiftingAlreadyRedeemedSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BadgeGiftingAlreadyRedeemedSheet.swift; sourceTree = ""; }; - 500FE5032890510800FA090C /* BadgeGiftingStrings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BadgeGiftingStrings.swift; sourceTree = ""; }; 5011D1CA293FC7E000064098 /* DomainFrontingCountryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DomainFrontingCountryViewController.swift; sourceTree = ""; }; 5011D1CC29400E7300064098 /* DeviceProvisioningURL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceProvisioningURL.swift; sourceTree = ""; }; 50169694291B0627007AD709 /* ContactDiscoveryManagerTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactDiscoveryManagerTest.swift; sourceTree = ""; }; @@ -6061,7 +6059,6 @@ 3428576F26BD8777005A2A96 /* Emoji */, 4CC1ECFA211A553000CC13BE /* AppUpdateNag.swift */, F9B3A92C293553930071EB95 /* ASWebAuthenticationSession+Util.swift */, - 500FE5032890510800FA090C /* BadgeGiftingStrings.swift */, 34F1071F26D005340053EF4D /* BatchUpdate.swift */, 4C751BE423FA0284002A8AF1 /* ContactSupportAlert.swift */, F93461B8291ED28900366682 /* CreditAndDebitCards.swift */, @@ -10170,7 +10167,6 @@ F9D83012282DBB1500399363 /* BadgeGiftingChooseBadgeViewController.swift in Sources */, F9A335CC282F0DEC00B5F5FA /* BadgeGiftingChooseRecipientViewController.swift in Sources */, F9F4DE2A283FDFDA001909ED /* BadgeGiftingConfirmationViewController.swift in Sources */, - 500FE5042890510800FA090C /* BadgeGiftingStrings.swift in Sources */, F95427E6286E042200314EDA /* BadgeGiftingThanksSheet.swift in Sources */, 8880179427430DDB00346E9A /* BadgeThanksSheet.swift in Sources */, 349439D824360D63001045F7 /* BaseGroupMemberViewController.swift in Sources */, diff --git a/Signal/src/ViewControllers/AppSettings/Donations/BadgeGiftingChooseRecipientViewController.swift b/Signal/src/ViewControllers/AppSettings/Donations/BadgeGiftingChooseRecipientViewController.swift index 0d316c3864..1df01121af 100644 --- a/Signal/src/ViewControllers/AppSettings/Donations/BadgeGiftingChooseRecipientViewController.swift +++ b/Signal/src/ViewControllers/AppSettings/Donations/BadgeGiftingChooseRecipientViewController.swift @@ -27,8 +27,10 @@ class BadgeGiftingChooseRecipientViewController: RecipientPickerContainerViewCon public override func viewDidLoad() { super.viewDidLoad() - title = NSLocalizedString("BADGE_GIFTING_CHOOSE_RECIPIENT_TITLE", - comment: "Title on the screen where you choose a gift badge's recipient") + title = NSLocalizedString( + "DONATION_ON_BEHALF_OF_A_FRIEND_CHOOSE_RECIPIENT_TITLE", + comment: "Title on the screen where you choose who you're going to donate on behalf of." + ) recipientPicker.allowsAddByPhoneNumber = false recipientPicker.shouldHideLocalRecipient = true diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController+GiftBadges.swift b/Signal/src/ViewControllers/ConversationView/ConversationViewController+GiftBadges.swift index 88c1ebc72b..93fc837b51 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController+GiftBadges.swift +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController+GiftBadges.swift @@ -121,8 +121,8 @@ extension ConversationViewController { private func showRedeemBadgeLaterText() { let text = NSLocalizedString( - "BADGE_GIFTING_REDEEM_LATER", - comment: "A toast that appears at the bottom of the screen after tapping 'Not Now' when redeeming a gift." + "DONATION_ON_BEHALF_OF_A_FRIEND_REDEEM_BADGE_LATER", + comment: "When you receive a badge as a result of a donation from a friend, a screen is shown. This toast is shown when dismissing that screen if you do not redeem the badge." ) self.presentToastCVC(text) } diff --git a/Signal/src/ViewControllers/Donations/BadgeGiftingAlreadyRedeemedSheet.swift b/Signal/src/ViewControllers/Donations/BadgeGiftingAlreadyRedeemedSheet.swift index 9261509bcc..ca5047e341 100644 --- a/Signal/src/ViewControllers/Donations/BadgeGiftingAlreadyRedeemedSheet.swift +++ b/Signal/src/ViewControllers/Donations/BadgeGiftingAlreadyRedeemedSheet.swift @@ -56,19 +56,27 @@ class BadgeGiftingAlreadyRedeemedSheet: OWSTableSheetViewController { stackView.setCustomSpacing(24, after: badgeImageView) let titleLabel = UILabel() + let titleFormat = NSLocalizedString( + "DONATION_ON_BEHALF_OF_A_FRIEND_REDEEM_BADGE_TITLE_FORMAT", + comment: "A friend has donated on your behalf and you received a badge. A sheet opens for you to redeem this badge. Embeds {{contact's short name, such as a first name}}." + ) titleLabel.font = .ows_dynamicTypeTitle2.ows_semibold titleLabel.textColor = Theme.primaryTextColor titleLabel.textAlignment = .center titleLabel.numberOfLines = 0 - titleLabel.text = BadgeGiftingStrings.giftBadgeTitle + titleLabel.text = String(format: titleFormat, self.shortName) stackView.addArrangedSubview(titleLabel) stackView.setCustomSpacing(12, after: titleLabel) let label = UILabel() + let labelFormat = NSLocalizedString( + "DONATION_ON_BEHALF_OF_A_FRIEND_YOU_RECEIVED_A_BADGE_FORMAT", + comment: "A friend has donated on your behalf and you received a badge. This text says that you received a badge, and from whom. Embeds {{contact's short name, such as a first name}}." + ) label.font = .ows_dynamicTypeBody label.textColor = Theme.primaryTextColor label.numberOfLines = 0 - label.text = BadgeGiftingStrings.youReceived(from: self.shortName) + label.text = String(format: labelFormat, self.shortName) label.textAlignment = .center stackView.addArrangedSubview(label) diff --git a/Signal/src/ViewControllers/Donations/BadgeThanksSheet.swift b/Signal/src/ViewControllers/Donations/BadgeThanksSheet.swift index a26938b402..9d8c923b78 100644 --- a/Signal/src/ViewControllers/Donations/BadgeThanksSheet.swift +++ b/Signal/src/ViewControllers/Donations/BadgeThanksSheet.swift @@ -259,7 +259,11 @@ class BadgeThanksSheet: OWSTableSheetViewController { ) return String(format: formatText, self.badge.localizedName) case let .gift(shortName, _, _): - return BadgeGiftingStrings.youReceived(from: shortName) + let formatText = NSLocalizedString( + "DONATION_ON_BEHALF_OF_A_FRIEND_YOU_RECEIVED_A_BADGE_FORMAT", + comment: "A friend has donated on your behalf and you received a badge. This text says that you received a badge, and from whom. Embeds {{contact's short name, such as a first name}}." + ) + return String(format: formatText, shortName) } } diff --git a/Signal/src/ViewControllers/Donations/DonationViewsUtil.swift b/Signal/src/ViewControllers/Donations/DonationViewsUtil.swift index dec8f18ce3..147a427b09 100644 --- a/Signal/src/ViewControllers/Donations/DonationViewsUtil.swift +++ b/Signal/src/ViewControllers/Donations/DonationViewsUtil.swift @@ -165,8 +165,8 @@ public class GiftBadgeCellView: UIStackView { }() let formattedDurationText = String( format: NSLocalizedString( - "BADGE_GIFTING_ROW_DURATION", - comment: "When gifting a badge, shows how long the badge lasts. Embeds {formatted duration}." + "DONATION_FOR_A_FRIEND_ROW_DURATION", + comment: "When donating on behalf of a friend, a badge will be sent. This shows how long the badge lasts. Embeds {{formatted duration}}." ), formattedDuration ) diff --git a/Signal/src/util/BadgeGiftingStrings.swift b/Signal/src/util/BadgeGiftingStrings.swift deleted file mode 100644 index 09a9efd5a3..0000000000 --- a/Signal/src/util/BadgeGiftingStrings.swift +++ /dev/null @@ -1,25 +0,0 @@ -// -// Copyright 2022 Signal Messenger, LLC -// SPDX-License-Identifier: AGPL-3.0-only -// - -import Foundation - -struct BadgeGiftingStrings { - private init() {} - - static var giftBadgeTitle: String { - NSLocalizedString( - "BADGE_GIFTING_CHAT_TITLE", - comment: "Shown on a gift badge message and when tapping a redeemed gift message to denote the presence of a gift badge." - ) - } - - static func youReceived(from shortName: String) -> String { - let formatText = NSLocalizedString( - "DONATION_ON_BEHALF_OF_A_FRIEND_YOU_RECEIVED_A_BADGE_FORMAT", - comment: "A friend has donated on your behalf and you received a badge. This text says that you received a badge, and from whom. Embeds {{contact's short name, such as a first name}}." - ) - return String(format: formatText, shortName) - } -} diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index bcaade11e4..9558d50f34 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -424,18 +424,6 @@ /* Title for subscription on the badge expiration sheet. */ "BADGE_EXPIRED_SUBSCRIPTION_TITLE" = "Monthly donation canceled"; -/* Shown on a gift badge message and when tapping a redeemed gift message to denote the presence of a gift badge. */ -"BADGE_GIFTING_CHAT_TITLE" = "Gift Badge"; - -/* Title on the screen where you choose a gift badge's recipient */ -"BADGE_GIFTING_CHOOSE_RECIPIENT_TITLE" = "Choose Recipient"; - -/* A toast that appears at the bottom of the screen after tapping 'Not Now' when redeeming a gift. */ -"BADGE_GIFTING_REDEEM_LATER" = "You can redeem your badge later"; - -/* When gifting a badge, shows how long the badge lasts. Embeds {formatted duration}. */ -"BADGE_GIFTING_ROW_DURATION" = "Lasts %@"; - /* String explaining to the user that their subscription badge has expired on the badge expiry sheet. Embeds {failure-specific sentence(s)}. */ "BADGE_SUBSCRIPTION_EXPIRED_BECAUSE_OF_CHARGE_FAILURE_BODY_FORMAT" = "Your recurring monthly donation was canceled. %1$@ Your badge is no longer visible on your profile.\n\nTo continue supporting Signal and to reactivate your badge, update your payment details and donate again."; @@ -1825,6 +1813,9 @@ /* On the donation screen, if you already have a subscription, you'll see a button to update your subscription. This is the text on that button. */ "DONATE_SCREEN_UPDATE_MONTHLY_SUBSCRIPTION_BUTTON" = "Update Subscription"; +/* When donating on behalf of a friend, a badge will be sent. This shows how long the badge lasts. Embeds {{formatted duration}}. */ +"DONATION_FOR_A_FRIEND_ROW_DURATION" = "Lasts %@"; + /* Someone donated on your behalf and you got a badge, which expired. A sheet appears to tell you about this. This is the text on that sheet. */ "DONATION_FROM_A_FRIEND_BADGE_EXPIRED_BODY" = "Your badge has expired and is no longer available to be displayed on your profile."; @@ -1846,6 +1837,9 @@ /* Users can donate on behalf of a friend, and the friend will receive a badge. This is the title on the screen where users choose the badge their friend will receive. */ "DONATION_ON_BEHALF_OF_A_FRIEND_CHOOSE_BADGE_TITLE" = "Donate for a Friend"; +/* Title on the screen where you choose who you're going to donate on behalf of. */ +"DONATION_ON_BEHALF_OF_A_FRIEND_CHOOSE_RECIPIENT_TITLE" = "Choose Recipient"; + /* Users can donate on a friend's behalf. This is the title on the screen where users confirm the donation, and can write a message for the friend. */ "DONATION_ON_BEHALF_OF_A_FRIEND_CONFIRMATION_SCREEN_TITLE" = "Confirm Donation"; @@ -1897,6 +1891,9 @@ /* Label for a button used to redeem a badge that was received as a donation on your behalf. */ "DONATION_ON_BEHALF_OF_A_FRIEND_REDEEM_BADGE" = "Redeem"; +/* When you receive a badge as a result of a donation from a friend, a screen is shown. This toast is shown when dismissing that screen if you do not redeem the badge. */ +"DONATION_ON_BEHALF_OF_A_FRIEND_REDEEM_BADGE_LATER" = "You can redeem your badge later"; + /* A friend has donated on your behalf and you received a badge. A sheet opens for you to redeem this badge. Embeds {{contact's short name, such as a first name}}. */ "DONATION_ON_BEHALF_OF_A_FRIEND_REDEEM_BADGE_TITLE_FORMAT" = "%1$@ made a donation for you";