1 // Copyright 2013 The Flutter Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef FLUTTER_FLUTTERPLUGINAPPLIFECYCLEDELEGATE_H_ 6 #define FLUTTER_FLUTTERPLUGINAPPLIFECYCLEDELEGATE_H_ 7 8 #include "FlutterPlugin.h" 9 10 NS_ASSUME_NONNULL_BEGIN 11 12 /** 13 * Propagates `UIAppDelegate` callbacks to registered plugins. 14 */ 15 FLUTTER_EXPORT 16 @interface FlutterPluginAppLifeCycleDelegate : NSObject 17 18 /** 19 * Registers `delegate` to receive life cycle callbacks via this FlutterPluginAppLifecycleDelegate 20 * as long as it is alive. 21 * 22 * `delegate` will only referenced weakly. 23 */ 24 - (void)addDelegate:(NSObject<FlutterApplicationLifeCycleDelegate>*)delegate; 25 26 /** 27 * Calls all plugins registered for `UIApplicationDelegate` callbacks. 28 * 29 * @return `NO` if any plugin vetoes application launch. 30 */ 31 - (BOOL)application:(UIApplication*)application 32 didFinishLaunchingWithOptions:(NSDictionary*)launchOptions; 33 34 /** 35 * Calls all plugins registered for `UIApplicationDelegate` callbacks. 36 * 37 * @return `NO` if any plugin vetoes application launch. 38 */ 39 - (BOOL)application:(UIApplication*)application 40 willFinishLaunchingWithOptions:(NSDictionary*)launchOptions; 41 42 /** 43 * Called if this plugin has been registered for `UIApplicationDelegate` callbacks. 44 */ 45 - (void)application:(UIApplication*)application 46 didRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings 47 API_DEPRECATED( 48 "See -[UIApplicationDelegate application:didRegisterUserNotificationSettings:] deprecation", 49 ios(8.0, 10.0)); 50 51 /** 52 * Calls all plugins registered for `UIApplicationDelegate` callbacks. 53 */ 54 - (void)application:(UIApplication*)application 55 didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken; 56 57 /** 58 * Calls all plugins registered for `UIApplicationDelegate` callbacks. 59 */ 60 - (void)application:(UIApplication*)application 61 didReceiveRemoteNotification:(NSDictionary*)userInfo 62 fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler; 63 64 /** 65 * Calls all plugins registered for `UIApplicationDelegate` callbacks. 66 */ 67 - (void)application:(UIApplication*)application 68 didReceiveLocalNotification:(UILocalNotification*)notification 69 API_DEPRECATED( 70 "See -[UIApplicationDelegate application:didReceiveLocalNotification:] deprecation", 71 ios(4.0, 10.0)); 72 73 /** 74 * Calls all plugins registered for `UNUserNotificationCenterDelegate` callbacks. 75 */ 76 - (void)userNotificationCenter:(UNUserNotificationCenter*)center 77 willPresentNotification:(UNNotification*)notification 78 withCompletionHandler: 79 (void (^)(UNNotificationPresentationOptions options))completionHandler 80 API_AVAILABLE(ios(10)); 81 82 /** 83 * Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until 84 * some plugin handles the request. 85 * 86 * @return `YES` if any plugin handles the request. 87 */ 88 - (BOOL)application:(UIApplication*)application 89 openURL:(NSURL*)url 90 options:(NSDictionary<UIApplicationOpenURLOptionsKey, id>*)options; 91 92 /** 93 * Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until 94 * some plugin handles the request. 95 * 96 * @return `YES` if any plugin handles the request. 97 */ 98 - (BOOL)application:(UIApplication*)application handleOpenURL:(NSURL*)url; 99 100 /** 101 * Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until 102 * some plugin handles the request. 103 * 104 * @return `YES` if any plugin handles the request. 105 */ 106 - (BOOL)application:(UIApplication*)application 107 openURL:(NSURL*)url 108 sourceApplication:(NSString*)sourceApplication 109 annotation:(id)annotation; 110 111 /** 112 * Calls all plugins registered for `UIApplicationDelegate` callbacks. 113 */ 114 - (void)application:(UIApplication*)application 115 performActionForShortcutItem:(UIApplicationShortcutItem*)shortcutItem 116 completionHandler:(void (^)(BOOL succeeded))completionHandler 117 API_AVAILABLE(ios(9.0)); 118 119 /** 120 * Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until 121 * some plugin handles the request. 122 * 123 * @return `YES` if any plugin handles the request. 124 */ 125 - (BOOL)application:(UIApplication*)application 126 handleEventsForBackgroundURLSession:(nonnull NSString*)identifier 127 completionHandler:(nonnull void (^)(void))completionHandler; 128 129 /** 130 * Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until 131 * some plugin handles the request. 132 * 133 * @returns `YES` if any plugin handles the request. 134 */ 135 - (BOOL)application:(UIApplication*)application 136 performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler; 137 138 /** 139 * Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until 140 * some plugin handles the request. 141 * 142 * @return `YES` if any plugin handles the request. 143 */ 144 - (BOOL)application:(UIApplication*)application 145 continueUserActivity:(NSUserActivity*)userActivity 146 restorationHandler:(void (^)(NSArray*))restorationHandler; 147 @end 148 149 NS_ASSUME_NONNULL_END 150 151 #endif // FLUTTER_FLUTTERPLUGINAPPLIFECYCLEDELEGATE_H_ 152