Files
purchases-ios/Sources/Networking/BackendConfiguration.swift
T
Joshua Liebowitz 80905f94c9 Extract Backend dependencies into a BackendConfiguration object (#1696)
Extract out various dependencies that are required to instantiate the `Backend` object.

Refactor to assist with the next few PRs that extract out other pieces
See [CSDK-82]
Resolves [CSDK-155]
2022-06-14 15:12:46 -07:00

39 lines
1005 B
Swift

//
// Copyright RevenueCat Inc. All Rights Reserved.
//
// Licensed under the MIT License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/MIT
//
// BackendConfiguration.swift
//
// Created by Joshua Liebowitz on 6/13/22.
import Foundation
class BackendConfiguration {
let httpClient: HTTPClient
let callbackQueue: DispatchQueue
let operationQueue: OperationQueue
let dateProvider: DateProvider
init(httpClient: HTTPClient,
operationQueue: OperationQueue,
callbackQueue: DispatchQueue = DispatchQueue(label: "Backend callbackQueue"),
dateProvider: DateProvider = DateProvider()) {
self.httpClient = httpClient
self.operationQueue = operationQueue
self.callbackQueue = callbackQueue
self.dateProvider = dateProvider
}
func clearCache() {
self.httpClient.clearCaches()
}
}