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)reactAppManager:(EXReactAppManager *)appManager failedToLoadJavaScriptWithError:(NSError *)error; 19 - (void)reactAppManagerDidInvalidate:(EXReactAppManager *)appManager; 20 21 @end 22 23 @interface EXReactAppManager : NSObject <EXAppFetcherDataSource> 24 25 - (instancetype)initWithAppRecord:(EXKernelAppRecord *)record initialProps:(NSDictionary *)initialProps; 26 - (void)rebuildBridge; 27 - (void)invalidate; 28 29 // these are piped in from the view controller when the app manager is waiting for a bundle. 30 - (void)appLoaderFinished; 31 - (void)appLoaderFailedWithError:(NSError *)error; 32 33 // these are piped in from the view controller when the app becomes visible or moves to background. 34 - (void)appStateDidBecomeActive; 35 - (void)appStateDidBecomeInactive; 36 37 @property (nonatomic, readonly) BOOL isBridgeRunning; 38 @property (nonatomic, readonly) EXReactAppManagerStatus status; 39 @property (nonatomic, readonly) UIView *rootView; 40 @property (nonatomic, strong) id reactBridge; 41 @property (nonatomic, assign) id<EXReactAppManagerUIDelegate> delegate; 42 @property (nonatomic, weak) EXKernelAppRecord *appRecord; 43 44 #pragma mark - developer tools 45 46 - (BOOL)enablesDeveloperTools; 47 - (BOOL)requiresValidManifests; 48 49 /** 50 * Call reload on existing bridge (developer-facing devtools reload) 51 */ 52 - (void)reloadBridge; 53 54 /** 55 * Clear any executor class on the bridge and reload. Used by Cmd+N devtool key command. 56 */ 57 - (void)disableRemoteDebugging; 58 - (void)toggleElementInspector; 59 - (void)showDevMenu; 60 61 /** 62 * Enumerates items for the dev menu for this app 63 */ 64 - (NSDictionary<NSString *, NSString *> *)devMenuItems; 65 - (void)selectDevMenuItemWithKey:(NSString *)key; 66 67 @end 68