// // ShareRocketChatRN.m // ShareRocketChatRN // // Created by Djorkaeff Alexandre Vilela Pereira on 16/05/19. // Copyright © 2019 Facebook. All rights reserved. // #import #import "ReactNativeShareExtension.h" #import #import #import #import #import #import #import #import @interface ShareRocketChatRN : ReactNativeShareExtension @property (nonatomic, strong) UMModuleRegistryAdapter *moduleRegistryAdapter; @end @implementation ShareRocketChatRN RCT_EXPORT_MODULE(); - (UIView*) shareView { NSURL *jsCodeLocation; if(![FIRApp defaultApp]){ [FIRApp configure]; } self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]]; jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:nil]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"ShareRocketChatRN" initialProperties:nil]; rootView.backgroundColor = nil; // Uncomment for console output in Xcode console for release mode on device: // RCTSetLogThreshold(RCTLogLevelInfo - 1); // AppGroup MMKV NSString *groupDir = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"AppGroup"]].path; [MMKV initializeMMKV:nil groupDir:groupDir logLevel:MMKVLogNone]; return rootView; } - (NSArray> *)extraModulesForBridge:(RCTBridge *)bridge { NSArray> *extraModules = [_moduleRegistryAdapter extraModulesForBridge:bridge]; // You can inject any extra modules that you would like here, more information at: // https://facebook.github.io/react-native/docs/native-modules-ios.html#dependency-injection return extraModules; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; #else return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; #endif } @end