1 // Copyright 2015-present 650 Industries. All rights reserved. 2 3 #import <UIKit/UIKit.h> 4 5 #import "EXAppBrowserController.h" 6 #import "EXKernelAppRegistry.h" 7 #import "EXKernelServiceRegistry.h" 8 #import "EXKernelUtil.h" 9 #import "EXViewController.h" 10 11 NS_ASSUME_NONNULL_BEGIN 12 13 FOUNDATION_EXPORT NSString *kEXKernelErrorDomain; 14 FOUNDATION_EXPORT const NSUInteger kEXErrorCodeAppForbidden; 15 16 typedef NS_ENUM(NSInteger, EXKernelErrorCode) { 17 EXKernelErrorCodeModuleDeallocated, 18 }; 19 20 // this key is set to YES when crashlytics sends a crash report. 21 FOUNDATION_EXPORT NSString * const kEXKernelClearJSCacheUserDefaultsKey; 22 23 @interface EXKernel : NSObject <EXViewControllerDelegate> 24 25 @property (nonatomic, strong, readonly) EXKernelAppRegistry *appRegistry; 26 @property (nonatomic, strong, readonly) EXKernelServiceRegistry *serviceRegistry; 27 @property (nonatomic, readonly) EXKernelAppRecord *visibleApp; 28 @property (nonatomic, assign) id<EXAppBrowserController> browserController; 29 30 + (instancetype)sharedInstance; 31 32 - (EXKernelAppRecord *)createNewAppWithUrl:(NSURL *)url initialProps:(nullable NSDictionary *)initialProps; 33 - (void)switchTasks; 34 - (void)reloadAppWithExperienceId:(NSString *)experienceId; // called by Updates.reload 35 - (void)reloadAppFromCacheWithExperienceId:(NSString *)experienceId; // called by Updates.reloadFromCache 36 37 /** 38 * Send a notification to a given experience id. 39 */ 40 - (void)sendNotification: (NSDictionary *)notifBody 41 toExperienceWithId: (NSString *)experienceId 42 fromBackground: (BOOL)isFromBackground 43 isRemote: (BOOL)isRemote; 44 45 /** 46 * Initial props to pass to an app based on LaunchOptions from UIApplicationDelegate. 47 */ 48 - (NSDictionary *)initialAppPropsFromLaunchOptions:(NSDictionary *)launchOptions; 49 50 /** 51 * Find and return the (potentially versioned) native module instance belonging to the 52 * specified app manager. Module name is the exported name such as @"AppState". 53 */ 54 - (id)nativeModuleForAppManager:(EXReactAppManager *)appManager named:(NSString *)moduleName; 55 56 /** 57 * Send the given url to this app (via the RN Linking module) and foreground it. 58 */ 59 - (void)sendUrl:(NSString *)url toAppRecord:(EXKernelAppRecord *)app; 60 61 /** 62 * An id that uniquely identifies this installation of Exponent. 63 */ 64 + (NSString *)deviceInstallUUID; 65 66 - (void)logAnalyticsEvent:(NSString *)eventId forAppRecord:(EXKernelAppRecord *)appRecord; 67 68 @end 69 70 NS_ASSUME_NONNULL_END 71