Files
purchases-ios/Sources/Networking/RemoteConfigAPI.swift
T
Rick 9b9e7fce02 feat(remote-config): update request and response models according to spec (#7022)
* 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
2026-06-24 10:36:57 +02:00

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
)
}
}