Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

Commit

Permalink
Update dependencies, test with Xcode 10.3 (#14)
Browse files Browse the repository at this point in the history
Close #9 
Close #10 
Close #12
  • Loading branch information
MaxDesiatov authored Nov 9, 2019
1 parent db76238 commit 72cd684
Show file tree
Hide file tree
Showing 99 changed files with 57 additions and 12,712 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ Carthage/Build
# Note: if you ignore the Pods directory, make sure to uncomment
# `pod install` in .travis.yml
#
# Pods/
Example/Pods
22 changes: 8 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,13 @@

matrix:
include:
- osx_image: xcode10.2
- osx_image: xcode10.3
language: swift
env: TEST_DEVICE='platform=iOS Simulator,OS=12.2,name=iPhone SE'
env: TEST_DEVICE='platform=iOS Simulator,OS=12.4,name=iPhone SE'

# cache: cocoapods
# podfile: Example/Podfile
# before_install:
# - gem install cocoapods # Since Travis is not always on latest version
# - pod install --project-directory=Example
script:
- >
set -o pipefail && xcodebuild test -enableCodeCoverage YES
-workspace Example/ApolloAlamofire.xcworkspace -scheme Example
-sdk iphonesimulator -destination "$TEST_DEVICE" | xcpretty
- pod repo update
- pod lib lint --allow-warnings
cache: cocoapods
podfile: Example/Podfile
before_install:
# - gem install cocoapods # Since Travis is not always on latest version
- pod install --repo-update --project-directory=Example
script: ./build.sh
6 changes: 3 additions & 3 deletions ApolloAlamofire.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Pod::Spec.new do |s|
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!

s.swift_version = '4.2'
s.swift_versions = ['4.2', '5.0', '5.1']
s.description = <<-DESC
This package bundles a `NetworkTransport` implementation that wraps Alamofire
and solves known limitations of Apollo iOS library.
Expand All @@ -40,6 +40,6 @@ and solves known limitations of Apollo iOS library.

# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
s.dependency 'Alamofire', '~> 4.8.2'
s.dependency 'Apollo', '~> 0.10.1'
s.dependency 'Alamofire', '~> 4.9.1'
s.dependency 'Apollo', '~> 0.19.0'
end
26 changes: 21 additions & 5 deletions ApolloAlamofire/Classes/AlamofireTransport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,28 @@ public class AlamofireTransport: NetworkTransport {
let url: URL
public var headers: HTTPHeaders?
public var loggingEnabled: Bool
public var clientName: String
public var clientVersion: String

public init(url: URL, sessionManager: SessionManager = SessionManager.default,
headers: HTTPHeaders? = nil, loggingEnabled: Bool = false) {
public init(
url: URL,
sessionManager: SessionManager = SessionManager.default,
headers: HTTPHeaders? = nil,
loggingEnabled: Bool = false,
clientName: String = "ApolloAlamofire",
clientVersion: String = "0.5.0"
) {
self.sessionManager = sessionManager
self.url = url
self.headers = headers
self.loggingEnabled = loggingEnabled
self.clientName = clientName
self.clientVersion = clientVersion
}

public func send<Operation>(
operation: Operation,
completionHandler: @escaping (GraphQLResponse<Operation>?, Error?) -> ()
completionHandler: @escaping (Swift.Result<GraphQLResponse<Operation>, Error>) -> ()
)
-> Cancellable where Operation: GraphQLOperation {
let vars: JSONEncodable = operation.variables?.mapValues { $0?.jsonValue }
Expand All @@ -44,7 +54,7 @@ public class AlamofireTransport: NetworkTransport {
debugPrint(request)
}
return request.responseJSON { response in
let gqlResult = response.result
let result = response.result
.flatMap { value -> GraphQLResponse<Operation> in
guard let value = value as? JSONObject else {
throw response.error!
Expand All @@ -55,7 +65,13 @@ public class AlamofireTransport: NetworkTransport {
}
return GraphQLResponse(operation: operation, body: value)
}
completionHandler(gqlResult.value, gqlResult.error)

switch result {
case let .failure(error):
completionHandler(.failure(error))
case let .success(value):
completionHandler(.success(value))
}
}.task!
}
}
4 changes: 2 additions & 2 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "apollographql/apollo-ios" ~> 0.10.1
github "Alamofire/Alamofire" ~> 4.8.2
github "apollographql/apollo-ios" ~> 0.19.0
github "Alamofire/Alamofire" ~> 4.9.1
6 changes: 2 additions & 4 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
github "Alamofire/Alamofire" "4.8.2"
github "apollographql/apollo-ios" "0.10.1"
github "daltoniam/Starscream" "3.1.0"
github "stephencelis/SQLite.swift" "0.11.5"
github "Alamofire/Alamofire" "4.9.1"
github "apollographql/apollo-ios" "0.19.0"
22 changes: 11 additions & 11 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
PODS:
- Alamofire (4.8.2)
- Apollo (0.10.1):
- Apollo/Core (= 0.10.1)
- Apollo/Core (0.10.1)
- Alamofire (4.9.1)
- Apollo (0.19.0):
- Apollo/Core (= 0.19.0)
- Apollo/Core (0.19.0)
- ApolloAlamofire (0.5.0):
- Alamofire (~> 4.8.2)
- Apollo (~> 0.10.1)
- Alamofire (~> 4.9.1)
- Apollo (~> 0.19.0)

DEPENDENCIES:
- ApolloAlamofire (from `../`)

SPEC REPOS:
https://github.com/cocoapods/specs.git:
https://github.com/CocoaPods/Specs.git:
- Alamofire
- Apollo

Expand All @@ -20,10 +20,10 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
Alamofire: ae5c501addb7afdbb13687d7f2f722c78734c2d3
Apollo: 4d690a9b2e48e8820182df4b988d7a253e1ee589
ApolloAlamofire: cb21686240a36b3500f3dbd318c88cfd14d15d77
Alamofire: 85e8a02c69d6020a0d734f6054870d7ecb75cf18
Apollo: 4f0fea775a98bba34935764e49d27f2d3b1a5f21
ApolloAlamofire: 450e37668e395d2e5e90d9c7ca5e285916479981

PODFILE CHECKSUM: 3d8d02ef1af8e9f3ad5f5d2ba9652a1dafc83875

COCOAPODS: 1.7.3
COCOAPODS: 1.8.4
19 changes: 0 additions & 19 deletions Example/Pods/Alamofire/LICENSE

This file was deleted.

Loading

0 comments on commit 72cd684

Please sign in to comment.