aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gRPC.podspec23
-rw-r--r--src/objective-c/GRPCClient/GRPCCall+GID.h29
-rw-r--r--src/objective-c/GRPCClient/GRPCCall+GID.m28
-rw-r--r--templates/gRPC.podspec.template23
4 files changed, 95 insertions, 8 deletions
diff --git a/gRPC.podspec b/gRPC.podspec
index 4c83ccc7a0..22ecdcf66f 100644
--- a/gRPC.podspec
+++ b/gRPC.podspec
@@ -40,12 +40,9 @@ Pod::Spec.new do |s|
s.header_dir = name
src_dir = 'src/objective-c/GRPCClient'
- s.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}"
- s.private_header_files = "#{src_dir}/private/*.h"
- s.header_mappings_dir = "#{src_dir}"
- s.dependency 'gRPC-Core', version
s.dependency 'gRPC-RxLibrary', version
+ s.default_subspec = 'Main'
# Certificates, to be able to establish TLS connections:
s.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] }
@@ -54,4 +51,22 @@ Pod::Spec.new do |s|
# This is needed by all pods that depend on gRPC-RxLibrary:
'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES',
}
+
+ s.subspec 'Main' do |ss|
+ ss.header_mappings_dir = "#{src_dir}"
+
+ ss.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}"
+ ss.exclude_files = "#{src_dir}/GRPCCall+GID.{h,m}"
+ ss.private_header_files = "#{src_dir}/private/*.h"
+
+ ss.dependency 'gRPC-Core', version
+ end
+
+ s.subspec 'GID' do |ss|
+ ss.header_mappings_dir = "#{src_dir}"
+
+ ss.source_files = "#{src_dir}/GRPCCall+GID.{h,m}"
+
+ ss.dependency 'Google/SignIn'
+ end
end
diff --git a/src/objective-c/GRPCClient/GRPCCall+GID.h b/src/objective-c/GRPCClient/GRPCCall+GID.h
new file mode 100644
index 0000000000..3ee732e79e
--- /dev/null
+++ b/src/objective-c/GRPCClient/GRPCCall+GID.h
@@ -0,0 +1,29 @@
+/*
+ *
+ * Copyright 2017 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#import "GRPCCall.h"
+#import "GRPCCall+OAuth2.h"
+
+#import <Google/SignIn.h>
+
+/**
+ * Extend GIDSignIn class to comply GRPCAuthorizationProtocol
+ */
+@interface GIDSignIn (GRPC) <GRPCAuthorizationProtocol>
+- (void)getTokenWithHandler:(void (^)(NSString *token))hander;
+@end
diff --git a/src/objective-c/GRPCClient/GRPCCall+GID.m b/src/objective-c/GRPCClient/GRPCCall+GID.m
new file mode 100644
index 0000000000..030737147b
--- /dev/null
+++ b/src/objective-c/GRPCClient/GRPCCall+GID.m
@@ -0,0 +1,28 @@
+/*
+ *
+ * Copyright 2017 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#import "GRPCCall+GID.h"
+
+@implementation GIDSignIn (GRPC)
+
+- (void)getTokenWithHandler:(void (^)(NSString *token))handler {
+ NSString *token = self.currentUser.authentication.accessToken;
+ handler(token);
+}
+
+@end
diff --git a/templates/gRPC.podspec.template b/templates/gRPC.podspec.template
index 62a6d37c3c..5c92f9f9c4 100644
--- a/templates/gRPC.podspec.template
+++ b/templates/gRPC.podspec.template
@@ -42,12 +42,9 @@
s.header_dir = name
src_dir = 'src/objective-c/GRPCClient'
- s.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}"
- s.private_header_files = "#{src_dir}/private/*.h"
- s.header_mappings_dir = "#{src_dir}"
- s.dependency 'gRPC-Core', version
s.dependency 'gRPC-RxLibrary', version
+ s.default_subspec = 'Main'
# Certificates, to be able to establish TLS connections:
s.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] }
@@ -56,4 +53,22 @@
# This is needed by all pods that depend on gRPC-RxLibrary:
'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES',
}
+
+ s.subspec 'Main' do |ss|
+ ss.header_mappings_dir = "#{src_dir}"
+
+ ss.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}"
+ ss.exclude_files = "#{src_dir}/GRPCCall+GID.{h,m}"
+ ss.private_header_files = "#{src_dir}/private/*.h"
+
+ ss.dependency 'gRPC-Core', version
+ end
+
+ s.subspec 'GID' do |ss|
+ ss.header_mappings_dir = "#{src_dir}"
+
+ ss.source_files = "#{src_dir}/GRPCCall+GID.{h,m}"
+
+ ss.dependency 'Google/SignIn'
+ end
end