Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions Apollo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
9B260BF9245A030100562176 /* ResponseCodeInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B260BF8245A030100562176 /* ResponseCodeInterceptor.swift */; };
9B260BFB245A031900562176 /* NetworkFetchInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B260BFA245A031900562176 /* NetworkFetchInterceptor.swift */; };
9B260BFF245A054700562176 /* JSONRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B260BFE245A054700562176 /* JSONRequest.swift */; };
9B260C01245A059700562176 /* CodableParsingInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B260C00245A059700562176 /* CodableParsingInterceptor.swift */; };
9B260C04245A090600562176 /* RequestChainNetworkTransport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B260C03245A090600562176 /* RequestChainNetworkTransport.swift */; };
9B260C08245A437400562176 /* InterceptorProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B260C07245A437400562176 /* InterceptorProvider.swift */; };
9B260C0A245A532500562176 /* LegacyParsingInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B260C09245A532500562176 /* LegacyParsingInterceptor.swift */; };
Expand Down Expand Up @@ -577,7 +576,6 @@
9B260BF8245A030100562176 /* ResponseCodeInterceptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResponseCodeInterceptor.swift; sourceTree = "<group>"; };
9B260BFA245A031900562176 /* NetworkFetchInterceptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkFetchInterceptor.swift; sourceTree = "<group>"; };
9B260BFE245A054700562176 /* JSONRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONRequest.swift; sourceTree = "<group>"; };
9B260C00245A059700562176 /* CodableParsingInterceptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodableParsingInterceptor.swift; sourceTree = "<group>"; };
9B260C03245A090600562176 /* RequestChainNetworkTransport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestChainNetworkTransport.swift; sourceTree = "<group>"; };
9B260C07245A437400562176 /* InterceptorProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InterceptorProvider.swift; sourceTree = "<group>"; };
9B260C09245A532500562176 /* LegacyParsingInterceptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegacyParsingInterceptor.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1150,7 +1148,6 @@
9B260BE9245A01B900562176 /* Interceptor */ = {
isa = PBXGroup;
children = (
9BC742B024D09F9E0029282C /* Codable */,
9BC742AF24D09F880029282C /* Legacy */,
9B260BEA245A020300562176 /* ApolloInterceptor.swift */,
9BC742AB24CFB2FF0029282C /* ApolloErrorInterceptor.swift */,
Expand Down Expand Up @@ -1431,14 +1428,6 @@
name = Legacy;
sourceTree = "<group>";
};
9BC742B024D09F9E0029282C /* Codable */ = {
isa = PBXGroup;
children = (
9B260C00245A059700562176 /* CodableParsingInterceptor.swift */,
);
name = Codable;
sourceTree = "<group>";
};
9BCB585D240758B2002F766E /* Extensions */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -2739,7 +2728,6 @@
9B260BEB245A020300562176 /* ApolloInterceptor.swift in Sources */,
54DDB0921EA045870009DD99 /* InMemoryNormalizedCache.swift in Sources */,
9FC9A9C51E2D6CE70023C4D5 /* GraphQLSelectionSet.swift in Sources */,
9B260C01245A059700562176 /* CodableParsingInterceptor.swift in Sources */,
9B554CC4247DC29A002F452A /* TaskData.swift in Sources */,
9B9BBAF524DB4F890021C30F /* AutomaticPersistedQueryInterceptor.swift in Sources */,
9BA1244A22D8A8EA00BF1D24 /* JSONSerialization+Sorting.swift in Sources */,
Expand Down
54 changes: 0 additions & 54 deletions Sources/Apollo/CodableParsingInterceptor.swift

This file was deleted.

47 changes: 0 additions & 47 deletions Sources/Apollo/InterceptorProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,50 +70,3 @@ open class LegacyInterceptorProvider: InterceptorProvider {
return nil
}
}

// MARK: - Default implementation for swift codegen


/// The default interceptor provider for code generated with Swift Codegen™
open class CodableInterceptorProvider<FlexDecoder: FlexibleDecoder>: InterceptorProvider {

private let client: URLSessionClient
private let shouldInvalidateClientOnDeinit: Bool
private let decoder: FlexDecoder

/// Designated initializer
///
/// - Parameters:
/// - client: The URLSessionClient to use. Defaults to the default setup.
/// - shouldInvalidateClientOnDeinit: If the passed-in client should be invalidated when this interceptor provider is deinitialized. If you are recreating the `URLSessionClient` every time you create a new provider, you should do this to prevent memory leaks. Defaults to true, since by default we provide a `URLSessionClient` to new instances.
/// - decoder: A `FlexibleDecoder` which can decode `Codable` objects.
public init(client: URLSessionClient = URLSessionClient(),
shouldInvalidateClientOnDeinit: Bool = true,
decoder: FlexDecoder) {
self.client = client
self.shouldInvalidateClientOnDeinit = shouldInvalidateClientOnDeinit
self.decoder = decoder
}

deinit {
if self.shouldInvalidateClientOnDeinit {
self.client.invalidate()
}
}

open func interceptors<Operation: GraphQLOperation>(for operation: Operation) -> [ApolloInterceptor] {
return [
MaxRetryInterceptor(),
// Swift Codegen Phase 2: Add Cache Read interceptor
NetworkFetchInterceptor(client: self.client),
ResponseCodeInterceptor(),
AutomaticPersistedQueryInterceptor(),
CodableParsingInterceptor(decoder: self.decoder),
// Swift codegen Phase 2: Add Cache Write interceptor
]
}

open func additionalErrorInterceptor<Operation: GraphQLOperation>(for operation: Operation) -> ApolloErrorInterceptor? {
return nil
}
}