1 2 #import <UIKit/UIKit.h> 3 #import "EXAppFetcher.h" 4 #import "EXKernelAppRecord.h" 5 6 typedef enum EXReactAppManagerStatus { 7 kEXReactAppManagerStatusNew, 8 kEXReactAppManagerStatusBridgeLoading, 9 kEXReactAppManagerStatusRunning, 10 kEXReactAppManagerStatusError, 11 } EXReactAppManagerStatus; 12 13 @protocol EXReactAppManagerUIDelegate <NSObject> 14 15 - (void)reactAppManagerIsReadyForLoad:(EXReactAppManager *)appManager; 16 - (void)reactAppManagerStartedLoadingJavaScript:(EXReactAppManager *)appManager; 17 - (void)reactAppManagerFinishedLoadingJavaScript:(EXReactAppManager *)appManager; 18 - (void)reactAppManagerAppContentDidAppear:(EXReactAppManager *)appManager; 19 - (void)reactAppManagerAppContentWillReload:(EXReactAppManager *)appManager; 20 - (void)reactAppManager:(EXReactAppManager *)appManager failedToLoadJavaScriptWithError:(NSError *)error; 21 - (void)reactAppManagerDidInvalidate:(EXReactAppManager *)appManager; 22 23 @end 24 25 @interface EXReactAppManager : NSObject <EXAppFetcherDataSource> 26 27 - (instancetype)initWithAppRecord:(EXKernelAppRecord *)record initialProps:(NSDictionary *)initialProps; 28 - (void)rebuildBridge; 29 - (void)invalidate; 30 31 // these are piped in from the view controller when the app manager is waiting for a bundle. 32 - (void)appLoaderFinished; 33 - (void)appLoaderFailedWithError:(NSError *)error; 34 35 // these are piped in from the view controller when the app becomes visible or moves to background. 36 - (void)appStateDidBecomeActive; 37 - (void)appStateDidBecomeInactive; 38 39 @property (nonatomic, assign) BOOL isHeadless; 40 @property (nonatomic, readonly) BOOL isBridgeRunning; 41 @property (nonatomic, readonly) EXReactAppManagerStatus status; 42 @property (nonatomic, readonly) UIView *rootView; 43 @property (nonatomic, readonly) NSString *scopedDocumentDirectory; 44 @property (nonatomic, readonly) NSString *scopedCachesDirectory; 45 @property (nonatomic, strong) id reactBridge; 46 @property (nonatomic, assign) id<EXReactAppManagerUIDelegate> delegate; 47 @property (nonatomic, weak) EXKernelAppRecord *appRecord; 48 49 #pragma mark - developer tools 50 51 - (BOOL)enablesDeveloperTools; 52 - (BOOL)requiresValidManifests; 53 54 /** 55 * Call reload on existing bridge (developer-facing devtools reload) 56 */ 57 - (void)reloadBridge; 58 59 /** 60 * Clear any executor class on the bridge and reload. Used by Cmd+N devtool key command. 61 */ 62 - (void)disableRemoteDebugging; 63 - (void)toggleRemoteDebugging; 64 - (void)togglePerformanceMonitor; 65 - (void)toggleElementInspector; 66 - (void)showDevMenu; 67 68 /** 69 * Enumerates items for the dev menu for this app 70 */ 71 - (NSDictionary<NSString *, NSString *> *)devMenuItems; 72 - (void)selectDevMenuItemWithKey:(NSString *)key; 73 74 @end 75