Skip to content

Commit

Permalink
Fix the convenience init not to omit the subscriptionAppGroup paramet…
Browse files Browse the repository at this point in the history
…er (#755)

* Change the convenience init

* Get rid of default param value
  • Loading branch information
miasma13 authored Mar 27, 2024
1 parent 8a48f30 commit dfb3574
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Sources/Subscription/AccountManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ public class AccountManager: AccountManaging {
return accessToken != nil
}

public convenience init(accessTokenStorage: SubscriptionTokenStorage) {
public convenience init(subscriptionAppGroup: String, accessTokenStorage: SubscriptionTokenStorage) {
self.init(accessTokenStorage: accessTokenStorage,
entitlementsCache: UserDefaultsCache<[Entitlement]>(key: UserDefaultsCacheKey.subscriptionEntitlements,
entitlementsCache: UserDefaultsCache<[Entitlement]>(subscriptionAppGroup: subscriptionAppGroup,
key: UserDefaultsCacheKey.subscriptionEntitlements,
settings: UserDefaultsCacheSettings(defaultExpirationInterval: .minutes(20))))
}

Expand Down
3 changes: 2 additions & 1 deletion Sources/Subscription/Services/SubscriptionService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public final class SubscriptionService: APIService {
}
}

private static let subscriptionCache = UserDefaultsCache<Subscription>(key: UserDefaultsCacheKey.subscription,
private static let subscriptionCache = UserDefaultsCache<Subscription>(subscriptionAppGroup: nil,
key: UserDefaultsCacheKey.subscription,
settings: UserDefaultsCacheSettings(defaultExpirationInterval: .minutes(20)))

public enum CachePolicy {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Subscription/UserDefaultsCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class UserDefaultsCache<ObjectType: Codable> {

private let key: UserDefaultsCacheKey

public init(subscriptionAppGroup: String? = nil, key: UserDefaultsCacheKey,
public init(subscriptionAppGroup: String?, key: UserDefaultsCacheKey,
settings: UserDefaultsCacheSettings) {
self.subscriptionAppGroup = subscriptionAppGroup
self.key = key
Expand Down

0 comments on commit dfb3574

Please sign in to comment.