Skip to content

Commit

Permalink
address requested changes regarding intro text
Browse files Browse the repository at this point in the history
- change shouty NONE to empty
- clean up template string for better readibility and easier maintenance of intro text options
  • Loading branch information
ScottAntonacAP committed Sep 2, 2021
1 parent 74abaa7 commit 0a4e72a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ After setting the total amount the matching breakdown string for the set Afterpa
### Intro Text
Setting `introText` is optional, will default to `or` and must be of type `AfterpayIntroText`.

Can be any of `or`, `orTitle`, `pay`, `payTitle`, `make`, `makeTitle`, `payIn`, `payInTitle`, `in`, `inTitle` or `NONE` (no intro text).
Can be any of `or`, `orTitle`, `pay`, `payTitle`, `make`, `makeTitle`, `payIn`, `payInTitle`, `in`, `inTitle` or `empty` (no intro text).
Intro text will be rendered lowercase unless using an option suffixed with `Title` in which case title case will be rendered.

```swift
Expand Down
2 changes: 1 addition & 1 deletion Sources/Afterpay/Model/PriceBreakdown.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct PriceBreakdown {

if let formattedPayment = formattedPayment, inRange {
badgePlacement = .end
string = String(format: Strings.fourPaymentsFormat, introText.rawValue, formattedPayment)
string = String(format: Strings.fourPaymentsFormat, introText.rawValue, formattedPayment).trimmingCharacters(in: .whitespaces)
} else if let formattedMinimum = formattedMinimum, let formattedMaximum = formattedMaximum {
badgePlacement = .start
string = String(format: Strings.availableBetweenFormat, formattedMinimum, formattedMaximum)
Expand Down
22 changes: 11 additions & 11 deletions Sources/Afterpay/Resources/IntroText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
import Foundation

public enum AfterpayIntroText: String {
case NONE = ""
case make = "make "
case makeTitle = "Make "
case pay = "pay "
case payTitle = "Pay "
case `in` = "in "
case inTitle = "In "
case or = "or "
case orTitle = "Or "
case payIn = "pay in "
case payInTitle = "Pay in "
case empty = ""
case make = "make"
case makeTitle = "Make"
case pay = "pay"
case payTitle = "Pay"
case `in` = "in"
case inTitle = "In"
case or = "or"
case orTitle = "Or"
case payIn = "pay in"
case payInTitle = "Pay in"
}
2 changes: 1 addition & 1 deletion Sources/Afterpay/Resources/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ enum Strings {

static let availableBetweenFormat = "available for orders between %@ - %@"
static let availableUpToFormat = "available for orders up to %@"
static let fourPaymentsFormat = "%@4 interest-free payments of %@ with"
static let fourPaymentsFormat = "%@ 4 interest-free payments of %@ with"

// MARK: - Accessible Strings

Expand Down

0 comments on commit 0a4e72a

Please sign in to comment.