import Foundation
import Encore
import Combine
import SuperwallKit
class EntitlementManager {
@Published var hasProAccess: Bool = false
private var cancellables = Set<AnyCancellable>()
init() {
// Combine Superwall subscription status with Encore promotional rewards
Publishers.CombineLatest(
Superwall.shared.$subscriptionStatus,
Encore.shared.isActivePublisher(for: .freeTrial()),
)
.map { superwallActive, encoreActive in
// User has pro access if they have an active subscription from ANY source
return superwallActive == .active || encoreActive
}
.assign(to: \.hasProAccess, on: self)
.store(in: &cancellables)
}
}