Split Apple TV purchase (#467)
Full version features were listed when purchasing the Apple TV feature, and this was very misleading.
This commit is contained in:
parent
917e712510
commit
3fb521a584
|
@ -60,7 +60,7 @@ struct AddProviderView: View {
|
|||
themeCloseItem(isPresented: bindings.$isPresented)
|
||||
}.sheet(isPresented: $viewModel.isPaywallPresented) {
|
||||
NavigationView {
|
||||
PaywallView(isPresented: $viewModel.isPaywallPresented)
|
||||
PaywallView(isPresented: $viewModel.isPaywallPresented, feature: .allProviders)
|
||||
}.themeGlobal()
|
||||
}.navigationTitle(L10n.AddProfile.Shared.title)
|
||||
.themeSecondaryView()
|
||||
|
|
|
@ -54,9 +54,11 @@ extension PaywallView {
|
|||
|
||||
var body: some View {
|
||||
List {
|
||||
if feature != .appleTV {
|
||||
skFullVersion.map {
|
||||
fullFeaturesSection(withHeader: $0.localizedTitle)
|
||||
}
|
||||
}
|
||||
purchaseSection
|
||||
.disabled(purchaseState != nil)
|
||||
restoreSection
|
||||
|
|
|
@ -31,9 +31,9 @@ struct PaywallView: View {
|
|||
|
||||
@Binding private var isPresented: Bool
|
||||
|
||||
private let feature: LocalProduct?
|
||||
private let feature: LocalProduct
|
||||
|
||||
init<MT>(modalType: Binding<MT?>, feature: LocalProduct? = nil) {
|
||||
init<MT>(modalType: Binding<MT?>, feature: LocalProduct) {
|
||||
let isPresented = Binding<Bool> {
|
||||
modalType.wrappedValue != nil
|
||||
} set: {
|
||||
|
@ -44,7 +44,7 @@ struct PaywallView: View {
|
|||
self.init(isPresented: isPresented, feature: feature)
|
||||
}
|
||||
|
||||
init(isPresented: Binding<Bool>, feature: LocalProduct? = nil) {
|
||||
init(isPresented: Binding<Bool>, feature: LocalProduct) {
|
||||
productManager = .shared
|
||||
_isPresented = isPresented
|
||||
self.feature = feature
|
||||
|
|
|
@ -301,7 +301,15 @@ extension ProductManager {
|
|||
// purchased platform -> may only purchase other platform
|
||||
|
||||
public func purchasableProducts(withFeature feature: LocalProduct?) -> [LocalProduct] {
|
||||
var products: [LocalProduct] = {
|
||||
|
||||
// separate purchase
|
||||
guard feature != .appleTV else {
|
||||
if hasPurchased(.appleTV) {
|
||||
return []
|
||||
}
|
||||
return [.appleTV]
|
||||
}
|
||||
|
||||
if hasPurchased(.fullVersion) {
|
||||
return []
|
||||
}
|
||||
|
@ -322,11 +330,6 @@ extension ProductManager {
|
|||
}
|
||||
return [.fullVersion, .fullVersion_iOS]
|
||||
#endif
|
||||
}()
|
||||
if feature == .appleTV && !hasPurchased(.appleTV) {
|
||||
products.append(.appleTV)
|
||||
}
|
||||
return products
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -223,7 +223,7 @@ final class ProductManagerTests: XCTestCase {
|
|||
reader.setReceipt(withBuild: 1500, products: [])
|
||||
let sut = ProductManager(inApp: inApp, receiptReader: reader, buildProducts: noBuildProducts)
|
||||
|
||||
XCTAssertTrue(sut.purchasableProducts(withFeature: .appleTV).contains(.appleTV))
|
||||
XCTAssertEqual(sut.purchasableProducts(withFeature: .appleTV), [.appleTV])
|
||||
}
|
||||
|
||||
func test_givenAppleTV_whenDidPurchase_thenCannotPurchase() {
|
||||
|
@ -231,6 +231,6 @@ final class ProductManagerTests: XCTestCase {
|
|||
reader.setReceipt(withBuild: 1500, products: [.appleTV])
|
||||
let sut = ProductManager(inApp: inApp, receiptReader: reader, buildProducts: noBuildProducts)
|
||||
|
||||
XCTAssertFalse(sut.purchasableProducts(withFeature: .appleTV).contains(.appleTV))
|
||||
XCTAssertEqual(sut.purchasableProducts(withFeature: .appleTV), [])
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue