Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright @ 2017-present Atlassian Pty Ltd
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <AVFoundation/AVFoundation.h>
  17. #import <React/RCTBridgeModule.h>
  18. #import <React/RCTLog.h>
  19. #import "InfoPlistUtil.h"
  20. @interface AppInfo : NSObject<RCTBridgeModule>
  21. @end
  22. @implementation AppInfo
  23. RCT_EXPORT_MODULE();
  24. + (BOOL)requiresMainQueueSetup {
  25. return NO;
  26. }
  27. - (NSDictionary *)constantsToExport {
  28. NSDictionary<NSString *, id> *infoDictionary
  29. = [[NSBundle mainBundle] infoDictionary];
  30. // calendarEnabled
  31. BOOL calendarEnabled
  32. = infoDictionary[@"NSCalendarsUsageDescription"] != nil;
  33. // name
  34. NSString *name = infoDictionary[@"CFBundleDisplayName"];
  35. if (name == nil) {
  36. name = infoDictionary[@"CFBundleName"];
  37. if (name == nil) {
  38. name = @"";
  39. }
  40. }
  41. // sdkBundlePath
  42. NSString *sdkBundlePath = [[NSBundle bundleForClass:self.class] bundlePath];
  43. // version
  44. NSString *version = infoDictionary[@"CFBundleShortVersionString"];
  45. if (version == nil) {
  46. version = infoDictionary[@"CFBundleVersion"];
  47. if (version == nil) {
  48. version = @"";
  49. }
  50. }
  51. // build number
  52. NSString *buildNumber = infoDictionary[@"CFBundleVersion"];
  53. if (buildNumber == nil) {
  54. buildNumber = @"";
  55. }
  56. BOOL isGoogleServiceEnabled = [InfoPlistUtil containsRealServiceInfoPlistInBundle:[NSBundle mainBundle]];
  57. return @{
  58. @"calendarEnabled": [NSNumber numberWithBool:calendarEnabled],
  59. @"buildNumber": buildNumber,
  60. @"name": name,
  61. @"sdkBundlePath": sdkBundlePath,
  62. @"version": version,
  63. @"GOOGLE_SERVICES_ENABLED": [NSNumber numberWithBool:isGoogleServiceEnabled]
  64. };
  65. };
  66. @end