InterceptorManager Class Reference
public class InterceptorManager : NSObject, InterceptorManagerProtocol
A class that handles some messages from the URLSession. It forwards them to the interceptors along with some other internal network client messages.
-
Initializes the interceptor manager with the provided interceptors and queue.
Declaration
Swift
public required init(interceptors: [RequestInterceptor], queue: TealiumQueue) -
Called when a URL session task is waiting for connectivity.
Declaration
Swift
public func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask) -
Forward the the result of a network request to all the interceptors and perform the
shouldRetrycallback based on theRetryPolicyreturned by the interceptors.Retries are checked in reverse order as it’s assumed that the latest added
RequestInterceptoris a more specific interceptor that has a finer logic compared to the default ones that are added in the beginning.Declaration
Swift
public func interceptResult(request: URLRequest, retryCount: Int, result: NetworkResult, shouldRetry: @escaping (Bool) -> Void)Parameter Description requestthe
URLRequestthat was just completedretryCountthe number of times this request has been retried already (starts from 0)
resultthe
NetworkResultreturned by the clientshouldRetrythe completion block, called when it’s time to retry with
trueor immediately withfalseif the request should not be retried.