Skip to content

Commit

Permalink
Merge pull request #69 from mdiep/workaround-for-SR-4253
Browse files Browse the repository at this point in the history
Work around SR-4253 by removing RequestType protocol
  • Loading branch information
mdiep authored Apr 12, 2017
2 parents c3394f5 + 36f0ecb commit a124906
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ matrix:
env: XCODE_ACTION="build-for-testing test-without-building"
- xcode_scheme: Tentacle-iOS
env: XCODE_ACTION="build-for-testing test-without-building"
- xcode_scheme: Tentacle-OSX
env: XCODE_ACTION="build-for-testing test-without-building"
osx_image: xcode8.3
- xcode_scheme: Tentacle-iOS
env: XCODE_ACTION="build-for-testing test-without-building"
osx_image: xcode8.3
- xcode_scheme: update-test-fixtures
env: XCODE_ACTION=build
- before_script: true
Expand Down
8 changes: 4 additions & 4 deletions Sources/Tentacle/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ extension URLRequest {
return request
}

internal static func create<Request: RequestType>(_ url: URL, _ request: Request, _ method: HTTPMethod, _ credentials: Client.Credentials?, contentType: String? = Client.APIContentType) -> URLRequest {
internal static func create(_ url: URL, _ file: File, _ method: HTTPMethod, _ credentials: Client.Credentials?, contentType: String? = Client.APIContentType) -> URLRequest {
var URLRequest = create(url, credentials, contentType: contentType)
URLRequest.httpMethod = method.rawValue

let object = request.encode().JSONObject()
let object = file.encode().JSONObject()
if let payload = try? JSONSerialization.data(withJSONObject: object, options: []) {
URLRequest.httpBody = payload
}
Expand Down Expand Up @@ -435,8 +435,8 @@ public final class Client {
}
}

internal func send<Request: RequestType>(_ request: Request, to endpoint: Endpoint, using method: HTTPMethod) -> SignalProducer<(Response, Request.Response), Error> where Request.Response == Request.Response.DecodedType {
let urlRequest = URLRequest.create(URL(server, endpoint), request, method, credentials)
internal func send(_ file: File, to endpoint: Endpoint, using method: HTTPMethod) -> SignalProducer<(Response, FileResponse), Error> {
let urlRequest = URLRequest.create(URL(server, endpoint), file, method, credentials)

return fetch(urlRequest)
.attemptMap { response, JSON in
Expand Down
4 changes: 1 addition & 3 deletions Sources/Tentacle/File.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ public struct File {
}
}

extension File: RequestType {
public typealias Response = FileResponse

extension File: Encodable, Hashable {
public var hashValue: Int {
return message.hashValue
}
Expand Down
4 changes: 0 additions & 4 deletions Sources/Tentacle/ResourceType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,3 @@ import Argo
public protocol ResourceType: Decodable, Hashable {
static func decode(_ json: JSON) -> Decoded<Self>
}

public protocol RequestType: Encodable, Hashable {
associatedtype Response: Decodable
}
4 changes: 2 additions & 2 deletions script/cibuild
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ my ($WORKSPACE, $SCHEME, $ACTION) = @ARGV;

my $buildSettings = qx{xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -showBuildSettings};

my @args = ("-workspace", $WORKSPACE, "-scheme", $SCHEME, split(/\s+/, $ACTION), "CODE_SIGNING_REQUIRED=NO", "CODE_SIGN_IDENTITY=");
my @args = ("-workspace", $WORKSPACE, "-scheme", $SCHEME, "-configuration", "Release", split(/\s+/, $ACTION), "CODE_SIGNING_REQUIRED=NO", "CODE_SIGN_IDENTITY=", "ENABLE_TESTABILITY=YES");

if ($buildSettings =~ /\bPLATFORM_NAME = iphoneos/i) {
unshift @args, "-destination", "id=31E6604A-19AA-4B68-B560-C33C584BC80D"; # iPhone 6s, iOS 10.2
unshift @args, "-destination", "name=iPhone 6s";
unshift @args, "-sdk", "iphonesimulator";
}

Expand Down

0 comments on commit a124906

Please sign in to comment.