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 - diff --git a/ios/RNAppMetadata.podspec b/ios/RNAppMetadata.podspec index 29de9b4..c3fb8e5 100644 --- a/ios/RNAppMetadata.podspec +++ b/ios/RNAppMetadata.podspec @@ -1,24 +1,14 @@ - 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.author = { "author" => "author@domain.cn" } s.platform = :ios, "7.0" - s.source = { :git => "https://github.com/author/RNAppMetadata.git", :tag => "master" } - 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" - #s.dependency "others" - end - - \ No newline at end of file