2017-09-08 09:24:29 +00:00
|
|
|
/*
|
|
|
|
* Copyright @ 2017-present Atlassian Pty Ltd
|
|
|
|
*
|
|
|
|
* 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 <AVFoundation/AVFoundation.h>
|
|
|
|
|
2017-10-18 16:04:31 +00:00
|
|
|
#import <React/RCTBridgeModule.h>
|
|
|
|
#import <React/RCTLog.h>
|
|
|
|
|
2017-09-08 09:24:29 +00:00
|
|
|
@interface AppInfo : NSObject<RCTBridgeModule>
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation AppInfo
|
|
|
|
|
|
|
|
RCT_EXPORT_MODULE();
|
|
|
|
|
2018-05-21 10:35:59 +00:00
|
|
|
+ (BOOL)requiresMainQueueSetup {
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
2017-09-08 09:24:29 +00:00
|
|
|
- (NSDictionary *)constantsToExport {
|
2017-09-27 16:01:27 +00:00
|
|
|
NSDictionary<NSString *, id> *infoDictionary
|
|
|
|
= [[NSBundle mainBundle] infoDictionary];
|
2018-04-13 21:00:54 +00:00
|
|
|
|
|
|
|
// calendarEnabled
|
|
|
|
BOOL calendarEnabled
|
|
|
|
= infoDictionary[@"NSCalendarsUsageDescription"] != nil;
|
|
|
|
|
|
|
|
// name
|
2017-09-27 16:01:27 +00:00
|
|
|
NSString *name = infoDictionary[@"CFBundleDisplayName"];
|
|
|
|
|
2018-01-26 13:24:57 +00:00
|
|
|
if (name == nil) {
|
|
|
|
name = infoDictionary[@"CFBundleName"];
|
|
|
|
if (name == nil) {
|
|
|
|
name = @"";
|
|
|
|
}
|
|
|
|
}
|
2018-04-13 21:00:54 +00:00
|
|
|
|
|
|
|
// sdkBundlePath
|
|
|
|
NSString *sdkBundlePath = [[NSBundle bundleForClass:self.class] bundlePath];
|
|
|
|
|
|
|
|
// version
|
|
|
|
NSString *version = infoDictionary[@"CFBundleShortVersionString"];
|
|
|
|
|
2017-09-08 09:24:29 +00:00
|
|
|
if (version == nil) {
|
2017-09-27 16:01:27 +00:00
|
|
|
version = infoDictionary[@"CFBundleVersion"];
|
2017-09-08 09:24:29 +00:00
|
|
|
if (version == nil) {
|
|
|
|
version = @"";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-02 08:03:01 +00:00
|
|
|
// build number
|
|
|
|
NSString *buildNumber = infoDictionary[@"CFBundleVersion"];
|
|
|
|
if (buildNumber == nil) {
|
|
|
|
buildNumber = @"";
|
|
|
|
}
|
|
|
|
|
2017-09-27 16:01:27 +00:00
|
|
|
return @{
|
2018-04-13 21:00:54 +00:00
|
|
|
@"calendarEnabled": [NSNumber numberWithBool:calendarEnabled],
|
2019-04-02 08:03:01 +00:00
|
|
|
@"buildNumber": buildNumber,
|
2017-09-27 16:01:27 +00:00
|
|
|
@"name": name,
|
2018-04-05 19:12:24 +00:00
|
|
|
@"sdkBundlePath": sdkBundlePath,
|
2017-09-27 16:01:27 +00:00
|
|
|
@"version": version
|
|
|
|
};
|
2017-09-08 09:24:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
@end
|