From 5d552006af45fa72bdeb059261dd5337a7816a64 Mon Sep 17 00:00:00 2001 From: Kyle Hickinson Date: Tue, 22 Oct 2019 16:33:21 -0400 Subject: [PATCH] Fix #1765, Fix #1744: Adds missing JP rewards UI updates - "Grants" -> "Details" on wallet header - "Your wallet" -> "Your balance" in wallet header - "wallet balance" -> "balance" in tipping view - "tokens" -> "points" - "BAT" -> "BAT Points" where missed --- BraveRewardsUI/Extensions/LocaleExtensions.swift | 2 +- BraveRewardsUI/Localized Strings/Strings.swift | 8 ++++++-- .../Details/AutoContributeDetailsViewController.swift | 4 ++-- .../Settings/Grants/SettingsGrantSectionView.swift | 2 +- BraveRewardsUI/Tipping/InsufficientFundsButton.swift | 2 +- BraveRewardsUI/Tipping/TippingSelectionView.swift | 2 +- .../Tipping/TippingSelectionViewController.swift | 2 +- .../Notifications/RewardsNotificationViewBuilder.swift | 3 ++- BraveRewardsUI/Wallet/WalletHeaderView.swift | 4 ++-- BraveShared/BraveStrings.swift | 1 + .../Browser/Onboarding/OnboardingRewardsView.swift | 8 +++++++- 11 files changed, 25 insertions(+), 13 deletions(-) diff --git a/BraveRewardsUI/Extensions/LocaleExtensions.swift b/BraveRewardsUI/Extensions/LocaleExtensions.swift index 346c85837..93638261e 100644 --- a/BraveRewardsUI/Extensions/LocaleExtensions.swift +++ b/BraveRewardsUI/Extensions/LocaleExtensions.swift @@ -6,7 +6,7 @@ import Foundation extension Locale { /// Whether or not the current users region and language is set to JP - var isJapan: Bool { + public var isJapan: Bool { return regionCode == "JP" } } diff --git a/BraveRewardsUI/Localized Strings/Strings.swift b/BraveRewardsUI/Localized Strings/Strings.swift index 241f73682..5cb7d46d8 100644 --- a/BraveRewardsUI/Localized Strings/Strings.swift +++ b/BraveRewardsUI/Localized Strings/Strings.swift @@ -20,6 +20,7 @@ internal extension Strings { static let RewardsOptInLearnMore = NSLocalizedString("RewardsOptInLearnMore", bundle: Bundle.RewardsUI, value: "Learn More", comment: "") static let SettingsAdsBody = NSLocalizedString("BraveRewardsSettingsAdsBody", bundle: Bundle.RewardsUI, value: "Earn tokens by viewing ads in Brave. Ads presented are based on your interests, as inferred from your browsing behavior. No personal data or browsing history ever leaves your browser.", comment: "") static let WalletHeaderGrants = NSLocalizedString("BraveRewardsWalletHeaderGrants", bundle: Bundle.RewardsUI, value: "Grants", comment: "") + static let WalletHeaderGrantsJapan = NSLocalizedString("BraveRewardsWalletHeaderDetails", bundle: Bundle.RewardsUI, value: "Details", comment: "") static let SettingsTitle = NSLocalizedString("BraveRewardsSettingsTitle", bundle: Bundle.RewardsUI, value: "Settings", comment: "") static let Tips = NSLocalizedString("BraveRewardsTips", bundle: Bundle.RewardsUI, value: "Tips", comment: "") static let SettingsAutoContributeTitle = NSLocalizedString("BraveRewardsSettingsAutoContributeTitle", bundle: Bundle.RewardsUI, value: "Auto-Contribute", comment: "") @@ -54,6 +55,7 @@ internal extension Strings { static let BraveRewards = NSLocalizedString("BraveRewards", bundle: Bundle.RewardsUI, value: "Brave Rewards™", comment: "") static let PublisherSendTip = NSLocalizedString("BraveRewardsPublisherSendTip", bundle: Bundle.RewardsUI, value: "Send a tip…", comment: "") static let TippingWalletBalanceTitle = NSLocalizedString("BraveRewardsTippingWalletBalanceTitle", bundle: Bundle.RewardsUI, value: "wallet balance", comment: "") + static let TippingWalletBalanceTitleJapan = NSLocalizedString("BraveRewardsTippingBalanceTitle", bundle: Bundle.RewardsUI, value: "balance", comment: "") static let LearnMoreSubtitle = NSLocalizedString("BraveRewardsLearnMoreSubtitle", bundle: Bundle.RewardsUI, value: "Get Rewarded for Browsing!", comment: "") static let TippingAmountTitle = NSLocalizedString("BraveRewardsTippingAmountTitle", bundle: Bundle.RewardsUI, value: "Tip amount", comment: "") static let MinimumLengthChoices2 = NSLocalizedString("BraveRewardsMinimumLengthChoices2", bundle: Bundle.RewardsUI, value: "1 minute", comment: "") @@ -92,7 +94,8 @@ internal extension Strings { static let AutoContributeMonthlyPayment = NSLocalizedString("BraveRewardsAutoContributeMonthlyPayment", bundle: Bundle.RewardsUI, value: "Monthly payment", comment: "") static let Tokens = NSLocalizedString("BraveRewardsTokens", bundle: Bundle.RewardsUI, value: "Tokens", comment: "") static let LearnMoreTurnOnRewardsBody = NSLocalizedString("BraveRewardsLearnMoreTurnOnRewardsBody", bundle: Bundle.RewardsUI, value: "This enables both ads and automatic contributions. You can turn them on or off separately at any time.", comment: "") - static let TippingNotEnoughTokens = NSLocalizedString("BraveRewardsTippingNotEnoughTokens", bundle: Bundle.RewardsUI, value: "Not enough tokens. Please add funds.", comment: "") + static let TippingNotEnoughTokens = NSLocalizedString("BraveRewardsTippingNotEnoughTokens", bundle: Bundle.RewardsUI, value: "Not enough tokens.", comment: "") + static let TippingNotEnoughTokensJapan = NSLocalizedString("BraveRewardsTippingNotEnoughPoints", bundle: Bundle.RewardsUI, value: "Not enough points.", comment: "") static let TippingOverviewTitle = NSLocalizedString("BraveRewardsTippingOverviewTitle", bundle: Bundle.RewardsUI, value: "Welcome!", comment: "") static let LearnMoreTipsTitle = NSLocalizedString("BraveRewardsLearnMoreTipsTitle", bundle: Bundle.RewardsUI, value: "Auto-Contribute", comment: "") static let TippingConfirmation = NSLocalizedString("BraveRewardsTippingConfirmation", bundle: Bundle.RewardsUI, value: "Thank you", comment: "") @@ -125,6 +128,7 @@ internal extension Strings { static let CreatingWallet = NSLocalizedString("BraveRewardsCreatingWallet", bundle: Bundle.RewardsUI, value: "Creating wallet", comment: "") static let RewardsOptInDescription = NSLocalizedString("RewardsOptInDescription", bundle: Bundle.RewardsUI, value: "You can now earn tokens for watching privacy-respecting ads.", comment: "") static let WalletHeaderTitle = NSLocalizedString("BraveRewardsWalletHeaderTitle", bundle: Bundle.RewardsUI, value: "Your wallet", comment: "") + static let WalletHeaderTitleJapan = NSLocalizedString("BraveRewardsWalletHeaderTitleJapan", bundle: Bundle.RewardsUI, value: "Your balance", comment: "") static let TipsTotalThisMonth = NSLocalizedString("BraveRewardsTipsTotalThisMonth", bundle: Bundle.RewardsUI, value: "Total tips this month", comment: "") static let TippingTitle = NSLocalizedString("BraveRewardsTippingTitle", bundle: Bundle.RewardsUI, value: "Send a tip", comment: "") static let GrantsClaimedExpirationDateTitle = NSLocalizedString("BraveRewardsGrantsClaimedExpirationDateTitle", bundle: Bundle.RewardsUI, value: "Grant Expiration Date", comment: "") @@ -172,7 +176,7 @@ internal extension Strings { static let NotificationAutoContributeNotEnoughFundsBody = NSLocalizedString("NotificationAutoContributeNotEnoughFundsBody", bundle: Bundle.RewardsUI, value: "Your scheduled monthly payment for Auto-Contribute and monthly tips could not be completed due to insufficient funds. We’ll try again in 30 days.", comment: "We show this string in the notification when you don't have enough funds for contribution") static let NotificationContributeTipError = NSLocalizedString("NotificationContributeTipError", bundle: Bundle.RewardsUI, value: "Unable to send your tip. Please try again later.", comment: "We show this string in notification when tip fails") static let NotificationContributeError = NSLocalizedString("NotificationContributeError", bundle: Bundle.RewardsUI, value: "There was a problem processing your contribution.", comment: "We show this string in notification when contribution fails") - static let NotificationContributeSuccess = NSLocalizedString("NotificationContributeSuccess", bundle: Bundle.RewardsUI, value: "You've contributed %@ BAT", comment: "We show this string in the notification when contribution is successful") + static let NotificationContributeSuccess = NSLocalizedString("NotificationContributeSuccess", bundle: Bundle.RewardsUI, value: "You've contributed %@", comment: "We show this string in the notification when contribution is successful") static let NotificationBraveAdsLaunchMsg = NSLocalizedString("NotificationBraveAdsLaunchMsg", bundle: Bundle.RewardsUI, value: "Now you can earn by viewing ads.", comment: "Message for ads launch notification") static let NotificationContributeNotificationError = NSLocalizedString("NotificationContributeNotificationError", bundle: Bundle.RewardsUI, value: "There was a problem processing your contribution.", comment: "We show this string in notification when contribution fails") static let NotificationPendingNotEnoughFunds = NSLocalizedString("NotificationPendingNotEnoughFunds", bundle: Bundle.RewardsUI, value: "You have pending tips due to insufficient funds", comment: "Notification text that tells user his wallet is under funded for pending contribution to complete") diff --git a/BraveRewardsUI/Settings/Auto-Contribute/Details/AutoContributeDetailsViewController.swift b/BraveRewardsUI/Settings/Auto-Contribute/Details/AutoContributeDetailsViewController.swift index a7208f428..ee583f437 100644 --- a/BraveRewardsUI/Settings/Auto-Contribute/Details/AutoContributeDetailsViewController.swift +++ b/BraveRewardsUI/Settings/Auto-Contribute/Details/AutoContributeDetailsViewController.swift @@ -176,7 +176,7 @@ extension AutoContributeDetailViewController: UITableViewDataSource, UITableView let choices = wallet.parametersChoices.map { $0.doubleValue } let selectedIndex = choices.firstIndex(of: monthlyPayment) ?? 0 let stringChoices = choices.map { choice -> String in - var amount = "\(choice) BAT" + var amount = "\(choice) \(Strings.BAT)" if let dollarRate = state.ledger.dollarStringForBATAmount(choice) { amount.append(" (\(dollarRate))") } @@ -297,7 +297,7 @@ extension AutoContributeDetailViewController: UITableViewDataSource, UITableView cell.label.text = Strings.AutoContributeMonthlyPayment cell.accessoryType = .disclosureIndicator if let dollarAmount = state.ledger.dollarStringForBATAmount(state.ledger.contributionAmount) { - cell.accessoryLabel?.text = "\(state.ledger.contributionAmount) BAT (\(dollarAmount))" + cell.accessoryLabel?.text = "\(state.ledger.contributionAmount) \(Strings.BAT) (\(dollarAmount))" } cell.selectionStyle = .default case .nextContribution: diff --git a/BraveRewardsUI/Settings/Grants/SettingsGrantSectionView.swift b/BraveRewardsUI/Settings/Grants/SettingsGrantSectionView.swift index b72e281a2..9a7b5a9ac 100644 --- a/BraveRewardsUI/Settings/Grants/SettingsGrantSectionView.swift +++ b/BraveRewardsUI/Settings/Grants/SettingsGrantSectionView.swift @@ -37,7 +37,7 @@ class SettingsGrantSectionView: SettingsSectionView { case .ads(let amount): iconImageView.image = UIImage(frameworkResourceNamed: "icn-ads") if let amount = amount { - textLabel.text = String(format: Strings.SettingsAdsGrantText, "\(amount) BAT ") + textLabel.text = String(format: Strings.SettingsAdsGrantText, "\(amount) \(Strings.BAT) ") } else { textLabel.text = Strings.SettingsAdsGrantText } diff --git a/BraveRewardsUI/Tipping/InsufficientFundsButton.swift b/BraveRewardsUI/Tipping/InsufficientFundsButton.swift index 100f19610..5f9e64cc3 100644 --- a/BraveRewardsUI/Tipping/InsufficientFundsButton.swift +++ b/BraveRewardsUI/Tipping/InsufficientFundsButton.swift @@ -25,7 +25,7 @@ class InsufficientFundsButton: UIControl { $0.appearanceTextColor = .white $0.font = .systemFont(ofSize: 13.0) $0.numberOfLines = 0 - $0.text = Strings.TippingNotEnoughTokens + $0.text = Locale.current.isJapan ? Strings.TippingNotEnoughTokensJapan : Strings.TippingNotEnoughTokens $0.setContentCompressionResistancePriority(.required, for: .horizontal) } diff --git a/BraveRewardsUI/Tipping/TippingSelectionView.swift b/BraveRewardsUI/Tipping/TippingSelectionView.swift index c153c5969..31681286a 100644 --- a/BraveRewardsUI/Tipping/TippingSelectionView.swift +++ b/BraveRewardsUI/Tipping/TippingSelectionView.swift @@ -212,7 +212,7 @@ extension TippingSelectionView { let titleLabel = UILabel().then { $0.appearanceTextColor = Colors.blurple700 $0.font = .systemFont(ofSize: 12.0) - $0.text = Strings.TippingWalletBalanceTitle + $0.text = Locale.current.isJapan ? Strings.TippingWalletBalanceTitleJapan : Strings.TippingWalletBalanceTitle } let valueLabel = UILabel().then { $0.appearanceTextColor = .white diff --git a/BraveRewardsUI/Tipping/TippingSelectionViewController.swift b/BraveRewardsUI/Tipping/TippingSelectionViewController.swift index a3f7544f1..389cc10e9 100644 --- a/BraveRewardsUI/Tipping/TippingSelectionViewController.swift +++ b/BraveRewardsUI/Tipping/TippingSelectionViewController.swift @@ -34,7 +34,7 @@ class BATValueOptionsSelectionViewController: OptionsSelectionViewController