Add react-native-keychain on tvOS (#78)

* [tvOS] Update podspec

* [tvOS] Add target

* [SecRequestSharedWebCredential] is only available on iOS and not tvOS

* [Security] Move into the same folder Framework

* [RNKeychainManager.m] Change indentation
This commit is contained in:
Julien K 2017-08-24 23:21:36 +02:00 committed by Joel Arvidsson
parent 99ae5252ca
commit 712679ff89
3 changed files with 109 additions and 2 deletions

View File

@ -9,7 +9,8 @@ Pod::Spec.new do |s|
s.homepage = "https://github.com/oblador/react-native-keychain" s.homepage = "https://github.com/oblador/react-native-keychain"
s.license = "MIT" s.license = "MIT"
s.author = { "Joel Arvidsson" => "joel@oblador.se" } s.author = { "Joel Arvidsson" => "joel@oblador.se" }
s.platform = :ios, "7.0" s.ios.deployment_target = '7.0'
s.tvos.deployment_target = '9.0'
s.source = { :git => "https://github.com/oblador/react-native-keychain.git", :tag => "v#{s.version}" } s.source = { :git => "https://github.com/oblador/react-native-keychain.git", :tag => "v#{s.version}" }
s.source_files = 'RNKeychainManager/**/*.{h,m}' s.source_files = 'RNKeychainManager/**/*.{h,m}'
s.preserve_paths = "**/*.js" s.preserve_paths = "**/*.js"

View File

@ -9,6 +9,8 @@
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
5D82368F1B0CE3CB005A9EF3 /* RNKeychainManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D82368C1B0CE2A6005A9EF3 /* RNKeychainManager.m */; }; 5D82368F1B0CE3CB005A9EF3 /* RNKeychainManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D82368C1B0CE2A6005A9EF3 /* RNKeychainManager.m */; };
5D8236911B0CE3D6005A9EF3 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D8236901B0CE3D6005A9EF3 /* Security.framework */; }; 5D8236911B0CE3D6005A9EF3 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D8236901B0CE3D6005A9EF3 /* Security.framework */; };
6478986A1F38BF9D00DA1C12 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 647898691F38BF9D00DA1C12 /* Security.framework */; };
6478986B1F38BFA100DA1C12 /* RNKeychainManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D82368C1B0CE2A6005A9EF3 /* RNKeychainManager.m */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */ /* Begin PBXCopyFilesBuildPhase section */
@ -22,6 +24,15 @@
name = "Copy Files"; name = "Copy Files";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
6478985D1F38BF9100DA1C12 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "include/$(PRODUCT_NAME)";
dstSubfolderSpec = 16;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
@ -29,6 +40,8 @@
5D82368B1B0CE2A6005A9EF3 /* RNKeychainManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNKeychainManager.h; sourceTree = "<group>"; }; 5D82368B1B0CE2A6005A9EF3 /* RNKeychainManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNKeychainManager.h; sourceTree = "<group>"; };
5D82368C1B0CE2A6005A9EF3 /* RNKeychainManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNKeychainManager.m; sourceTree = "<group>"; }; 5D82368C1B0CE2A6005A9EF3 /* RNKeychainManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNKeychainManager.m; sourceTree = "<group>"; };
5D8236901B0CE3D6005A9EF3 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; 5D8236901B0CE3D6005A9EF3 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
6478985F1F38BF9100DA1C12 /* libRNKeychain.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNKeychain.a; sourceTree = BUILT_PRODUCTS_DIR; };
647898691F38BF9D00DA1C12 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS10.2.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
@ -40,15 +53,23 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
6478985C1F38BF9100DA1C12 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
6478986A1F38BF9D00DA1C12 /* Security.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
5D8236661B0CE05B005A9EF3 = { 5D8236661B0CE05B005A9EF3 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
5D8236901B0CE3D6005A9EF3 /* Security.framework */,
5D82368A1B0CE2A6005A9EF3 /* RNKeychainManager */, 5D82368A1B0CE2A6005A9EF3 /* RNKeychainManager */,
5D8236701B0CE05B005A9EF3 /* Products */, 5D8236701B0CE05B005A9EF3 /* Products */,
647898681F38BF9C00DA1C12 /* Frameworks */,
); );
sourceTree = "<group>"; sourceTree = "<group>";
wrapsLines = 0; wrapsLines = 0;
@ -57,6 +78,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
5D82366F1B0CE05B005A9EF3 /* libRNKeychain.a */, 5D82366F1B0CE05B005A9EF3 /* libRNKeychain.a */,
6478985F1F38BF9100DA1C12 /* libRNKeychain.a */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
@ -70,6 +92,15 @@
path = RNKeychainManager; path = RNKeychainManager;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
647898681F38BF9C00DA1C12 /* Frameworks */ = {
isa = PBXGroup;
children = (
5D8236901B0CE3D6005A9EF3 /* Security.framework */,
647898691F38BF9D00DA1C12 /* Security.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */ /* End PBXGroup section */
/* Begin PBXNativeTarget section */ /* Begin PBXNativeTarget section */
@ -90,6 +121,23 @@
productReference = 5D82366F1B0CE05B005A9EF3 /* libRNKeychain.a */; productReference = 5D82366F1B0CE05B005A9EF3 /* libRNKeychain.a */;
productType = "com.apple.product-type.library.static"; productType = "com.apple.product-type.library.static";
}; };
6478985E1F38BF9100DA1C12 /* RNKeychain-tvOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = 647898671F38BF9100DA1C12 /* Build configuration list for PBXNativeTarget "RNKeychain-tvOS" */;
buildPhases = (
6478985B1F38BF9100DA1C12 /* Sources */,
6478985C1F38BF9100DA1C12 /* Frameworks */,
6478985D1F38BF9100DA1C12 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = "RNKeychain-tvOS";
productName = "RNKeychain-tvOS";
productReference = 6478985F1F38BF9100DA1C12 /* libRNKeychain.a */;
productType = "com.apple.product-type.library.static";
};
/* End PBXNativeTarget section */ /* End PBXNativeTarget section */
/* Begin PBXProject section */ /* Begin PBXProject section */
@ -102,6 +150,10 @@
5D82366E1B0CE05B005A9EF3 = { 5D82366E1B0CE05B005A9EF3 = {
CreatedOnToolsVersion = 6.3.1; CreatedOnToolsVersion = 6.3.1;
}; };
6478985E1F38BF9100DA1C12 = {
CreatedOnToolsVersion = 8.3.3;
ProvisioningStyle = Automatic;
};
}; };
}; };
buildConfigurationList = 5D82366A1B0CE05B005A9EF3 /* Build configuration list for PBXProject "RNKeychain" */; buildConfigurationList = 5D82366A1B0CE05B005A9EF3 /* Build configuration list for PBXProject "RNKeychain" */;
@ -117,6 +169,7 @@
projectRoot = ""; projectRoot = "";
targets = ( targets = (
5D82366E1B0CE05B005A9EF3 /* RNKeychain */, 5D82366E1B0CE05B005A9EF3 /* RNKeychain */,
6478985E1F38BF9100DA1C12 /* RNKeychain-tvOS */,
); );
}; };
/* End PBXProject section */ /* End PBXProject section */
@ -130,6 +183,14 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
6478985B1F38BF9100DA1C12 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6478986B1F38BFA100DA1C12 /* RNKeychainManager.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */ /* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */ /* Begin XCBuildConfiguration section */
@ -243,6 +304,40 @@
}; };
name = Release; name = Release;
}; };
647898651F38BF9100DA1C12 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_TESTABILITY = YES;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RNKeychain;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 10.2;
};
name = Debug;
};
647898661F38BF9100DA1C12 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RNKeychain;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 10.2;
};
name = Release;
};
/* End XCBuildConfiguration section */ /* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */ /* Begin XCConfigurationList section */
@ -264,6 +359,15 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
647898671F38BF9100DA1C12 /* Build configuration list for PBXNativeTarget "RNKeychain-tvOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
647898651F38BF9100DA1C12 /* Debug */,
647898661F38BF9100DA1C12 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */ /* End XCConfigurationList section */
}; };
rootObject = 5D8236671B0CE05B005A9EF3 /* Project object */; rootObject = 5D8236671B0CE05B005A9EF3 /* Project object */;

View File

@ -285,6 +285,7 @@ RCT_EXPORT_METHOD(resetInternetCredentialsForServer:(NSString *)server withOptio
} }
#if TARGET_OS_IOS
RCT_EXPORT_METHOD(requestSharedWebCredentials:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) RCT_EXPORT_METHOD(requestSharedWebCredentials:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
{ {
SecRequestSharedWebCredential(NULL, NULL, ^(CFArrayRef credentials, CFErrorRef error) { SecRequestSharedWebCredential(NULL, NULL, ^(CFArrayRef credentials, CFErrorRef error) {
@ -328,5 +329,6 @@ RCT_EXPORT_METHOD(setSharedWebCredentialsForServer:(NSString *)server withUserna
resolve(@(YES)); resolve(@(YES));
}); });
} }
#endif
@end @end