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 - (Class)versionedClassFromString:(NSString *)classString; 36 37 @property (nonatomic, assign) BOOL isHeadless; 38 @property (nonatomic, readonly) BOOL isBridgeRunning; 39 @property (nonatomic, readonly) EXReactAppManagerStatus status; 40 @property (nonatomic, readonly) UIView *rootView; 41 @property (nonatomic, readonly) NSString *scopedDocumentDirectory; 42 @property (nonatomic, readonly) NSString *scopedCachesDirectory; 43 @property (nonatomic, strong) id reactBridge; 44 @property (nonatomic, assign) id<EXReactAppManagerUIDelegate> delegate; 45 @property (nonatomic, weak) EXKernelAppRecord *appRecord; 46 47 #pragma mark - developer tools 48 49 - (BOOL)enablesDeveloperTools; 50 - (BOOL)requiresValidManifests; 51 52 /** 53 * Call reload on existing bridge (developer-facing devtools reload) 54 */ 55 - (void)reloadBridge; 56 57 /** 58 * Clear any executor class on the bridge and reload. Used by Cmd+N devtool key command. 59 */ 60 - (void)disableRemoteDebugging; 61 - (void)toggleRemoteDebugging; 62 - (void)togglePerformanceMonitor; 63 - (void)toggleElementInspector; 64 - (void)showDevMenu; 65 66 /** 67 * Enumerates items for the dev menu for this app 68 */ 69 - (NSDictionary<NSString *, NSString *> *)devMenuItems; 70 - (void)selectDevMenuItemWithKey:(NSString *)key; 71 72 @end 73