Fix subscription screen hanging on "Loading Subscription"
The .containerRelativeFrame(.horizontal) on the marketing content caused an infinite layout loop inside SubscriptionStoreView's scroll container. Replaced with .frame(maxWidth: .infinity). Also fixes leading space in StoreKit config display name, adds debug logging to product loading, and reverts to groupID initializer. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
import SwiftUI
|
||||
import StoreKit
|
||||
import os.log
|
||||
|
||||
struct ReflectSubscriptionStoreView: View {
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
@@ -27,7 +28,7 @@ struct ReflectSubscriptionStoreView: View {
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
SubscriptionStoreView(productIDs: IAPManager.productIdentifiers) {
|
||||
SubscriptionStoreView(groupID: IAPManager.subscriptionGroupID) {
|
||||
marketingContent
|
||||
}
|
||||
.subscriptionStoreControlStyle(.prominentPicker)
|
||||
@@ -47,6 +48,19 @@ struct ReflectSubscriptionStoreView: View {
|
||||
.accessibilityLabel("Close")
|
||||
}
|
||||
.onAppear {
|
||||
AppLogger.iap.info("SubscriptionStoreView appeared — source: \(source), productIDs: \(IAPManager.productIdentifiers.sorted().joined(separator: ", ")), groupID: \(IAPManager.subscriptionGroupID)")
|
||||
AppLogger.iap.info("IAPManager state — isLoading: \(iapManager.isLoading), products loaded: \(iapManager.availableProducts.count), state: \(String(describing: iapManager.state))")
|
||||
|
||||
// Also try loading products directly to log what StoreKit returns
|
||||
Task {
|
||||
do {
|
||||
let products = try await Product.products(for: IAPManager.productIdentifiers)
|
||||
AppLogger.iap.info("Direct Product.products() returned \(products.count) products: \(products.map { "\($0.id) (\($0.displayName))" }.joined(separator: ", "))")
|
||||
} catch {
|
||||
AppLogger.iap.error("Direct Product.products() FAILED: \(error.localizedDescription)")
|
||||
}
|
||||
}
|
||||
|
||||
AnalyticsManager.shared.trackPaywallViewed(source: source)
|
||||
}
|
||||
.onInAppPurchaseStart { product in
|
||||
@@ -103,7 +117,7 @@ struct ReflectSubscriptionStoreView: View {
|
||||
JournalMarketingContent()
|
||||
}
|
||||
}
|
||||
.containerRelativeFrame(.horizontal)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
|
||||
private var tintColor: Color {
|
||||
|
||||
Reference in New Issue
Block a user