Files
purchases-ios/Sources/Networking/RemoteConfigAPI.swift
T
Rick 6330937692 feat(remote-config): support RC Container format in network stack and use for remote-config request (#7037)
* feat(remote-config): request RC Container format

* fix(remote-config): handle no content responses

* chore(remote-config): allow snapshot todo

* fix(remote-config): disable response verification

* chore(remote-config): document disabled signing

* refactor(remote-config): parse RC containers in HTTP stack
2026-06-19 14:38:38 +02:00

42 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(
isAppBackgrounded: Bool,
completion: @escaping RemoteConfigResponseHandler
) {
let factory = GetRemoteConfigOperation.createFactory(
configuration: self.backendConfig,
callbackCache: self.callbackCache
)
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
)
}
}