diff --git a/Sources/Subscription/AccountManager.swift b/Sources/Subscription/AccountManager.swift index 85e631051..20cf1aa68 100644 --- a/Sources/Subscription/AccountManager.swift +++ b/Sources/Subscription/AccountManager.swift @@ -242,8 +242,13 @@ public class AccountManager: AccountManaging { switch await AuthService.validateToken(accessToken: accessToken) { case .success(let response): let entitlements = response.account.entitlements + if entitlements != cachedEntitlements { - entitlementsCache.set(entitlements) + if entitlements.isEmpty { + entitlementsCache.reset() + } else { + entitlementsCache.set(entitlements) + } NotificationCenter.default.post(name: .entitlementsDidChange, object: self, userInfo: [UserDefaultsCacheKey.subscriptionEntitlements: entitlements]) } return .success(entitlements) diff --git a/Sources/Subscription/UserDefaultsCache.swift b/Sources/Subscription/UserDefaultsCache.swift index 9d7b5de49..ffeee6ffc 100644 --- a/Sources/Subscription/UserDefaultsCache.swift +++ b/Sources/Subscription/UserDefaultsCache.swift @@ -24,7 +24,7 @@ public struct UserDefaultsCacheSettings { // Default expiration interval set to 24 hours public let defaultExpirationInterval: TimeInterval - public init(defaultExpirationInterval: TimeInterval = 24 * 60 * 60) { + public init(defaultExpirationInterval: TimeInterval = 1 * 60 * 60) { self.defaultExpirationInterval = defaultExpirationInterval } }