xref: /expo/ios/Exponent/ExpoKit/ExpoKit.h (revision cb0e1ce3)
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 // TODO: Remove once SDK31 is phased out
56 #pragma clang diagnostic push
57 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
58 - (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(nonnull UIUserNotificationSettings *)notificationSettings;
59 #pragma clang diagnostic pop
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