Skip to content

Commit

Permalink
Use consistent naming with ASC
Browse files Browse the repository at this point in the history
  • Loading branch information
keeshux committed Feb 17, 2025
1 parent c64ff2d commit 77f60e6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ extension AppProduct.Full {
}

extension AppProduct {
public var isFullVersion: Bool {
public var isComplete: Bool {
switch self {
case .Full.Recurring.yearly,
.Full.Recurring.monthly,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ extension IAPManager {
}
return []
}
guard !purchasedProducts.contains(where: \.isFullVersion) else {
guard !purchasedProducts.contains(where: \.isComplete) else {
if asserting {
assertionFailure("Suggesting 'Essentials' to full version purchaser?")
assertionFailure("Suggesting 'Essentials' to complete version purchaser?")
}
return []
}
Expand Down
18 changes: 9 additions & 9 deletions Packages/App/Sources/UILibrary/Views/Paywall/PaywallView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct PaywallView: View {
private var products: [InAppProduct] = []

@State
private var fullProducts: [InAppProduct] = []
private var completeProducts: [InAppProduct] = []

@State
private var purchasingIdentifier: String?
Expand Down Expand Up @@ -91,7 +91,7 @@ private extension PaywallView {
Form {
requiredFeaturesView
productsView
fullProductsView
completeProductsView
restoreView
linksView
}
Expand Down Expand Up @@ -138,8 +138,8 @@ private extension PaywallView {
}
}

var fullProductsView: some View {
fullProducts
var completeProductsView: some View {
completeProducts
.nilIfEmpty
.map { products in
ForEach(products, id: \.productIdentifier) {
Expand Down Expand Up @@ -221,21 +221,21 @@ private extension PaywallView {
guard !rawProducts.isEmpty else {
throw AppError.emptyProducts
}
let rawFullProducts = rawProducts.filter(\.isFullVersion)
let rawCompleteProducts = rawProducts.filter(\.isComplete)

let allProducts = try await iapManager.purchasableProducts(for: rawProducts
.sorted {
$0.productRank < $1.productRank
}
)
var products: [InAppProduct] = []
var fullProducts: [InAppProduct] = []
var completeProducts: [InAppProduct] = []
allProducts.forEach {
guard let raw = AppProduct(rawValue: $0.productIdentifier) else {
return
}
if rawFullProducts.contains(raw) {
fullProducts.append($0)
if rawCompleteProducts.contains(raw) {
completeProducts.append($0)
} else {
products.append($0)
}
Expand All @@ -247,7 +247,7 @@ private extension PaywallView {
}

self.products = products
self.fullProducts = fullProducts
self.completeProducts = completeProducts
} catch {
pp_log(.App.iap, .error, "Unable to load purchasable products: \(error)")
onError(error, dismissing: true)
Expand Down

0 comments on commit 77f60e6

Please sign in to comment.