mirror of
https://github.com/RevenueCat/purchases-ios
synced 2026-11-10 22:45:55 +05:45
* Update remote config API endpoint contract * fix(remote-config): remove request signing content * feat(remote-config): use opaque manifest token models * fix(remote-config): simplify manifest token model
44 lines
1.2 KiB
Swift
44 lines
1.2 KiB
Swift
//
|
|
// RemoteConfigAPI.swift
|
|
// RevenueCat
|
|
//
|
|
// Created by Rick van der Linden on 27/05/2026.
|
|
// Copyright © 2026 RevenueCat, Inc. All rights reserved.
|
|
|
|
import Foundation
|
|
|
|
class RemoteConfigAPI {
|
|
|
|
typealias RemoteConfigResponseHandler = Backend.ResponseHandler<RCContainer?>
|
|
|
|
private let callbackCache: CallbackCache<RemoteConfigCallback>
|
|
private let backendConfig: BackendConfiguration
|
|
|
|
init(backendConfig: BackendConfiguration) {
|
|
self.backendConfig = backendConfig
|
|
self.callbackCache = .init()
|
|
}
|
|
|
|
func getRemoteConfig(
|
|
request: RemoteConfigRequest = .init(),
|
|
isAppBackgrounded: Bool,
|
|
completion: @escaping RemoteConfigResponseHandler
|
|
) {
|
|
let factory = GetRemoteConfigOperation.createFactory(
|
|
configuration: self.backendConfig,
|
|
callbackCache: self.callbackCache,
|
|
request: request
|
|
)
|
|
|
|
let callback = RemoteConfigCallback(cacheKey: factory.cacheKey, completion: completion)
|
|
let cacheStatus = self.callbackCache.add(callback)
|
|
|
|
self.backendConfig.addCacheableOperation(
|
|
with: factory,
|
|
delay: .default(forBackgroundedApp: isAppBackgrounded),
|
|
cacheStatus: cacheStatus
|
|
)
|
|
}
|
|
|
|
}
|