diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 4a4e5beb9ca..723180be19b 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -69,7 +69,7 @@ Pod::Spec.new do |s| ss.dependency 'Protobuf', '~> 3.0' ss.source_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.m", - "src/objective-c/ProtoRPC/ProtoServiceLegacy.{h,m}" + "src/objective-c/ProtoRPC/ProtoServiceLegacy.m" end # CFStream is now default. Leaving this subspec only for compatibility purpose. diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc index 682cc28b739..a08064a08bd 100644 --- a/src/compiler/objective_c_plugin.cc +++ b/src/compiler/objective_c_plugin.cc @@ -138,9 +138,7 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { } ::grpc::string system_imports = - (generator_params.no_v1_compatibility - ? SystemImport("ProtoRPC/ProtoService.h") - : SystemImport("ProtoRPC/ProtoServiceLegacy.h")) + + SystemImport("ProtoRPC/ProtoService.h") + (generator_params.no_v1_compatibility ? SystemImport("ProtoRPC/ProtoRPC.h") : SystemImport("ProtoRPC/ProtoRPCLegacy.h")); diff --git a/src/objective-c/BUILD b/src/objective-c/BUILD index 9e0181d9e98..2af1d85f290 100644 --- a/src/objective-c/BUILD +++ b/src/objective-c/BUILD @@ -168,9 +168,6 @@ grpc_objc_library( "ProtoRPC/ProtoRPCLegacy.m", "ProtoRPC/ProtoServiceLegacy.m", ], - hdrs = [ - "ProtoRPC/ProtoServiceLegacy.h", - ], deps = [ ":rx_library", ":proto_objc_rpc_v2", diff --git a/src/objective-c/GRPCClient/GRPCCallOptions.h b/src/objective-c/GRPCClient/GRPCCallOptions.h index d4a60a2a1c7..d01c8285662 100644 --- a/src/objective-c/GRPCClient/GRPCCallOptions.h +++ b/src/objective-c/GRPCClient/GRPCCallOptions.h @@ -24,19 +24,6 @@ NS_ASSUME_NONNULL_BEGIN @protocol GRPCInterceptorFactory; -/** - * Implement this protocol to provide a token to gRPC when a call is initiated. - */ -@protocol GRPCAuthorizationProtocol - -/** - * This method is called when gRPC is about to start the call. When OAuth token is acquired, - * \a handler is expected to be called with \a token being the new token to be used for this call. - */ -- (void)getTokenWithHandler:(void (^)(NSString *_Nullable token))handler; - -@end - @interface GRPCCallOptions : NSObject // Call parameters diff --git a/src/objective-c/GRPCClient/GRPCTypes.h b/src/objective-c/GRPCClient/GRPCTypes.h index 0aacf0f9d15..8e66d3d3acb 100644 --- a/src/objective-c/GRPCClient/GRPCTypes.h +++ b/src/objective-c/GRPCClient/GRPCTypes.h @@ -172,3 +172,16 @@ extern NSString* const kGRPCTrailersKey; /** The id of a transport implementation. */ typedef char* GRPCTransportId; + +/** + * Implement this protocol to provide a token to gRPC when a call is initiated. + */ +@protocol GRPCAuthorizationProtocol + +/** + * This method is called when gRPC is about to start the call. When OAuth token is acquired, + * \a handler is expected to be called with \a token being the new token to be used for this call. + */ +- (void)getTokenWithHandler:(void (^)(NSString* _Nullable token))handler; + +@end diff --git a/src/objective-c/ProtoRPC/ProtoService.h b/src/objective-c/ProtoRPC/ProtoService.h index 34aea380668..8543f5dee43 100644 --- a/src/objective-c/ProtoRPC/ProtoService.h +++ b/src/objective-c/ProtoRPC/ProtoService.h @@ -26,6 +26,7 @@ @class GRPCUnaryProtoCall; @class GRPCStreamingProtoCall; @protocol GRPCProtoResponseHandler; +@protocol GRXWriteable; #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wnullability-completeness" @@ -49,6 +50,18 @@ __attribute__((deprecated("Please use GRPCProtoService."))) @interface ProtoServ callOptions:(nullable GRPCCallOptions *)callOptions responseClass:(nonnull Class)responseClass; +@end + + @interface ProtoService(Legacy) + + - (instancetype)initWithHost : (NSString *)host packageName + : (NSString *)packageName serviceName : (NSString *)serviceName; + +- (GRPCProtoCall *)RPCToMethod:(NSString *)method + requestsWriter:(GRXWriter *)requestsWriter + responseClass:(Class)responseClass + responsesWriteable:(id)responsesWriteable; + @end #pragma clang diagnostic pop diff --git a/src/objective-c/ProtoRPC/ProtoServiceLegacy.h b/src/objective-c/ProtoRPC/ProtoServiceLegacy.h index 28686f51e37..7b0b7a4de7e 100644 --- a/src/objective-c/ProtoRPC/ProtoServiceLegacy.h +++ b/src/objective-c/ProtoRPC/ProtoServiceLegacy.h @@ -21,16 +21,3 @@ @class GRPCProtoCall; @class GRXWriter; @protocol GRXWriteable; - -@interface ProtoService (Legacy) - -- (instancetype)initWithHost:(NSString *)host - packageName:(NSString *)packageName - serviceName:(NSString *)serviceName; - -- (GRPCProtoCall *)RPCToMethod:(NSString *)method - requestsWriter:(GRXWriter *)requestsWriter - responseClass:(Class)responseClass - responsesWriteable:(id)responsesWriteable; - -@end diff --git a/src/objective-c/ProtoRPC/ProtoServiceLegacy.m b/src/objective-c/ProtoRPC/ProtoServiceLegacy.m index b8b2766cdb0..6aa64955381 100644 --- a/src/objective-c/ProtoRPC/ProtoServiceLegacy.m +++ b/src/objective-c/ProtoRPC/ProtoServiceLegacy.m @@ -20,7 +20,7 @@ #import "ProtoMethod.h" #import "ProtoRPCLegacy.h" -#import "ProtoServiceLegacy.h" +#import "ProtoService.h" #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-implementations" diff --git a/templates/gRPC-ProtoRPC.podspec.template b/templates/gRPC-ProtoRPC.podspec.template index b8a881c06a9..6222ea5611a 100644 --- a/templates/gRPC-ProtoRPC.podspec.template +++ b/templates/gRPC-ProtoRPC.podspec.template @@ -71,7 +71,7 @@ ss.dependency 'Protobuf', '~> 3.0' ss.source_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.m", - "src/objective-c/ProtoRPC/ProtoServiceLegacy.{h,m}" + "src/objective-c/ProtoRPC/ProtoServiceLegacy.m" end # CFStream is now default. Leaving this subspec only for compatibility purpose.