diff --git a/App/TrialSheet.swift b/App/TrialSheet.swift index 526ffec8..4b4a6165 100644 --- a/App/TrialSheet.swift +++ b/App/TrialSheet.swift @@ -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 diff --git a/Packages/ShowRecorderKit/Sources/Recording/TrialDisclosure.swift b/Packages/ShowRecorderKit/Sources/Recording/TrialDisclosure.swift index 379fee5b..1c153d2c 100644 --- a/Packages/ShowRecorderKit/Sources/Recording/TrialDisclosure.swift +++ b/Packages/ShowRecorderKit/Sources/Recording/TrialDisclosure.swift @@ -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 diff --git a/Packages/ShowRecorderKit/Tests/RecordingTests/TrialTests.swift b/Packages/ShowRecorderKit/Tests/RecordingTests/TrialTests.swift index 067994ec..51f81b53 100644 --- a/Packages/ShowRecorderKit/Tests/RecordingTests/TrialTests.swift +++ b/Packages/ShowRecorderKit/Tests/RecordingTests/TrialTests.swift @@ -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("—")) } @@ -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")