Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions App/TrialSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ struct TrialStatusSheet: View {
if case .trial(let daysLeft) = Self.tier(store), let started = store.purchases.trialStartedAt {
let proPrice = store.proProduct?.displayPrice
let ends = Entitlement.trialEnd(startedAt: started).formatted(.dateTime.month(.wide).day())
Section {
ForEach(TrialStatusNotice(daysLeft: daysLeft, endsOn: ends, proPrice: proPrice).lines, id: \.self) { Text($0) }
}
// The upgrade or Pro (#962); either way the sheet closes once Pro is owned.
let upgrade = Self.offer(store) == .upgrade
let product = upgrade ? store.upgradeProduct : store.proProduct
Section {
ForEach(TrialStatusNotice(daysLeft: daysLeft, endsOn: ends, proPrice: product?.displayPrice, upgrade: upgrade).lines, id: \.self) { Text($0) }
}
let title = upgrade
? product.map { "Upgrade to Pro, \($0.displayPrice)" } ?? "Upgrade to Pro"
: Paywall(moment: nil, proPrice: proPrice).buyTitle
Expand Down
10 changes: 6 additions & 4 deletions Packages/ShowRecorderKit/Sources/Recording/TrialDisclosure.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,24 @@ public struct TrialDisclosure: Equatable, Sendable {
}

/// What the Trial chip opens during a Trial (#743): what it includes, when it ends, what Free keeps afterward and
/// what Pro costs. The same words as `TrialDisclosure`, with the end date added.
/// what Pro costs, or the upgrade for a pack owner (#968). The same words as `TrialDisclosure`, with the end date
/// added.
public struct TrialStatusNotice: Equatable, Sendable {
public let title = "14-day Trial"
public let lines: [String]

/// - Parameters:
/// - endsOn: the end date, already written for the reader ("October 27").
/// - proPrice: the Pro product's display price; nil until the App Store has it, and the price line waits.
public init(daysLeft: Int, endsOn: String, proPrice: String?) {
/// - proPrice: the offered product's display price; nil until the App Store has it, and the price line waits.
/// - upgrade: the offer is the upgrade to Pro for a pack owner (#968), so `proPrice` is the upgrade's.
public init(daysLeft: Int, endsOn: String, proPrice: String?, upgrade: Bool = false) {
var lines = [
TrialDisclosure.includes,
"Ends \(endsOn), in \(daysLeft) \(daysLeft == 1 ? "day" : "days").",
TrialDisclosure.afterwards,
]
if let proPrice {
lines.append("Pro is a one-time purchase of \(proPrice), shared with your family. Nothing is charged when the Trial ends.")
lines.append("\(upgrade ? "The upgrade to Pro" : "Pro") is a one-time purchase of \(proPrice), shared with your family. Nothing is charged when the Trial ends.")
}
lines.append(TrialDisclosure.showSafe)
self.lines = lines
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ struct TrialTests {
#expect(text.contains("up to 3 Markers per Take"))
#expect(text.contains("never stops"))
#expect(text.contains("$19.99") && text.contains("one-time"))
#expect(notice.lines.contains { $0.hasPrefix("Pro is a one-time purchase of $19.99") }, "full Pro without a pack (#968)")
#expect(!text.contains("—"))
}

Expand All @@ -90,6 +91,13 @@ struct TrialTests {
#expect(Entitlement.tier(ownsPro: false, trialStartedAt: started, now: end) == .free)
}

@Test("A pack owner's notice names the upgrade and its price, not full Pro's (#968)")
func statusNoticeForAPackOwner() {
let lines = TrialStatusNotice(daysLeft: 5, endsOn: "October 31", proPrice: "$12.00", upgrade: true).lines
#expect(lines.contains { $0.hasPrefix("The upgrade to Pro is a one-time purchase of $12.00") })
#expect(!lines.contains { $0.hasPrefix("Pro is") }, "no full Pro price line")
}

@Test("The Free Marker limit in the notice is the real one")
func markerLimitFollowsEntitlement() {
let text = TrialStatusNotice(daysLeft: 3, endsOn: "October 18", proPrice: nil).lines.joined(separator: "\n")
Expand Down
Loading