xref: /expo/ios/Exponent/ExpoKit/ExpoKit.h (revision c615fa2e)
1 // Copyright 2015-present 650 Industries. All rights reserved.
2 
3 #import <UIKit/UIKit.h>
4 
5 NS_ASSUME_NONNULL_BEGIN
6 
7 FOUNDATION_EXPORT NSString * const EXAppDidRegisterForRemoteNotificationsNotification;
8 FOUNDATION_EXPORT NSString * const EXAppDidRegisterUserNotificationSettingsNotification;
9 
10 @class EXViewController;
11 
12 @interface ExpoKit : NSObject
13 
14 + (instancetype)sharedInstance;
15 
16 /**
17  *  Register an EXViewController subclass as the root class.
18  *  This must be the first method called on ExpoKit's singleton instance to make any difference.
19  */
20 - (void)registerRootViewControllerClass:(Class)rootViewControllerClass;
21 
22 /**
23  *  The root Exponent view controller hosting a detached Exponent app.
24  */
25 - (EXViewController *)rootViewController;
26 
27 /**
28  *  The current view controller that is presented by Exponent app.
29  */
30 - (UIViewController *)currentViewController;
31 
32 /**
33  *  Set up dependencies that need to be initialized before app delegates.
34  */
35 - (void)prepareWithLaunchOptions:(nullable NSDictionary *)launchOptions;
36 
37 /**
38  *  Keys to third-party integrations used inside ExpoKit.
39  *  TODO: document this.
40  */
41 @property (nonatomic, strong) NSDictionary *applicationKeys;
42 
43 @property (nonatomic, readonly) NSDictionary *launchOptions;
44 
45 @property (nonatomic, weak) Class moduleRegistryDelegateClass;
46 
47 #pragma mark - remote JS loading hooks
48 
49 /**
50  *  If specified, use this url instead of the one configured in `EXShell.plist`.
51  *  Must be set prior to loading the RN application.
52  */
53 @property (nonatomic, strong, nullable) NSString *publishedManifestUrlOverride;
54 
55 #pragma mark - misc AppDelegate hooks
56 
57 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(nullable NSDictionary *)launchOptions;
58 
59 #pragma mark - APNS hooks
60 
61 - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)token;
62 - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)err;
63 - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler;
64 
65 #pragma mark - deep linking hooks
66 - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(nullable NSString *)sourceApplication annotation:(id)annotation;
67 - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray * _Nullable))restorationHandler;
68 
69 @end
70 
71 NS_ASSUME_NONNULL_END
72