@@ -20,6 +20,8 @@ final class InPersonPaymentsMenuViewController: UIViewController {
2020 countryCode: viewModel. cardPresentPaymentsConfiguration. countryCode) )
2121 } ( )
2222
23+ private lazy var inPersonPaymentsLearnMoreViewModel = LearnMoreViewModel . inPersonPayments ( )
24+
2325 private let viewModel : InPersonPaymentsMenuViewModel = InPersonPaymentsMenuViewModel ( )
2426
2527 private let cashOnDeliveryToggleRowViewModel : InPersonPaymentsCashOnDeliveryToggleRowViewModel
@@ -41,30 +43,10 @@ final class InPersonPaymentsMenuViewController: UIViewController {
4143
4244 private var activityIndicator : UIActivityIndicatorView ?
4345
44- private var inPersonPaymentsLearnMoreButtonTitle : NSAttributedString ? {
45- let result = NSMutableAttributedString (
46- string: . localizedStringWithFormat(
47- Localization . learnMoreText,
48- Localization . learnMoreLink
49- ) ,
50- attributes: [ . foregroundColor: UIColor . textSubtle]
51- )
52- result. replaceFirstOccurrence (
53- of: Localization . learnMoreLink,
54- with: NSAttributedString (
55- string: Localization . learnMoreLink,
56- attributes: [
57- . foregroundColor: UIColor . textLink
58- ]
59- ) )
60- result. addAttribute ( . font, value: UIFont . footnote, range: NSRange ( location: 0 , length: result. length) )
61- return result
62- }
63-
6446 private var inPersonPaymentsLearnMoreButton : UIButton {
6547 let button = UIButton ( )
6648 button. addTarget ( self , action: #selector( learnMoreAboutInPersonPaymentsButtonWasTapped) , for: . touchUpInside)
67- button. setAttributedTitle ( inPersonPaymentsLearnMoreButtonTitle , for: . normal)
49+ button. setAttributedTitle ( inPersonPaymentsLearnMoreViewModel . learnMoreAttributedString , for: . normal)
6850 button. naturalContentHorizontalAlignment = . leading
6951 button. configuration = UIButton . Configuration. plain ( )
7052
@@ -424,7 +406,7 @@ extension InPersonPaymentsMenuViewController {
424406 }
425407
426408 @objc func learnMoreAboutInPersonPaymentsButtonWasTapped( ) {
427- WebviewHelper . launch ( WooConstants . URLs . inPersonPaymentsLearnMoreWCPay . asURL ( ) , with: self )
409+ WebviewHelper . launch ( inPersonPaymentsLearnMoreViewModel . url , with: self )
428410 }
429411
430412}
@@ -568,19 +550,6 @@ private extension InPersonPaymentsMenuViewController {
568550 This is the link to the website, and forms part of a longer sentence which it should be considered a part of.
569551 """
570552 )
571-
572- static let learnMoreText = NSLocalizedString (
573- " cardPresent.modalScanningForReader.learnMore.text " ,
574- value: " %1$@ about In‑Person Payments " ,
575- comment: """
576- A label prompting users to learn more about In-Person Payments.
577- The hyphen in " In‑Person " is a non-breaking hyphen (U+2011).
578- If your translation of that term also happens to contains a hyphen, please be sure to use the non-breaking hyphen character for it.
579- %1$@ is a placeholder that always replaced with \" Learn more \" string,
580- which should be translated separately and considered part of this sentence.
581- """
582- )
583-
584553 }
585554}
586555
0 commit comments