aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compiler/objective_c_generator.cc23
-rw-r--r--src/objective-c/tests/InteropTests.m8
2 files changed, 18 insertions, 13 deletions
diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc
index b235911479..79a84b4a7a 100644
--- a/src/compiler/objective_c_generator.cc
+++ b/src/compiler/objective_c_generator.cc
@@ -68,18 +68,19 @@ void PrintMethodSignature(Printer *printer,
printer->Print(vars, "- ($return_type$)$method_name$With");
if (method->client_streaming()) {
- printer->Print("RequestsWriter:(id<GRXWriter>)request");
+ printer->Print("RequestsWriter:(id<GRXWriter>)requestWriter");
} else {
printer->Print(vars, "Request:($request_class$ *)request");
}
// TODO(jcanizales): Put this on a new line and align colons.
- // TODO(jcanizales): eventHandler for server streaming?
- printer->Print(" handler:(void(^)(");
if (method->server_streaming()) {
- printer->Print("BOOL done, ");
+ printer->Print(vars, " eventHandler:(void(^)(BOOL done, "
+ "$response_class$ *response, NSError *error))eventHandler");
+ } else {
+ printer->Print(vars, " handler:(void(^)($response_class$ *response, "
+ "NSError *error))handler");
}
- printer->Print(vars, "$response_class$ *response, NSError *error))handler");
}
void PrintSimpleSignature(Printer *printer,
@@ -125,11 +126,15 @@ void PrintSimpleImplementation(Printer *printer,
printer->Print("{\n");
printer->Print(vars, " [[self RPCTo$method_name$With");
if (method->client_streaming()) {
- printer->Print("RequestsWriter:request");
+ printer->Print("RequestsWriter:requestWriter");
} else {
printer->Print("Request:request");
}
- printer->Print(" handler:handler] start];\n");
+ if (method->server_streaming()) {
+ printer->Print(" eventHandler:eventHandler] start];\n");
+ } else {
+ printer->Print(" handler:handler] start];\n");
+ }
printer->Print("}\n");
}
@@ -141,7 +146,7 @@ void PrintAdvancedImplementation(Printer *printer,
printer->Print(" requestsWriter:");
if (method->client_streaming()) {
- printer->Print("request\n");
+ printer->Print("requestWriter\n");
} else {
printer->Print("[GRXWriter writerWithValue:request]\n");
}
@@ -150,7 +155,7 @@ void PrintAdvancedImplementation(Printer *printer,
printer->Print(" responsesWriteable:[GRXWriteable ");
if (method->server_streaming()) {
- printer->Print("writeableWithStreamHandler:handler]];\n");
+ printer->Print("writeableWithStreamHandler:eventHandler]];\n");
} else {
printer->Print("writeableWithSingleValueHandler:handler]];\n");
}
diff --git a/src/objective-c/tests/InteropTests.m b/src/objective-c/tests/InteropTests.m
index 684f7c2ff6..74f6b231cf 100644
--- a/src/objective-c/tests/InteropTests.m
+++ b/src/objective-c/tests/InteropTests.m
@@ -174,7 +174,7 @@
__block int index = 0;
[_service streamingOutputCallWithRequest:request
- handler:^(BOOL done,
+ eventHandler:^(BOOL done,
RMTStreamingOutputCallResponse *response,
NSError *error){
XCTAssertNil(error, @"Finished with unexpected error: %@", error);
@@ -211,7 +211,7 @@
[requestsBuffer writeValue:request];
[_service fullDuplexCallWithRequestsWriter:requestsBuffer
- handler:^(BOOL done,
+ eventHandler:^(BOOL done,
RMTStreamingOutputCallResponse *response,
NSError *error) {
XCTAssertNil(error, @"Finished with unexpected error: %@", error);
@@ -242,7 +242,7 @@
- (void)testEmptyStreamRPC {
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"EmptyStream"];
[_service fullDuplexCallWithRequestsWriter:[GRXWriter emptyWriter]
- handler:^(BOOL done,
+ eventHandler:^(BOOL done,
RMTStreamingOutputCallResponse *response,
NSError *error) {
XCTAssertNil(error, @"Finished with unexpected error: %@", error);
@@ -283,7 +283,7 @@
[requestsBuffer writeValue:request];
__block ProtoRPC *call = [_service RPCToFullDuplexCallWithRequestsWriter:requestsBuffer
- handler:^(BOOL done,
+ eventHandler:^(BOOL done,
RMTStreamingOutputCallResponse *response,
NSError *error) {
if (receivedResponse) {