Search in sources :

Example 1 with ApolloCacheInterceptor

use of com.apollographql.apollo.internal.interceptor.ApolloCacheInterceptor in project apollo-android by apollographql.

the class RealApolloCall method prepareInterceptorChain.

private ApolloInterceptorChain prepareInterceptorChain(Operation operation) {
    List<ApolloInterceptor> interceptors = new ArrayList<>();
    HttpCachePolicy.Policy httpCachePolicy = operation instanceof Query ? this.httpCachePolicy : null;
    ResponseFieldMapper responseFieldMapper = responseFieldMapperFactory.create(operation);
    interceptors.addAll(applicationInterceptors);
    interceptors.add(responseFetcher.provideInterceptor(logger));
    interceptors.add(new ApolloCacheInterceptor(apolloStore, responseFieldMapper, dispatcher, logger));
    interceptors.add(new ApolloParseInterceptor(httpCache, apolloStore.networkResponseNormalizer(), responseFieldMapper, scalarTypeAdapters, logger));
    interceptors.add(new ApolloServerInterceptor(serverUrl, httpCallFactory, httpCachePolicy, false, scalarTypeAdapters, logger, sendOperationdIdentifiers));
    return new RealApolloInterceptorChain(interceptors);
}
Also used : ResponseFieldMapper(com.apollographql.apollo.api.ResponseFieldMapper) RealApolloInterceptorChain(com.apollographql.apollo.internal.interceptor.RealApolloInterceptorChain) Query(com.apollographql.apollo.api.Query) ApolloParseInterceptor(com.apollographql.apollo.internal.interceptor.ApolloParseInterceptor) ArrayList(java.util.ArrayList) HttpCachePolicy(com.apollographql.apollo.api.cache.http.HttpCachePolicy) ApolloServerInterceptor(com.apollographql.apollo.internal.interceptor.ApolloServerInterceptor) ApolloInterceptor(com.apollographql.apollo.interceptor.ApolloInterceptor) ApolloCacheInterceptor(com.apollographql.apollo.internal.interceptor.ApolloCacheInterceptor)

Aggregations

Query (com.apollographql.apollo.api.Query)1 ResponseFieldMapper (com.apollographql.apollo.api.ResponseFieldMapper)1 HttpCachePolicy (com.apollographql.apollo.api.cache.http.HttpCachePolicy)1 ApolloInterceptor (com.apollographql.apollo.interceptor.ApolloInterceptor)1 ApolloCacheInterceptor (com.apollographql.apollo.internal.interceptor.ApolloCacheInterceptor)1 ApolloParseInterceptor (com.apollographql.apollo.internal.interceptor.ApolloParseInterceptor)1 ApolloServerInterceptor (com.apollographql.apollo.internal.interceptor.ApolloServerInterceptor)1 RealApolloInterceptorChain (com.apollographql.apollo.internal.interceptor.RealApolloInterceptorChain)1 ArrayList (java.util.ArrayList)1