Fix subscription screen: use product IDs and add close button
- Switch from groupID to productIDs for more reliable product loading - Add dismiss button overlay so users aren't trapped if products fail to load - Make productIdentifiers static for shared access Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -49,7 +49,7 @@ class IAPManager: ObservableObject {
|
||||
|
||||
static let subscriptionGroupID = "21951685"
|
||||
|
||||
private let productIdentifiers: Set<String> = [
|
||||
static let productIdentifiers: Set<String> = [
|
||||
"com.88oakapps.reflect.IAP.subscriptions.monthly",
|
||||
"com.88oakapps.reflect.IAP.subscriptions.yearly"
|
||||
]
|
||||
@@ -267,7 +267,7 @@ class IAPManager: ObservableObject {
|
||||
|
||||
private func loadProducts() async {
|
||||
do {
|
||||
let products = try await Product.products(for: productIdentifiers)
|
||||
let products = try await Product.products(for: Self.productIdentifiers)
|
||||
availableProducts = products.filter { $0.type == .autoRenewable }
|
||||
} catch {
|
||||
AppLogger.iap.error("Failed to load products: \(error.localizedDescription)")
|
||||
@@ -284,7 +284,7 @@ class IAPManager: ObservableObject {
|
||||
if transaction.revocationDate != nil { continue }
|
||||
|
||||
// Check if this is one of our subscription products
|
||||
guard productIdentifiers.contains(transaction.productID) else { continue }
|
||||
guard Self.productIdentifiers.contains(transaction.productID) else { continue }
|
||||
|
||||
// Get the product for this transaction
|
||||
currentProduct = availableProducts.first { $0.id == transaction.productID }
|
||||
|
||||
Reference in New Issue
Block a user