mirror of https://github.com/grpc/grpc.git
parent
4eca064dcc
commit
6fccb70f0d
14 changed files with 1224 additions and 0 deletions
@ -0,0 +1,421 @@ |
|||||||
|
// !$*UTF8*$! |
||||||
|
{ |
||||||
|
archiveVersion = 1; |
||||||
|
classes = { |
||||||
|
}; |
||||||
|
objectVersion = 50; |
||||||
|
objects = { |
||||||
|
|
||||||
|
/* Begin PBXBuildFile section */ |
||||||
|
1C4854A76EEB56F8096DBDEF /* libPods-InterceptorSample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CB7A7A5B91FC976FCF4637AE /* libPods-InterceptorSample.a */; }; |
||||||
|
5EE960FB2266768A0044A74F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE960FA2266768A0044A74F /* AppDelegate.m */; }; |
||||||
|
5EE960FE2266768A0044A74F /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE960FD2266768A0044A74F /* ViewController.m */; }; |
||||||
|
5EE961012266768A0044A74F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5EE960FF2266768A0044A74F /* Main.storyboard */; }; |
||||||
|
5EE961032266768C0044A74F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5EE961022266768C0044A74F /* Assets.xcassets */; }; |
||||||
|
5EE961062266768C0044A74F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5EE961042266768C0044A74F /* LaunchScreen.storyboard */; }; |
||||||
|
5EE961092266768C0044A74F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE961082266768C0044A74F /* main.m */; }; |
||||||
|
5EE9611222668CF20044A74F /* CacheInterceptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE9611122668CF20044A74F /* CacheInterceptor.m */; }; |
||||||
|
/* End PBXBuildFile section */ |
||||||
|
|
||||||
|
/* Begin PBXFileReference section */ |
||||||
|
09457A264AAE5323BF50B1F8 /* Pods-InterceptorSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InterceptorSample.debug.xcconfig"; path = "Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample.debug.xcconfig"; sourceTree = "<group>"; }; |
||||||
|
5EE960F62266768A0044A74F /* InterceptorSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = InterceptorSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; |
||||||
|
5EE960FA2266768A0044A74F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; |
||||||
|
5EE960FC2266768A0044A74F /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; }; |
||||||
|
5EE960FD2266768A0044A74F /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; }; |
||||||
|
5EE961002266768A0044A74F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; |
||||||
|
5EE961022266768C0044A74F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; |
||||||
|
5EE961052266768C0044A74F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; |
||||||
|
5EE961072266768C0044A74F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; |
||||||
|
5EE961082266768C0044A74F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; |
||||||
|
5EE9610F2266774C0044A74F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; |
||||||
|
5EE9611022668CE20044A74F /* CacheInterceptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CacheInterceptor.h; sourceTree = "<group>"; }; |
||||||
|
5EE9611122668CF20044A74F /* CacheInterceptor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CacheInterceptor.m; sourceTree = "<group>"; }; |
||||||
|
A0789280A4035D0F22F96BE6 /* Pods-InterceptorSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InterceptorSample.release.xcconfig"; path = "Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample.release.xcconfig"; sourceTree = "<group>"; }; |
||||||
|
CB7A7A5B91FC976FCF4637AE /* libPods-InterceptorSample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InterceptorSample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; |
||||||
|
/* End PBXFileReference section */ |
||||||
|
|
||||||
|
/* Begin PBXFrameworksBuildPhase section */ |
||||||
|
5EE960F32266768A0044A74F /* Frameworks */ = { |
||||||
|
isa = PBXFrameworksBuildPhase; |
||||||
|
buildActionMask = 2147483647; |
||||||
|
files = ( |
||||||
|
1C4854A76EEB56F8096DBDEF /* libPods-InterceptorSample.a in Frameworks */, |
||||||
|
); |
||||||
|
runOnlyForDeploymentPostprocessing = 0; |
||||||
|
}; |
||||||
|
/* End PBXFrameworksBuildPhase section */ |
||||||
|
|
||||||
|
/* Begin PBXGroup section */ |
||||||
|
5EE960ED2266768A0044A74F = { |
||||||
|
isa = PBXGroup; |
||||||
|
children = ( |
||||||
|
5EE960F82266768A0044A74F /* InterceptorSample */, |
||||||
|
5EE960F72266768A0044A74F /* Products */, |
||||||
|
9D49DB75F3BEDAFDE7028B51 /* Pods */, |
||||||
|
BD7184728351C7DDAFBA5FA2 /* Frameworks */, |
||||||
|
); |
||||||
|
sourceTree = "<group>"; |
||||||
|
}; |
||||||
|
5EE960F72266768A0044A74F /* Products */ = { |
||||||
|
isa = PBXGroup; |
||||||
|
children = ( |
||||||
|
5EE960F62266768A0044A74F /* InterceptorSample.app */, |
||||||
|
); |
||||||
|
name = Products; |
||||||
|
sourceTree = "<group>"; |
||||||
|
}; |
||||||
|
5EE960F82266768A0044A74F /* InterceptorSample */ = { |
||||||
|
isa = PBXGroup; |
||||||
|
children = ( |
||||||
|
5EE960FA2266768A0044A74F /* AppDelegate.m */, |
||||||
|
5EE960FC2266768A0044A74F /* ViewController.h */, |
||||||
|
5EE960FD2266768A0044A74F /* ViewController.m */, |
||||||
|
5EE960FF2266768A0044A74F /* Main.storyboard */, |
||||||
|
5EE961022266768C0044A74F /* Assets.xcassets */, |
||||||
|
5EE961042266768C0044A74F /* LaunchScreen.storyboard */, |
||||||
|
5EE961072266768C0044A74F /* Info.plist */, |
||||||
|
5EE961082266768C0044A74F /* main.m */, |
||||||
|
5EE9610F2266774C0044A74F /* AppDelegate.h */, |
||||||
|
5EE9611022668CE20044A74F /* CacheInterceptor.h */, |
||||||
|
5EE9611122668CF20044A74F /* CacheInterceptor.m */, |
||||||
|
); |
||||||
|
path = InterceptorSample; |
||||||
|
sourceTree = "<group>"; |
||||||
|
}; |
||||||
|
9D49DB75F3BEDAFDE7028B51 /* Pods */ = { |
||||||
|
isa = PBXGroup; |
||||||
|
children = ( |
||||||
|
09457A264AAE5323BF50B1F8 /* Pods-InterceptorSample.debug.xcconfig */, |
||||||
|
A0789280A4035D0F22F96BE6 /* Pods-InterceptorSample.release.xcconfig */, |
||||||
|
); |
||||||
|
path = Pods; |
||||||
|
sourceTree = "<group>"; |
||||||
|
}; |
||||||
|
BD7184728351C7DDAFBA5FA2 /* Frameworks */ = { |
||||||
|
isa = PBXGroup; |
||||||
|
children = ( |
||||||
|
CB7A7A5B91FC976FCF4637AE /* libPods-InterceptorSample.a */, |
||||||
|
); |
||||||
|
name = Frameworks; |
||||||
|
sourceTree = "<group>"; |
||||||
|
}; |
||||||
|
/* End PBXGroup section */ |
||||||
|
|
||||||
|
/* Begin PBXNativeTarget section */ |
||||||
|
5EE960F52266768A0044A74F /* InterceptorSample */ = { |
||||||
|
isa = PBXNativeTarget; |
||||||
|
buildConfigurationList = 5EE9610C2266768C0044A74F /* Build configuration list for PBXNativeTarget "InterceptorSample" */; |
||||||
|
buildPhases = ( |
||||||
|
7531607F028A04DAAF5E97B5 /* [CP] Check Pods Manifest.lock */, |
||||||
|
5EE960F22266768A0044A74F /* Sources */, |
||||||
|
5EE960F32266768A0044A74F /* Frameworks */, |
||||||
|
5EE960F42266768A0044A74F /* Resources */, |
||||||
|
17700C95BAEBB27F7A3D1B01 /* [CP] Copy Pods Resources */, |
||||||
|
); |
||||||
|
buildRules = ( |
||||||
|
); |
||||||
|
dependencies = ( |
||||||
|
); |
||||||
|
name = InterceptorSample; |
||||||
|
productName = InterceptorSample; |
||||||
|
productReference = 5EE960F62266768A0044A74F /* InterceptorSample.app */; |
||||||
|
productType = "com.apple.product-type.application"; |
||||||
|
}; |
||||||
|
/* End PBXNativeTarget section */ |
||||||
|
|
||||||
|
/* Begin PBXProject section */ |
||||||
|
5EE960EE2266768A0044A74F /* Project object */ = { |
||||||
|
isa = PBXProject; |
||||||
|
attributes = { |
||||||
|
LastUpgradeCheck = 1010; |
||||||
|
ORGANIZATIONNAME = gRPC; |
||||||
|
TargetAttributes = { |
||||||
|
5EE960F52266768A0044A74F = { |
||||||
|
CreatedOnToolsVersion = 10.1; |
||||||
|
}; |
||||||
|
}; |
||||||
|
}; |
||||||
|
buildConfigurationList = 5EE960F12266768A0044A74F /* Build configuration list for PBXProject "InterceptorSample" */; |
||||||
|
compatibilityVersion = "Xcode 9.3"; |
||||||
|
developmentRegion = en; |
||||||
|
hasScannedForEncodings = 0; |
||||||
|
knownRegions = ( |
||||||
|
en, |
||||||
|
Base, |
||||||
|
); |
||||||
|
mainGroup = 5EE960ED2266768A0044A74F; |
||||||
|
productRefGroup = 5EE960F72266768A0044A74F /* Products */; |
||||||
|
projectDirPath = ""; |
||||||
|
projectRoot = ""; |
||||||
|
targets = ( |
||||||
|
5EE960F52266768A0044A74F /* InterceptorSample */, |
||||||
|
); |
||||||
|
}; |
||||||
|
/* End PBXProject section */ |
||||||
|
|
||||||
|
/* Begin PBXResourcesBuildPhase section */ |
||||||
|
5EE960F42266768A0044A74F /* Resources */ = { |
||||||
|
isa = PBXResourcesBuildPhase; |
||||||
|
buildActionMask = 2147483647; |
||||||
|
files = ( |
||||||
|
5EE961062266768C0044A74F /* LaunchScreen.storyboard in Resources */, |
||||||
|
5EE961032266768C0044A74F /* Assets.xcassets in Resources */, |
||||||
|
5EE961012266768A0044A74F /* Main.storyboard in Resources */, |
||||||
|
); |
||||||
|
runOnlyForDeploymentPostprocessing = 0; |
||||||
|
}; |
||||||
|
/* End PBXResourcesBuildPhase section */ |
||||||
|
|
||||||
|
/* Begin PBXShellScriptBuildPhase section */ |
||||||
|
17700C95BAEBB27F7A3D1B01 /* [CP] Copy Pods Resources */ = { |
||||||
|
isa = PBXShellScriptBuildPhase; |
||||||
|
buildActionMask = 2147483647; |
||||||
|
files = ( |
||||||
|
); |
||||||
|
inputFileListPaths = ( |
||||||
|
); |
||||||
|
inputPaths = ( |
||||||
|
"${PODS_ROOT}/Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample-resources.sh", |
||||||
|
"${PODS_CONFIGURATION_BUILD_DIR}/gRPC/gRPCCertificates.bundle", |
||||||
|
); |
||||||
|
name = "[CP] Copy Pods Resources"; |
||||||
|
outputFileListPaths = ( |
||||||
|
); |
||||||
|
outputPaths = ( |
||||||
|
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", |
||||||
|
); |
||||||
|
runOnlyForDeploymentPostprocessing = 0; |
||||||
|
shellPath = /bin/sh; |
||||||
|
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-InterceptorSample/Pods-InterceptorSample-resources.sh\"\n"; |
||||||
|
showEnvVarsInLog = 0; |
||||||
|
}; |
||||||
|
7531607F028A04DAAF5E97B5 /* [CP] Check Pods Manifest.lock */ = { |
||||||
|
isa = PBXShellScriptBuildPhase; |
||||||
|
buildActionMask = 2147483647; |
||||||
|
files = ( |
||||||
|
); |
||||||
|
inputFileListPaths = ( |
||||||
|
); |
||||||
|
inputPaths = ( |
||||||
|
"${PODS_PODFILE_DIR_PATH}/Podfile.lock", |
||||||
|
"${PODS_ROOT}/Manifest.lock", |
||||||
|
); |
||||||
|
name = "[CP] Check Pods Manifest.lock"; |
||||||
|
outputFileListPaths = ( |
||||||
|
); |
||||||
|
outputPaths = ( |
||||||
|
"$(DERIVED_FILE_DIR)/Pods-InterceptorSample-checkManifestLockResult.txt", |
||||||
|
); |
||||||
|
runOnlyForDeploymentPostprocessing = 0; |
||||||
|
shellPath = /bin/sh; |
||||||
|
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; |
||||||
|
showEnvVarsInLog = 0; |
||||||
|
}; |
||||||
|
/* End PBXShellScriptBuildPhase section */ |
||||||
|
|
||||||
|
/* Begin PBXSourcesBuildPhase section */ |
||||||
|
5EE960F22266768A0044A74F /* Sources */ = { |
||||||
|
isa = PBXSourcesBuildPhase; |
||||||
|
buildActionMask = 2147483647; |
||||||
|
files = ( |
||||||
|
5EE9611222668CF20044A74F /* CacheInterceptor.m in Sources */, |
||||||
|
5EE960FE2266768A0044A74F /* ViewController.m in Sources */, |
||||||
|
5EE961092266768C0044A74F /* main.m in Sources */, |
||||||
|
5EE960FB2266768A0044A74F /* AppDelegate.m in Sources */, |
||||||
|
); |
||||||
|
runOnlyForDeploymentPostprocessing = 0; |
||||||
|
}; |
||||||
|
/* End PBXSourcesBuildPhase section */ |
||||||
|
|
||||||
|
/* Begin PBXVariantGroup section */ |
||||||
|
5EE960FF2266768A0044A74F /* Main.storyboard */ = { |
||||||
|
isa = PBXVariantGroup; |
||||||
|
children = ( |
||||||
|
5EE961002266768A0044A74F /* Base */, |
||||||
|
); |
||||||
|
name = Main.storyboard; |
||||||
|
sourceTree = "<group>"; |
||||||
|
}; |
||||||
|
5EE961042266768C0044A74F /* LaunchScreen.storyboard */ = { |
||||||
|
isa = PBXVariantGroup; |
||||||
|
children = ( |
||||||
|
5EE961052266768C0044A74F /* Base */, |
||||||
|
); |
||||||
|
name = LaunchScreen.storyboard; |
||||||
|
sourceTree = "<group>"; |
||||||
|
}; |
||||||
|
/* End PBXVariantGroup section */ |
||||||
|
|
||||||
|
/* Begin XCBuildConfiguration section */ |
||||||
|
5EE9610A2266768C0044A74F /* Debug */ = { |
||||||
|
isa = XCBuildConfiguration; |
||||||
|
buildSettings = { |
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO; |
||||||
|
CLANG_ANALYZER_NONNULL = YES; |
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; |
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; |
||||||
|
CLANG_CXX_LIBRARY = "libc++"; |
||||||
|
CLANG_ENABLE_MODULES = YES; |
||||||
|
CLANG_ENABLE_OBJC_ARC = YES; |
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES; |
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; |
||||||
|
CLANG_WARN_BOOL_CONVERSION = YES; |
||||||
|
CLANG_WARN_COMMA = YES; |
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES; |
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; |
||||||
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; |
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES; |
||||||
|
CLANG_WARN_EMPTY_BODY = YES; |
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES; |
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES; |
||||||
|
CLANG_WARN_INT_CONVERSION = YES; |
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; |
||||||
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; |
||||||
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; |
||||||
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; |
||||||
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; |
||||||
|
CLANG_WARN_STRICT_PROTOTYPES = YES; |
||||||
|
CLANG_WARN_SUSPICIOUS_MOVE = YES; |
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; |
||||||
|
CLANG_WARN_UNREACHABLE_CODE = YES; |
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; |
||||||
|
CODE_SIGN_IDENTITY = "iPhone Developer"; |
||||||
|
COPY_PHASE_STRIP = NO; |
||||||
|
DEBUG_INFORMATION_FORMAT = dwarf; |
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES; |
||||||
|
ENABLE_TESTABILITY = YES; |
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu11; |
||||||
|
GCC_DYNAMIC_NO_PIC = NO; |
||||||
|
GCC_NO_COMMON_BLOCKS = YES; |
||||||
|
GCC_OPTIMIZATION_LEVEL = 0; |
||||||
|
GCC_PREPROCESSOR_DEFINITIONS = ( |
||||||
|
"DEBUG=1", |
||||||
|
"$(inherited)", |
||||||
|
); |
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; |
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; |
||||||
|
GCC_WARN_UNDECLARED_SELECTOR = YES; |
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; |
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES; |
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES; |
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 12.1; |
||||||
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; |
||||||
|
MTL_FAST_MATH = YES; |
||||||
|
ONLY_ACTIVE_ARCH = YES; |
||||||
|
SDKROOT = iphoneos; |
||||||
|
}; |
||||||
|
name = Debug; |
||||||
|
}; |
||||||
|
5EE9610B2266768C0044A74F /* Release */ = { |
||||||
|
isa = XCBuildConfiguration; |
||||||
|
buildSettings = { |
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO; |
||||||
|
CLANG_ANALYZER_NONNULL = YES; |
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; |
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; |
||||||
|
CLANG_CXX_LIBRARY = "libc++"; |
||||||
|
CLANG_ENABLE_MODULES = YES; |
||||||
|
CLANG_ENABLE_OBJC_ARC = YES; |
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES; |
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; |
||||||
|
CLANG_WARN_BOOL_CONVERSION = YES; |
||||||
|
CLANG_WARN_COMMA = YES; |
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES; |
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; |
||||||
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; |
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES; |
||||||
|
CLANG_WARN_EMPTY_BODY = YES; |
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES; |
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES; |
||||||
|
CLANG_WARN_INT_CONVERSION = YES; |
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; |
||||||
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; |
||||||
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; |
||||||
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; |
||||||
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; |
||||||
|
CLANG_WARN_STRICT_PROTOTYPES = YES; |
||||||
|
CLANG_WARN_SUSPICIOUS_MOVE = YES; |
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; |
||||||
|
CLANG_WARN_UNREACHABLE_CODE = YES; |
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; |
||||||
|
CODE_SIGN_IDENTITY = "iPhone Developer"; |
||||||
|
COPY_PHASE_STRIP = NO; |
||||||
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; |
||||||
|
ENABLE_NS_ASSERTIONS = NO; |
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES; |
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu11; |
||||||
|
GCC_NO_COMMON_BLOCKS = YES; |
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; |
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; |
||||||
|
GCC_WARN_UNDECLARED_SELECTOR = YES; |
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; |
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES; |
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES; |
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 12.1; |
||||||
|
MTL_ENABLE_DEBUG_INFO = NO; |
||||||
|
MTL_FAST_MATH = YES; |
||||||
|
SDKROOT = iphoneos; |
||||||
|
VALIDATE_PRODUCT = YES; |
||||||
|
}; |
||||||
|
name = Release; |
||||||
|
}; |
||||||
|
5EE9610D2266768C0044A74F /* Debug */ = { |
||||||
|
isa = XCBuildConfiguration; |
||||||
|
baseConfigurationReference = 09457A264AAE5323BF50B1F8 /* Pods-InterceptorSample.debug.xcconfig */; |
||||||
|
buildSettings = { |
||||||
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
||||||
|
CODE_SIGN_STYLE = Automatic; |
||||||
|
INFOPLIST_FILE = InterceptorSample/Info.plist; |
||||||
|
LD_RUNPATH_SEARCH_PATHS = ( |
||||||
|
"$(inherited)", |
||||||
|
"@executable_path/Frameworks", |
||||||
|
); |
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = io.grpc.InterceptorSample; |
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)"; |
||||||
|
TARGETED_DEVICE_FAMILY = "1,2"; |
||||||
|
}; |
||||||
|
name = Debug; |
||||||
|
}; |
||||||
|
5EE9610E2266768C0044A74F /* Release */ = { |
||||||
|
isa = XCBuildConfiguration; |
||||||
|
baseConfigurationReference = A0789280A4035D0F22F96BE6 /* Pods-InterceptorSample.release.xcconfig */; |
||||||
|
buildSettings = { |
||||||
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
||||||
|
CODE_SIGN_STYLE = Automatic; |
||||||
|
INFOPLIST_FILE = InterceptorSample/Info.plist; |
||||||
|
LD_RUNPATH_SEARCH_PATHS = ( |
||||||
|
"$(inherited)", |
||||||
|
"@executable_path/Frameworks", |
||||||
|
); |
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = io.grpc.InterceptorSample; |
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)"; |
||||||
|
TARGETED_DEVICE_FAMILY = "1,2"; |
||||||
|
}; |
||||||
|
name = Release; |
||||||
|
}; |
||||||
|
/* End XCBuildConfiguration section */ |
||||||
|
|
||||||
|
/* Begin XCConfigurationList section */ |
||||||
|
5EE960F12266768A0044A74F /* Build configuration list for PBXProject "InterceptorSample" */ = { |
||||||
|
isa = XCConfigurationList; |
||||||
|
buildConfigurations = ( |
||||||
|
5EE9610A2266768C0044A74F /* Debug */, |
||||||
|
5EE9610B2266768C0044A74F /* Release */, |
||||||
|
); |
||||||
|
defaultConfigurationIsVisible = 0; |
||||||
|
defaultConfigurationName = Release; |
||||||
|
}; |
||||||
|
5EE9610C2266768C0044A74F /* Build configuration list for PBXNativeTarget "InterceptorSample" */ = { |
||||||
|
isa = XCConfigurationList; |
||||||
|
buildConfigurations = ( |
||||||
|
5EE9610D2266768C0044A74F /* Debug */, |
||||||
|
5EE9610E2266768C0044A74F /* Release */, |
||||||
|
); |
||||||
|
defaultConfigurationIsVisible = 0; |
||||||
|
defaultConfigurationName = Release; |
||||||
|
}; |
||||||
|
/* End XCConfigurationList section */ |
||||||
|
}; |
||||||
|
rootObject = 5EE960EE2266768A0044A74F /* Project object */; |
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
/*
|
||||||
|
* |
||||||
|
* Copyright 2019 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 <UIKit/UIKit.h> |
||||||
|
|
||||||
|
@interface AppDelegate : UIResponder <UIApplicationDelegate> |
||||||
|
|
||||||
|
@property (strong, nonatomic) UIWindow *window; |
||||||
|
|
||||||
|
@end |
@ -0,0 +1,5 @@ |
|||||||
|
#import "AppDelegate.h" |
||||||
|
|
||||||
|
@implementation AppDelegate |
||||||
|
|
||||||
|
@end |
@ -0,0 +1,98 @@ |
|||||||
|
{ |
||||||
|
"images" : [ |
||||||
|
{ |
||||||
|
"idiom" : "iphone", |
||||||
|
"size" : "20x20", |
||||||
|
"scale" : "2x" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "iphone", |
||||||
|
"size" : "20x20", |
||||||
|
"scale" : "3x" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "iphone", |
||||||
|
"size" : "29x29", |
||||||
|
"scale" : "2x" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "iphone", |
||||||
|
"size" : "29x29", |
||||||
|
"scale" : "3x" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "iphone", |
||||||
|
"size" : "40x40", |
||||||
|
"scale" : "2x" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "iphone", |
||||||
|
"size" : "40x40", |
||||||
|
"scale" : "3x" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "iphone", |
||||||
|
"size" : "60x60", |
||||||
|
"scale" : "2x" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "iphone", |
||||||
|
"size" : "60x60", |
||||||
|
"scale" : "3x" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "ipad", |
||||||
|
"size" : "20x20", |
||||||
|
"scale" : "1x" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "ipad", |
||||||
|
"size" : "20x20", |
||||||
|
"scale" : "2x" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "ipad", |
||||||
|
"size" : "29x29", |
||||||
|
"scale" : "1x" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "ipad", |
||||||
|
"size" : "29x29", |
||||||
|
"scale" : "2x" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "ipad", |
||||||
|
"size" : "40x40", |
||||||
|
"scale" : "1x" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "ipad", |
||||||
|
"size" : "40x40", |
||||||
|
"scale" : "2x" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "ipad", |
||||||
|
"size" : "76x76", |
||||||
|
"scale" : "1x" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "ipad", |
||||||
|
"size" : "76x76", |
||||||
|
"scale" : "2x" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "ipad", |
||||||
|
"size" : "83.5x83.5", |
||||||
|
"scale" : "2x" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "ios-marketing", |
||||||
|
"size" : "1024x1024", |
||||||
|
"scale" : "1x" |
||||||
|
} |
||||||
|
], |
||||||
|
"info" : { |
||||||
|
"version" : 1, |
||||||
|
"author" : "xcode" |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,6 @@ |
|||||||
|
{ |
||||||
|
"info" : { |
||||||
|
"version" : 1, |
||||||
|
"author" : "xcode" |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||||||
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> |
||||||
|
<dependencies> |
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/> |
||||||
|
<capability name="Safe area layout guides" minToolsVersion="9.0"/> |
||||||
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |
||||||
|
</dependencies> |
||||||
|
<scenes> |
||||||
|
<!--View Controller--> |
||||||
|
<scene sceneID="EHf-IW-A2E"> |
||||||
|
<objects> |
||||||
|
<viewController id="01J-lp-oVM" sceneMemberID="viewController"> |
||||||
|
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> |
||||||
|
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> |
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
||||||
|
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
||||||
|
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/> |
||||||
|
</view> |
||||||
|
</viewController> |
||||||
|
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> |
||||||
|
</objects> |
||||||
|
<point key="canvasLocation" x="53" y="375"/> |
||||||
|
</scene> |
||||||
|
</scenes> |
||||||
|
</document> |
@ -0,0 +1,38 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r"> |
||||||
|
<device id="retina4_7" orientation="portrait"> |
||||||
|
<adaptation id="fullscreen"/> |
||||||
|
</device> |
||||||
|
<dependencies> |
||||||
|
<deployment identifier="iOS"/> |
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/> |
||||||
|
<capability name="Safe area layout guides" minToolsVersion="9.0"/> |
||||||
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |
||||||
|
</dependencies> |
||||||
|
<scenes> |
||||||
|
<!--View Controller--> |
||||||
|
<scene sceneID="tne-QT-ifu"> |
||||||
|
<objects> |
||||||
|
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController"> |
||||||
|
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC"> |
||||||
|
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> |
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
||||||
|
<subviews> |
||||||
|
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="XDI-qX-FfC"> |
||||||
|
<rect key="frame" x="172" y="182" width="30" height="30"/> |
||||||
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> |
||||||
|
<state key="normal" title="Call"/> |
||||||
|
<connections> |
||||||
|
<action selector="tapCall:" destination="BYZ-38-t0r" eventType="touchUpInside" id="qEz-Hb-ReK"/> |
||||||
|
</connections> |
||||||
|
</button> |
||||||
|
</subviews> |
||||||
|
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
||||||
|
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/> |
||||||
|
</view> |
||||||
|
</viewController> |
||||||
|
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> |
||||||
|
</objects> |
||||||
|
</scene> |
||||||
|
</scenes> |
||||||
|
</document> |
@ -0,0 +1,90 @@ |
|||||||
|
/*
|
||||||
|
* |
||||||
|
* Copyright 2019 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 <GRPCClient/GRPCInterceptor.h> |
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN |
||||||
|
|
||||||
|
@interface RequestCacheEntry : NSObject<NSCopying> |
||||||
|
|
||||||
|
@property(readonly, copy, nullable) NSString *path; |
||||||
|
@property(readonly, copy, nullable) id message; |
||||||
|
|
||||||
|
@end |
||||||
|
|
||||||
|
@interface MutableRequestCacheEntry : RequestCacheEntry |
||||||
|
|
||||||
|
@property(copy, nullable) NSString *path; |
||||||
|
@property(copy, nullable) id<NSObject> message; |
||||||
|
|
||||||
|
@end |
||||||
|
|
||||||
|
@interface ResponseCacheEntry : NSObject<NSCopying> |
||||||
|
|
||||||
|
@property(readonly, copy, nullable) NSDate *deadline; |
||||||
|
|
||||||
|
@property(readonly, copy, nullable) NSDictionary *headers; |
||||||
|
@property(readonly, copy, nullable) id message; |
||||||
|
@property(readonly, copy, nullable) NSDictionary *trailers; |
||||||
|
|
||||||
|
@end |
||||||
|
|
||||||
|
@interface MutableResponseCacheEntry : ResponseCacheEntry |
||||||
|
|
||||||
|
@property(copy, nullable) NSDate *deadline; |
||||||
|
|
||||||
|
@property(copy, nullable) NSDictionary *headers; |
||||||
|
@property(copy, nullable) id message; |
||||||
|
@property(copy, nullable) NSDictionary *trailers; |
||||||
|
|
||||||
|
@end |
||||||
|
|
||||||
|
@interface CacheContext : NSObject<GRPCInterceptorFactory> |
||||||
|
|
||||||
|
- (nullable instancetype)init; |
||||||
|
|
||||||
|
- (nullable ResponseCacheEntry *)getCachedResponseForRequest:(RequestCacheEntry *)request; |
||||||
|
|
||||||
|
- (void)setCachedResponse:(ResponseCacheEntry *)response forRequest:(RequestCacheEntry *)request; |
||||||
|
|
||||||
|
@end |
||||||
|
|
||||||
|
@interface CacheInterceptor : GRPCInterceptor |
||||||
|
|
||||||
|
- (instancetype)init NS_UNAVAILABLE; |
||||||
|
|
||||||
|
+ (instancetype)new NS_UNAVAILABLE; |
||||||
|
|
||||||
|
- (nullable instancetype)initWithInterceptorManager:(GRPCInterceptorManager * _Nonnull)intercepterManager |
||||||
|
cacheContext:(CacheContext * _Nonnull)cacheContext NS_DESIGNATED_INITIALIZER; |
||||||
|
|
||||||
|
// implementation of GRPCInterceptorInterface
|
||||||
|
- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions |
||||||
|
callOptions:(GRPCCallOptions *)callOptions; |
||||||
|
- (void)writeData:(id)data; |
||||||
|
- (void)finish; |
||||||
|
|
||||||
|
// implementation of GRPCResponseHandler
|
||||||
|
- (void)didReceiveInitialMetadata:(nullable NSDictionary *)initialMetadata; |
||||||
|
- (void)didReceiveData:(id)data; |
||||||
|
- (void)didCloseWithTrailingMetadata:(nullable NSDictionary *)trailingMetadata |
||||||
|
error:(nullable NSError *)error; |
||||||
|
|
||||||
|
@end |
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END |
@ -0,0 +1,303 @@ |
|||||||
|
/* |
||||||
|
* |
||||||
|
* Copyright 2019 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 "CacheInterceptor.h" |
||||||
|
|
||||||
|
@implementation RequestCacheEntry { |
||||||
|
@protected |
||||||
|
NSString *_path; |
||||||
|
id<NSObject> _message; |
||||||
|
} |
||||||
|
|
||||||
|
@synthesize path = _path; |
||||||
|
@synthesize message = _message; |
||||||
|
|
||||||
|
- (instancetype)initWithPath:(NSString *)path message:(id)message { |
||||||
|
if ((self = [super init])) { |
||||||
|
_path = [path copy]; |
||||||
|
_message = [message copy]; |
||||||
|
} |
||||||
|
return self; |
||||||
|
} |
||||||
|
|
||||||
|
- (id)copyWithZone:(NSZone *)zone { |
||||||
|
return [[RequestCacheEntry allocWithZone:zone] initWithPath:_path message:_message]; |
||||||
|
} |
||||||
|
|
||||||
|
- (BOOL)isEqual:(id)object { |
||||||
|
if ([self class] != [object class]) return NO; |
||||||
|
RequestCacheEntry *rhs = (RequestCacheEntry *)object; |
||||||
|
return ([_path isEqualToString:rhs.path] && [_message isEqual:rhs.message]); |
||||||
|
} |
||||||
|
|
||||||
|
- (NSUInteger)hash { |
||||||
|
return _path.hash ^ _message.hash; |
||||||
|
} |
||||||
|
|
||||||
|
@end |
||||||
|
|
||||||
|
@implementation MutableRequestCacheEntry |
||||||
|
|
||||||
|
@dynamic path; |
||||||
|
@dynamic message; |
||||||
|
|
||||||
|
- (void)setPath:(NSString *)path { |
||||||
|
_path = [path copy]; |
||||||
|
} |
||||||
|
|
||||||
|
- (void)setMessage:(id)message { |
||||||
|
_message = [message copy]; |
||||||
|
} |
||||||
|
|
||||||
|
@end |
||||||
|
|
||||||
|
@implementation ResponseCacheEntry { |
||||||
|
@protected |
||||||
|
NSDate *_deadline; |
||||||
|
NSDictionary *_headers; |
||||||
|
id _message; |
||||||
|
NSDictionary *_trailers; |
||||||
|
} |
||||||
|
|
||||||
|
@synthesize deadline = _deadline; |
||||||
|
@synthesize headers = _headers; |
||||||
|
@synthesize message = _message; |
||||||
|
@synthesize trailers = _trailers; |
||||||
|
|
||||||
|
- (instancetype)initWithDeadline:(NSDate *)deadline |
||||||
|
headers:(NSDictionary *)headers |
||||||
|
message:(id)message |
||||||
|
trailers:(NSDictionary *)trailers { |
||||||
|
if (([super init])) { |
||||||
|
_deadline = [deadline copy]; |
||||||
|
_headers = [[NSDictionary alloc] initWithDictionary:headers copyItems:YES]; |
||||||
|
_message = [message copy]; |
||||||
|
_trailers = [[NSDictionary alloc] initWithDictionary:trailers copyItems:YES]; |
||||||
|
} |
||||||
|
return self; |
||||||
|
} |
||||||
|
|
||||||
|
- (id)copyWithZone:(NSZone *)zone { |
||||||
|
return [[ResponseCacheEntry allocWithZone:zone] initWithDeadline:_deadline |
||||||
|
headers:_headers |
||||||
|
message:_message |
||||||
|
trailers:_trailers]; |
||||||
|
} |
||||||
|
|
||||||
|
@end |
||||||
|
|
||||||
|
@implementation MutableResponseCacheEntry |
||||||
|
|
||||||
|
@dynamic deadline; |
||||||
|
@dynamic headers; |
||||||
|
@dynamic message; |
||||||
|
@dynamic trailers; |
||||||
|
|
||||||
|
- (void)setDeadline:(NSDate *)deadline { |
||||||
|
_deadline = [deadline copy]; |
||||||
|
} |
||||||
|
|
||||||
|
- (void)setHeaders:(NSDictionary *)headers { |
||||||
|
_headers = [[NSDictionary alloc] initWithDictionary:headers copyItems:YES]; |
||||||
|
} |
||||||
|
|
||||||
|
- (void)setMessage:(id)message { |
||||||
|
_message = [message copy]; |
||||||
|
} |
||||||
|
|
||||||
|
- (void)setTrailers:(NSDictionary *)trailers { |
||||||
|
_trailers = [[NSDictionary alloc] initWithDictionary:trailers copyItems:YES]; |
||||||
|
} |
||||||
|
|
||||||
|
@end |
||||||
|
|
||||||
|
@implementation CacheContext { |
||||||
|
NSCache<RequestCacheEntry *, ResponseCacheEntry *> *_cache; |
||||||
|
} |
||||||
|
|
||||||
|
- (instancetype)init { |
||||||
|
if ((self = [super init])) { |
||||||
|
_cache = [[NSCache alloc] init]; |
||||||
|
} |
||||||
|
return self; |
||||||
|
} |
||||||
|
|
||||||
|
- (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager { |
||||||
|
return [[CacheInterceptor alloc] initWithInterceptorManager:interceptorManager |
||||||
|
cacheContext:self]; |
||||||
|
} |
||||||
|
|
||||||
|
- (ResponseCacheEntry *)getCachedResponseForRequest:(RequestCacheEntry *)request { |
||||||
|
ResponseCacheEntry *response = nil; |
||||||
|
@synchronized (self) { |
||||||
|
response = [_cache objectForKey:request]; |
||||||
|
} |
||||||
|
return response; |
||||||
|
} |
||||||
|
|
||||||
|
- (void)setCachedResponse:(ResponseCacheEntry *)response |
||||||
|
forRequest:(RequestCacheEntry *)request { |
||||||
|
@synchronized (self) { |
||||||
|
[_cache setObject:response forKey:request]; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@end |
||||||
|
|
||||||
|
@implementation CacheInterceptor { |
||||||
|
GRPCInterceptorManager *_manager; |
||||||
|
CacheContext *_context; |
||||||
|
dispatch_queue_t _dispatchQueue; |
||||||
|
|
||||||
|
BOOL _cacheable; |
||||||
|
BOOL _messageSeen; |
||||||
|
GRPCCallOptions *_callOptions; |
||||||
|
GRPCRequestOptions *_requestOptions; |
||||||
|
id _requestMessage; |
||||||
|
MutableRequestCacheEntry *_request; |
||||||
|
MutableResponseCacheEntry *_response; |
||||||
|
} |
||||||
|
|
||||||
|
- (dispatch_queue_t)requestDispatchQueue { |
||||||
|
return _dispatchQueue; |
||||||
|
} |
||||||
|
|
||||||
|
- (dispatch_queue_t)dispatchQueue { |
||||||
|
return _dispatchQueue; |
||||||
|
} |
||||||
|
|
||||||
|
- (instancetype)initWithInterceptorManager:(GRPCInterceptorManager * _Nonnull)intercepterManager |
||||||
|
cacheContext:(CacheContext * _Nonnull)cacheContext { |
||||||
|
if ((self = [super initWithInterceptorManager:intercepterManager |
||||||
|
requestDispatchQueue:dispatch_get_main_queue() |
||||||
|
responseDispatchQueue:dispatch_get_main_queue()])) { |
||||||
|
_manager = intercepterManager; |
||||||
|
_context = cacheContext; |
||||||
|
_dispatchQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); |
||||||
|
|
||||||
|
_cacheable = YES; |
||||||
|
_messageSeen = NO; |
||||||
|
_request = nil; |
||||||
|
_response = nil; |
||||||
|
} |
||||||
|
return self; |
||||||
|
} |
||||||
|
|
||||||
|
- (void)startWithRequestOptions:(GRPCRequestOptions *)requestOptions callOptions:(GRPCCallOptions *)callOptions { |
||||||
|
NSLog(@"start"); |
||||||
|
if (requestOptions.safety != GRPCCallSafetyCacheableRequest) { |
||||||
|
NSLog(@"no cache"); |
||||||
|
_cacheable = NO; |
||||||
|
[_manager startNextInterceptorWithRequest:requestOptions callOptions:callOptions]; |
||||||
|
} else { |
||||||
|
_requestOptions = [requestOptions copy]; |
||||||
|
_callOptions = [callOptions copy]; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
- (void)writeData:(id)data { |
||||||
|
NSLog(@"writeData"); |
||||||
|
if (!_cacheable) { |
||||||
|
[_manager writeNextInterceptorWithData:data]; |
||||||
|
} else { |
||||||
|
NSAssert(!_messageSeen, @"CacheInterceptor does not support streaming call"); |
||||||
|
if (_messageSeen) { |
||||||
|
NSLog(@"CacheInterceptor does not support streaming call"); |
||||||
|
} |
||||||
|
_messageSeen = YES; |
||||||
|
_requestMessage = [data copy]; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
- (void)finish { |
||||||
|
NSLog(@"finish"); |
||||||
|
if (!_cacheable) { |
||||||
|
[_manager finishNextInterceptor]; |
||||||
|
} else { |
||||||
|
_request = [[MutableRequestCacheEntry alloc] init]; |
||||||
|
_request.path = _requestOptions.path; |
||||||
|
_request.message = [_requestMessage copy]; |
||||||
|
_response = [[_context getCachedResponseForRequest:_request] copy]; |
||||||
|
NSLog(@"Read cache for %@", _request); |
||||||
|
if (!_response) { |
||||||
|
[_manager startNextInterceptorWithRequest:_requestOptions |
||||||
|
callOptions:_callOptions]; |
||||||
|
[_manager writeNextInterceptorWithData:_requestMessage]; |
||||||
|
[_manager finishNextInterceptor]; |
||||||
|
} else { |
||||||
|
[_manager forwardPreviousInterceptorWithInitialMetadata:_response.headers]; |
||||||
|
[_manager forwardPreviousIntercetporWithData:_response.message]; |
||||||
|
[_manager forwardPreviousInterceptorCloseWithTrailingMetadata:_response.trailers error:nil]; |
||||||
|
[_manager shutDown]; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
- (void)didReceiveInitialMetadata:(NSDictionary *)initialMetadata { |
||||||
|
NSLog(@"initialMetadata"); |
||||||
|
if (_cacheable) { |
||||||
|
NSDate *deadline = nil; |
||||||
|
for (NSString *key in initialMetadata) { |
||||||
|
if ([key.lowercaseString isEqualToString:@"cache-control"]) { |
||||||
|
NSArray *cacheControls = [initialMetadata[key] componentsSeparatedByString:@","]; |
||||||
|
for (NSString *option in cacheControls) { |
||||||
|
NSString *trimmedOption = [option stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@" "]]; |
||||||
|
if ([trimmedOption.lowercaseString isEqualToString:@"no-cache"] || |
||||||
|
[trimmedOption.lowercaseString isEqualToString:@"no-store"] || |
||||||
|
[trimmedOption.lowercaseString isEqualToString:@"no-transform"]) { |
||||||
|
_cacheable = NO; |
||||||
|
break; |
||||||
|
} else if ([trimmedOption.lowercaseString hasPrefix:@"max-age="]) { |
||||||
|
NSArray<NSString *> *components = [trimmedOption componentsSeparatedByString:@"="]; |
||||||
|
if (components.count == 2) { |
||||||
|
NSUInteger maxAge = components[1].intValue; |
||||||
|
deadline = [NSDate dateWithTimeIntervalSinceNow:maxAge]; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
if (_cacheable) { |
||||||
|
_response = [[MutableResponseCacheEntry alloc] init]; |
||||||
|
_response.headers = [initialMetadata copy]; |
||||||
|
_response.deadline = deadline; |
||||||
|
} |
||||||
|
} |
||||||
|
[_manager forwardPreviousInterceptorWithInitialMetadata:initialMetadata]; |
||||||
|
} |
||||||
|
|
||||||
|
- (void)didReceiveData:(id)data { |
||||||
|
NSLog(@"receiveData"); |
||||||
|
if (_cacheable) { |
||||||
|
_response.message = [data copy]; |
||||||
|
} |
||||||
|
[_manager forwardPreviousIntercetporWithData:data]; |
||||||
|
} |
||||||
|
|
||||||
|
- (void)didCloseWithTrailingMetadata:(NSDictionary *)trailingMetadata error:(NSError *)error { |
||||||
|
NSLog(@"close"); |
||||||
|
if (error == nil && _cacheable) { |
||||||
|
_response.trailers = [trailingMetadata copy]; |
||||||
|
[_context setCachedResponse:_response forRequest:_request]; |
||||||
|
NSLog(@"Write cache for %@", _request); |
||||||
|
} |
||||||
|
[_manager forwardPreviousInterceptorCloseWithTrailingMetadata:trailingMetadata error:error]; |
||||||
|
[_manager shutDown]; |
||||||
|
} |
||||||
|
|
||||||
|
@end |
@ -0,0 +1,45 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
||||||
|
<plist version="1.0"> |
||||||
|
<dict> |
||||||
|
<key>CFBundleDevelopmentRegion</key> |
||||||
|
<string>$(DEVELOPMENT_LANGUAGE)</string> |
||||||
|
<key>CFBundleExecutable</key> |
||||||
|
<string>$(EXECUTABLE_NAME)</string> |
||||||
|
<key>CFBundleIdentifier</key> |
||||||
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> |
||||||
|
<key>CFBundleInfoDictionaryVersion</key> |
||||||
|
<string>6.0</string> |
||||||
|
<key>CFBundleName</key> |
||||||
|
<string>$(PRODUCT_NAME)</string> |
||||||
|
<key>CFBundlePackageType</key> |
||||||
|
<string>APPL</string> |
||||||
|
<key>CFBundleShortVersionString</key> |
||||||
|
<string>1.0</string> |
||||||
|
<key>CFBundleVersion</key> |
||||||
|
<string>1</string> |
||||||
|
<key>LSRequiresIPhoneOS</key> |
||||||
|
<true/> |
||||||
|
<key>UILaunchStoryboardName</key> |
||||||
|
<string>LaunchScreen</string> |
||||||
|
<key>UIMainStoryboardFile</key> |
||||||
|
<string>Main</string> |
||||||
|
<key>UIRequiredDeviceCapabilities</key> |
||||||
|
<array> |
||||||
|
<string>armv7</string> |
||||||
|
</array> |
||||||
|
<key>UISupportedInterfaceOrientations</key> |
||||||
|
<array> |
||||||
|
<string>UIInterfaceOrientationPortrait</string> |
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string> |
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string> |
||||||
|
</array> |
||||||
|
<key>UISupportedInterfaceOrientations~ipad</key> |
||||||
|
<array> |
||||||
|
<string>UIInterfaceOrientationPortrait</string> |
||||||
|
<string>UIInterfaceOrientationPortraitUpsideDown</string> |
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string> |
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string> |
||||||
|
</array> |
||||||
|
</dict> |
||||||
|
</plist> |
@ -0,0 +1,25 @@ |
|||||||
|
/*
|
||||||
|
* |
||||||
|
* Copyright 2019 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 <UIKit/UIKit.h> |
||||||
|
|
||||||
|
@interface ViewController : UIViewController |
||||||
|
|
||||||
|
|
||||||
|
@end |
||||||
|
|
@ -0,0 +1,86 @@ |
|||||||
|
/* |
||||||
|
* |
||||||
|
* Copyright 2019 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 "ViewController.h" |
||||||
|
|
||||||
|
#import <GRPCClient/GRPCCall.h> |
||||||
|
#import <RemoteTest/Test.pbrpc.h> |
||||||
|
#import <RemoteTest/Messages.pbobjc.h> |
||||||
|
|
||||||
|
#import "CacheInterceptor.h" |
||||||
|
|
||||||
|
static NSString *const kPackage = @"grpc.testing"; |
||||||
|
static NSString *const kService = @"TestService"; |
||||||
|
|
||||||
|
@interface ViewController ()<GRPCResponseHandler> |
||||||
|
|
||||||
|
@end |
||||||
|
|
||||||
|
@implementation ViewController { |
||||||
|
GRPCCallOptions *_options; |
||||||
|
} |
||||||
|
|
||||||
|
- (void)viewDidLoad { |
||||||
|
[super viewDidLoad]; |
||||||
|
|
||||||
|
GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; |
||||||
|
|
||||||
|
id<GRPCInterceptorFactory> factory = [[CacheContext alloc] init]; |
||||||
|
options.interceptorFactories = @[ factory ]; |
||||||
|
_options = options; |
||||||
|
} |
||||||
|
|
||||||
|
- (IBAction)tapCall:(id)sender { |
||||||
|
GRPCProtoMethod *kUnaryCallMethod = |
||||||
|
[[GRPCProtoMethod alloc] initWithPackage:kPackage service:kService method:@"UnaryCall"]; |
||||||
|
|
||||||
|
GRPCRequestOptions *requestOptions = |
||||||
|
[[GRPCRequestOptions alloc] initWithHost:@"grpc-test.sandbox.googleapis.com" |
||||||
|
path:kUnaryCallMethod.HTTPPath |
||||||
|
safety:GRPCCallSafetyCacheableRequest]; |
||||||
|
|
||||||
|
GRPCCall2 *call = [[GRPCCall2 alloc] initWithRequestOptions:requestOptions |
||||||
|
responseHandler:self |
||||||
|
callOptions:_options]; |
||||||
|
|
||||||
|
RMTSimpleRequest *request = [RMTSimpleRequest message]; |
||||||
|
request.responseSize = 100; |
||||||
|
|
||||||
|
[call start]; |
||||||
|
[call writeData:[request data]]; |
||||||
|
[call finish]; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
- (dispatch_queue_t)dispatchQueue { |
||||||
|
return dispatch_get_main_queue(); |
||||||
|
} |
||||||
|
|
||||||
|
- (void)didReceiveInitialMetadata:(NSDictionary *)initialMetadata { |
||||||
|
NSLog(@"Header: %@", initialMetadata); |
||||||
|
} |
||||||
|
|
||||||
|
- (void)didReceiveData:(id)data { |
||||||
|
NSLog(@"Message: %@", data); |
||||||
|
} |
||||||
|
|
||||||
|
- (void)didCloseWithTrailingMetadata:(NSDictionary *)trailingMetadata error:(NSError *)error { |
||||||
|
NSLog(@"Trailer: %@\nError: %@", trailingMetadata, error); |
||||||
|
} |
||||||
|
|
||||||
|
@end |
@ -0,0 +1,26 @@ |
|||||||
|
/* |
||||||
|
* |
||||||
|
* Copyright 2019 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 <UIKit/UIKit.h> |
||||||
|
#import "AppDelegate.h" |
||||||
|
|
||||||
|
int main(int argc, char * argv[]) { |
||||||
|
@autoreleasepool { |
||||||
|
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,31 @@ |
|||||||
|
platform :ios, '8.0' |
||||||
|
|
||||||
|
install! 'cocoapods', :deterministic_uuids => false |
||||||
|
|
||||||
|
ROOT_DIR = '../../../..' |
||||||
|
|
||||||
|
target 'InterceptorSample' do |
||||||
|
pod 'gRPC-ProtoRPC', :path => ROOT_DIR |
||||||
|
pod 'gRPC', :path => ROOT_DIR |
||||||
|
pod 'gRPC-Core', :path => ROOT_DIR |
||||||
|
pod 'gRPC-RxLibrary', :path => ROOT_DIR |
||||||
|
pod 'RemoteTest', :path => "../RemoteTestClient" |
||||||
|
pod '!ProtoCompiler-gRPCPlugin', :path => "#{ROOT_DIR}/src/objective-c" |
||||||
|
end |
||||||
|
|
||||||
|
pre_install do |installer| |
||||||
|
grpc_core_spec = installer.pod_targets.find{|t| t.name.start_with?('gRPC-Core')}.root_spec |
||||||
|
|
||||||
|
src_root = "$(PODS_TARGET_SRCROOT)" |
||||||
|
grpc_core_spec.pod_target_xcconfig = { |
||||||
|
'GRPC_SRC_ROOT' => src_root, |
||||||
|
'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(GRPC_SRC_ROOT)/include"', |
||||||
|
'USER_HEADER_SEARCH_PATHS' => '"$(GRPC_SRC_ROOT)"', |
||||||
|
# If we don't set these two settings, `include/grpc/support/time.h` and |
||||||
|
# `src/core/lib/gpr/string.h` shadow the system `<time.h>` and `<string.h>`, breaking the |
||||||
|
# build. |
||||||
|
'USE_HEADERMAP' => 'NO', |
||||||
|
'ALWAYS_SEARCH_USER_PATHS' => 'NO', |
||||||
|
} |
||||||
|
end |
||||||
|
|
Loading…
Reference in new issue