xref: /expo/ios/Exponent/ExpoKit/ExpoKit.h (revision 2fde1d7b)
1 // Copyright 2015-present 650 Industries. All rights reserved.
2 
3 @import UIKit;
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  *  Keys to third-party integrations used inside ExpoKit.
34  *  TODO: document this.
35  */
36 @property (nonatomic, strong) NSDictionary *applicationKeys;
37 
38 @property (nonatomic, readonly) NSDictionary *launchOptions;
39 
40 @property (nonatomic, weak) Class moduleRegistryDelegateClass;
41 
42 #pragma mark - remote JS loading hooks
43 
44 /**
45  *  If specified, use this url instead of the one configured in `EXShell.plist`.
46  *  Must be set prior to loading the RN application.
47  */
48 @property (nonatomic, strong, nullable) NSString *publishedManifestUrlOverride;
49 
50 #pragma mark - misc AppDelegate hooks
51 
52 - (void)application:(UIApplication *)application didFinishLaunchingWithOptions:(nullable NSDictionary *)launchOptions;
53 
54 #pragma mark - APNS hooks
55 
56 - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification;
57 - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification;
58 - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)token;
59 - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)err;
60 - (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(nonnull UIUserNotificationSettings *)notificationSettings;
61 
62 #pragma mark - deep linking hooks
63 
64 - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(nullable NSString *)sourceApplication annotation:(id)annotation;
65 - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray * _Nullable))restorationHandler;
66 
67 @end
68 
69 NS_ASSUME_NONNULL_END
70