From a482753a5b4fe36e0f6a1687e679a536066a2ce1 Mon Sep 17 00:00:00 2001 From: Terrance Wood Date: Wed, 23 Aug 2017 06:17:28 -0700 Subject: [PATCH 1/3] Fixed podspec. --- ios/RNAppMetadata.podspec | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/ios/RNAppMetadata.podspec b/ios/RNAppMetadata.podspec index 29de9b4..a82bf16 100644 --- a/ios/RNAppMetadata.podspec +++ b/ios/RNAppMetadata.podspec @@ -3,22 +3,15 @@ Pod::Spec.new do |s| s.name = "RNAppMetadata" s.version = "1.0.0" s.summary = "RNAppMetadata" - s.description = <<-DESC - RNAppMetadata - DESC - s.homepage = "" + s.description = "Get app metadata from Info.plist (iOS) or AndroidManifest.xml (android)" + s.homepage = "https://github.com/CubeSugar/react-native-app-metadata" s.license = "MIT" # s.license = { :type => "MIT", :file => "FILE_LICENSE" } s.author = { "author" => "author@domain.cn" } s.platform = :ios, "7.0" - s.source = { :git => "https://github.com/author/RNAppMetadata.git", :tag => "master" } + s.source = { :git => "https://github.com/CubeSugar/react-native-app-metadata/releases.git", :tag => "v1.0.0" } s.source_files = "RNAppMetadata/**/*.{h,m}" s.requires_arc = true - - s.dependency "React" - #s.dependency "others" end - - \ No newline at end of file From 81c76e84ca5f56c78e9f86d93b095651190e53ad Mon Sep 17 00:00:00 2001 From: Terrance Wood Date: Wed, 23 Aug 2017 07:00:45 -0700 Subject: [PATCH 2/3] Fixed podspec source_files. --- ios/RNAppMetadata.podspec | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ios/RNAppMetadata.podspec b/ios/RNAppMetadata.podspec index a82bf16..c3fb8e5 100644 --- a/ios/RNAppMetadata.podspec +++ b/ios/RNAppMetadata.podspec @@ -1,4 +1,3 @@ - Pod::Spec.new do |s| s.name = "RNAppMetadata" s.version = "1.0.0" @@ -6,12 +5,10 @@ Pod::Spec.new do |s| s.description = "Get app metadata from Info.plist (iOS) or AndroidManifest.xml (android)" s.homepage = "https://github.com/CubeSugar/react-native-app-metadata" s.license = "MIT" - # s.license = { :type => "MIT", :file => "FILE_LICENSE" } - s.author = { "author" => "author@domain.cn" } + s.author = { "author" => "author@domain.cn" } s.platform = :ios, "7.0" - s.source = { :git => "https://github.com/CubeSugar/react-native-app-metadata/releases.git", :tag => "v1.0.0" } - s.source_files = "RNAppMetadata/**/*.{h,m}" + s.source = { :git => "https://github.com/CubeSugar/react-native-app-metadata.git", :tag => "v1.0.0" } + s.source_files = "*.{h,m}" s.requires_arc = true s.dependency "React" - end From 09064f824c67af837e496273c8fdec613e724789 Mon Sep 17 00:00:00 2001 From: Terrance Wood Date: Wed, 23 Aug 2017 08:37:23 -0700 Subject: [PATCH 3/3] Refactored RNAppMetadata to return mainBundle's infoDictionary via constantsToExport; removed getAppMetadataBy method. --- ios/RNAppMetadata.m | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/ios/RNAppMetadata.m b/ios/RNAppMetadata.m index f5619a2..c0bb3db 100644 --- a/ios/RNAppMetadata.m +++ b/ios/RNAppMetadata.m @@ -15,33 +15,6 @@ - (dispatch_queue_t)methodQueue RCT_EXPORT_MODULE() - (NSDictionary *)constantsToExport { - NSString *iosVersion = [[UIDevice currentDevice] systemVersion]; - NSString *infoDeviceName = [[UIDevice currentDevice] name]; - - return @{ - @"Version": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"], - @"ShortVersion": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"], - @"BundleIdentifier": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"], - @"BundleName": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"], - }; -} - -RCT_REMAP_METHOD(getAppMetadataBy, - key: (NSString*)key - resolver: (RCTPromiseResolveBlock)resolve - rejecter: (RCTPromiseRejectBlock) reject) { - NSString* value = nil; - value = [[NSBundle mainBundle] objectForInfoDictionaryKey: key]; - if (value) { - resolve(value); - } else { - NSError *err = [NSError errorWithDomain:@"RNAppMetadata" - code:1 - userInfo:@{ - NSLocalizedDescriptionKey:@"There is no such key" - }]; - reject(@"key_not_found", @"There is no such key", err); - } + return [NSBundle mainBundle].infoDictionary; } @end -