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