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 #import "EXPendingNotification.h" 11 12 NS_ASSUME_NONNULL_BEGIN 13 14 FOUNDATION_EXPORT NSString *kEXKernelErrorDomain; 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 given notification. 39 * Returns whether the notification has been successfully sent to a running experience. 40 */ 41 - (BOOL)sendNotification:(EXPendingNotification *)notification; 42 43 /** 44 * Initial props to pass to an app based on LaunchOptions from UIApplicationDelegate. 45 */ 46 - (nullable NSDictionary *)initialAppPropsFromLaunchOptions:(NSDictionary *)launchOptions; 47 48 /** 49 * Find and return the (potentially versioned) native module instance belonging to the 50 * specified app manager. Module name is the exported name such as @"AppState". 51 */ 52 - (id)nativeModuleForAppManager:(EXReactAppManager *)appManager named:(NSString *)moduleName; 53 54 /** 55 * Send the given url to this app (via the RN Linking module) and foreground it. 56 */ 57 - (void)sendUrl:(NSString *)url toAppRecord:(EXKernelAppRecord *)app; 58 59 /** 60 * An id that uniquely identifies this installation of Exponent. 61 */ 62 + (NSString *)deviceInstallUUID; 63 64 - (void)logAnalyticsEvent:(NSString *)eventId forAppRecord:(EXKernelAppRecord *)appRecord; 65 66 @end 67 68 NS_ASSUME_NONNULL_END 69