Skip to content

Commit 4deaa58

Browse files
authored
Merge pull request #7 from shingt/apollo-0-53-0
Bump up apollo-ios to 0.53.0
2 parents 0f1817d + 0870750 commit 4deaa58

File tree

4 files changed

+39
-74
lines changed

4 files changed

+39
-74
lines changed

Diff for: GitHub-GraphQL-API-Example-iOS.xcodeproj/project.pbxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@
402402
repositoryURL = "https://github.com/apollographql/apollo-ios.git";
403403
requirement = {
404404
kind = upToNextMinorVersion;
405-
minimumVersion = 0.43.0;
405+
minimumVersion = 0.53.0;
406406
};
407407
};
408408
/* End XCRemoteSwiftPackageReference section */
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,23 @@
11
{
2-
"object": {
3-
"pins": [
4-
{
5-
"package": "Apollo",
6-
"repositoryURL": "https://github.com/apollographql/apollo-ios.git",
7-
"state": {
8-
"branch": null,
9-
"revision": "c6e2f6c7936ea0dcf2f09319fecedcbac2d03350",
10-
"version": "0.43.0"
11-
}
12-
},
13-
{
14-
"package": "InflectorKit",
15-
"repositoryURL": "https://github.com/apollographql/InflectorKit",
16-
"state": {
17-
"branch": null,
18-
"revision": "b1d0099abe36facd198113633f502889842906af",
19-
"version": "0.0.2"
20-
}
21-
},
22-
{
23-
"package": "PathKit",
24-
"repositoryURL": "https://github.com/kylef/PathKit.git",
25-
"state": {
26-
"branch": null,
27-
"revision": "73f8e9dca9b7a3078cb79128217dc8f2e585a511",
28-
"version": "1.0.0"
29-
}
30-
},
31-
{
32-
"package": "Spectre",
33-
"repositoryURL": "https://github.com/kylef/Spectre.git",
34-
"state": {
35-
"branch": null,
36-
"revision": "f79d4ecbf8bc4e1579fbd86c3e1d652fb6876c53",
37-
"version": "0.9.2"
38-
}
39-
},
40-
{
41-
"package": "SQLite.swift",
42-
"repositoryURL": "https://github.com/stephencelis/SQLite.swift.git",
43-
"state": {
44-
"branch": null,
45-
"revision": "0a9893ec030501a3956bee572d6b4fdd3ae158a1",
46-
"version": "0.12.2"
47-
}
48-
},
49-
{
50-
"package": "Starscream",
51-
"repositoryURL": "https://github.com/daltoniam/Starscream",
52-
"state": {
53-
"branch": null,
54-
"revision": "df8d82047f6654d8e4b655d1b1525c64e1059d21",
55-
"version": "4.0.4"
56-
}
57-
},
58-
{
59-
"package": "Stencil",
60-
"repositoryURL": "https://github.com/stencilproject/Stencil.git",
61-
"state": {
62-
"branch": null,
63-
"revision": "973e190edf5d09274e4a6bc2e636c86899ed84c3",
64-
"version": "0.14.1"
65-
}
2+
"pins" : [
3+
{
4+
"identity" : "apollo-ios",
5+
"kind" : "remoteSourceControl",
6+
"location" : "https://github.com/apollographql/apollo-ios.git",
7+
"state" : {
8+
"revision" : "42646f765d22dac0f22bfff48590102195c76da4",
9+
"version" : "0.53.0"
6610
}
67-
]
68-
},
69-
"version": 1
11+
},
12+
{
13+
"identity" : "sqlite.swift",
14+
"kind" : "remoteSourceControl",
15+
"location" : "https://github.com/stephencelis/SQLite.swift.git",
16+
"state" : {
17+
"revision" : "4d543d811ee644fa4cc4bfa0be996b4dd6ba0f54",
18+
"version" : "0.13.3"
19+
}
20+
}
21+
],
22+
"version" : 2
7023
}

Diff for: GitHub-GraphQL-API-Example-iOS/API.swift

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public final class SearchRepositoriesQuery: GraphQLQuery {
1616
node {
1717
__typename
1818
... on Repository {
19+
__typename
1920
...RepositoryDetails
2021
}
2122
}
@@ -220,6 +221,7 @@ public final class SearchRepositoriesQuery: GraphQLQuery {
220221

221222
public static var selections: [GraphQLSelection] {
222223
return [
224+
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
223225
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
224226
GraphQLFragmentSpread(RepositoryDetails.self),
225227
]

Diff for: GitHub-GraphQL-API-Example-iOS/RepositoriesViewController.swift

+16-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Apollo
33

44
private let token = "YOUR_TOKEN"
55

6-
class TokenAddingInterceptor: ApolloInterceptor {
6+
final class TokenAddingInterceptor: ApolloInterceptor {
77
func interceptAsync<Operation: GraphQLOperation>(
88
chain: RequestChain,
99
request: HTTPRequest<Operation>,
@@ -14,11 +14,21 @@ class TokenAddingInterceptor: ApolloInterceptor {
1414
}
1515
}
1616

17-
class NetworkInterceptorProvider: LegacyInterceptorProvider {
18-
override func interceptors<Operation: GraphQLOperation>(for operation: Operation) -> [ApolloInterceptor] {
19-
var interceptors = super.interceptors(for: operation)
20-
interceptors.insert(TokenAddingInterceptor(), at: 0)
21-
return interceptors
17+
final class NetworkInterceptorProvider: InterceptorProvider {
18+
private let client: URLSessionClient
19+
private let store: ApolloStore
20+
21+
init(client: URLSessionClient, store: ApolloStore) {
22+
self.client = client
23+
self.store = store
24+
}
25+
26+
func interceptors<Operation>(for operation: Operation) -> [ApolloInterceptor] where Operation : GraphQLOperation {
27+
[
28+
TokenAddingInterceptor(),
29+
NetworkFetchInterceptor(client: self.client),
30+
JSONResponseParsingInterceptor(cacheKeyForObject: self.store.cacheKeyForObject),
31+
]
2232
}
2333
}
2434

0 commit comments

Comments
 (0)