1+ // Copyright 2018 The Chromium 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+ Registers `delegate` to receive life cycle callbacks via this FlutterPluginAppLifecycleDelegate as long as it is alive.
19+
20+ `delegate` will only referenced weakly.
21+ */
22+ - (void )addDelegate : (NSObject <FlutterPlugin>*)delegate ;
23+
24+ /* *
25+ Calls all plugins registered for `UIApplicationDelegate` callbacks.
26+
27+ - Returns: `NO` if any plugin vetoes application launch.
28+ */
29+ - (BOOL )application : (UIApplication*)application
30+ didFinishLaunchingWithOptions : (NSDictionary *)launchOptions ;
31+
32+ /* *
33+ Calls all plugins registered for `UIApplicationDelegate` callbacks.
34+ */
35+ - (void )applicationDidBecomeActive : (UIApplication*)application ;
36+
37+ /* *
38+ Calls all plugins registered for `UIApplicationDelegate` callbacks.
39+ */
40+ - (void )applicationWillResignActive : (UIApplication*)application ;
41+
42+ /* *
43+ Calls all plugins registered for `UIApplicationDelegate` callbacks.
44+ */
45+ - (void )applicationDidEnterBackground : (UIApplication*)application ;
46+
47+ /* *
48+ Calls all plugins registered for `UIApplicationDelegate` callbacks.
49+ */
50+ - (void )applicationWillEnterForeground : (UIApplication*)application ;
51+
52+ /* *
53+ Calls all plugins registered for `UIApplicationDelegate` callbacks.
54+ */
55+ - (void )applicationWillTerminate : (UIApplication*)application ;
56+
57+ /* *
58+ Called if this plugin has been registered for `UIApplicationDelegate` callbacks.
59+ */
60+ - (void )application : (UIApplication*)application
61+ didRegisterUserNotificationSettings : (UIUserNotificationSettings*)notificationSettings ;
62+
63+ /* *
64+ Calls all plugins registered for `UIApplicationDelegate` callbacks.
65+ */
66+ - (void )application : (UIApplication*)application
67+ didRegisterForRemoteNotificationsWithDeviceToken : (NSData *)deviceToken ;
68+
69+ /* *
70+ Calls all plugins registered for `UIApplicationDelegate` callbacks.
71+ */
72+ - (void )application : (UIApplication*)application
73+ didReceiveRemoteNotification : (NSDictionary *)userInfo
74+ fetchCompletionHandler : (void (^)(UIBackgroundFetchResult result))completionHandler ;
75+
76+ /* *
77+ Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until some plugin handles
78+ the request.
79+
80+ - Returns: `YES` if any plugin handles the request.
81+ */
82+ - (BOOL )application : (UIApplication*)application
83+ openURL : (NSURL *)url
84+ options : (NSDictionary <UIApplicationOpenURLOptionsKey, id>*)options ;
85+
86+ /* *
87+ Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until some plugin handles
88+ the request.
89+
90+ - Returns: `YES` if any plugin handles the request.
91+ */
92+ - (BOOL )application : (UIApplication*)application handleOpenURL : (NSURL *)url ;
93+
94+ /* *
95+ Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until some plugin handles
96+ the request.
97+
98+ - Returns: `YES` if any plugin handles the request.
99+ */
100+ - (BOOL )application : (UIApplication*)application
101+ openURL : (NSURL *)url
102+ sourceApplication : (NSString *)sourceApplication
103+ annotation : (id )annotation ;
104+
105+ /* *
106+ Calls all plugins registered for `UIApplicationDelegate` callbacks.
107+ */
108+ - (void )application : (UIApplication*)application
109+ performActionForShortcutItem : (UIApplicationShortcutItem*)shortcutItem
110+ completionHandler : (void (^)(BOOL succeeded))completionHandler
111+ API_AVAILABLE(ios(9.0 ));
112+
113+ /* *
114+ Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until some plugin handles
115+ the request.
116+
117+ - Returns: `YES` if any plugin handles the request.
118+ */
119+ - (BOOL )application : (UIApplication*)application
120+ handleEventsForBackgroundURLSession : (nonnull NSString *)identifier
121+ completionHandler : (nonnull void (^)())completionHandler;
122+
123+ /* *
124+ Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until some plugin handles
125+ the request.
126+
127+ - Returns: `YES` if any plugin handles the request.
128+ */
129+ - (BOOL )application : (UIApplication*)application
130+ performFetchWithCompletionHandler : (void (^)(UIBackgroundFetchResult result))completionHandler ;
131+ @end
132+
133+ NS_ASSUME_NONNULL_END
134+
135+ #endif // FLUTTER_FLUTTERPLUGINAPPLIFECYCLEDELEGATE_H_
0 commit comments