@MainActor @Observable class RCStoreManager { var hasActiveSubscription: Bool = false var isPurchasing: Bool = false init(apiKey: String) { Task { await restorePurchases() } } private func updateSubscriptionStatus(from customerInfo: CustomerInfo) { let activeEntitlements = customerInfo.entitlements.active hasActiveSubscription = !activeEntitlements.isEmpty } func restorePurchases() async { isLoading = true defer { isLoading = false } do { let customerInfo = try await Purchases.shared.restorePurchases() updateSubscriptionStatus(from: customerInfo) } catch { statusMessage = "Unable to restore purchases: \(error.localizedDescription)" } } }