FlutterPluginAppLifeCycleDelegate.h 5.0 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef FLUTTER_FLUTTERPLUGINAPPLIFECYCLEDELEGATE_H_
#define FLUTTER_FLUTTERPLUGINAPPLIFECYCLEDELEGATE_H_

#include "FlutterPlugin.h"

NS_ASSUME_NONNULL_BEGIN

/**
 Propagates `UIAppDelegate` callbacks to registered plugins.
*/
FLUTTER_EXPORT
@interface FlutterPluginAppLifeCycleDelegate : NSObject
/**
18 19
 Registers `delegate` to receive life cycle callbacks via this FlutterPluginAppLifecycleDelegate as
 long as it is alive.
20 21 22 23 24 25 26 27 28 29 30 31 32

 `delegate` will only referenced weakly.
*/
- (void)addDelegate:(NSObject<FlutterPlugin>*)delegate;

/**
 Calls all plugins registered for `UIApplicationDelegate` callbacks.

 - Returns: `NO` if any plugin vetoes application launch.
 */
- (BOOL)application:(UIApplication*)application
    didFinishLaunchingWithOptions:(NSDictionary*)launchOptions;

33 34 35 36 37 38 39 40
/**
 Calls all plugins registered for `UIApplicationDelegate` callbacks.

 - Returns: `NO` if any plugin vetoes application launch.
 */
- (BOOL)application:(UIApplication*)application
    willFinishLaunchingWithOptions:(NSDictionary*)launchOptions;

41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
/**
 Calls all plugins registered for `UIApplicationDelegate` callbacks.
 */
- (void)applicationDidBecomeActive:(UIApplication*)application;

/**
 Calls all plugins registered for `UIApplicationDelegate` callbacks.
 */
- (void)applicationWillResignActive:(UIApplication*)application;

/**
 Calls all plugins registered for `UIApplicationDelegate` callbacks.
 */
- (void)applicationDidEnterBackground:(UIApplication*)application;

/**
 Calls all plugins registered for `UIApplicationDelegate` callbacks.
 */
- (void)applicationWillEnterForeground:(UIApplication*)application;

/**
 Calls all plugins registered for `UIApplicationDelegate` callbacks.
 */
- (void)applicationWillTerminate:(UIApplication*)application;

/**
 Called if this plugin has been registered for `UIApplicationDelegate` callbacks.
 */
- (void)application:(UIApplication*)application
    didRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings;

/**
 Calls all plugins registered for `UIApplicationDelegate` callbacks.
 */
- (void)application:(UIApplication*)application
    didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken;

/**
 Calls all plugins registered for `UIApplicationDelegate` callbacks.
 */
- (void)application:(UIApplication*)application
    didReceiveRemoteNotification:(NSDictionary*)userInfo
          fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler;

/**
86 87
 Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until
 some plugin handles the request.
88 89 90 91 92 93 94 95

  - Returns: `YES` if any plugin handles the request.
*/
- (BOOL)application:(UIApplication*)application
            openURL:(NSURL*)url
            options:(NSDictionary<UIApplicationOpenURLOptionsKey, id>*)options;

/**
96 97
 Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until
 some plugin handles the request.
98 99 100 101 102 103

  - Returns: `YES` if any plugin handles the request.
 */
- (BOOL)application:(UIApplication*)application handleOpenURL:(NSURL*)url;

/**
104 105
 Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until
 some plugin handles the request.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122

  - Returns: `YES` if any plugin handles the request.
*/
- (BOOL)application:(UIApplication*)application
              openURL:(NSURL*)url
    sourceApplication:(NSString*)sourceApplication
           annotation:(id)annotation;

/**
 Calls all plugins registered for `UIApplicationDelegate` callbacks.
*/
- (void)application:(UIApplication*)application
    performActionForShortcutItem:(UIApplicationShortcutItem*)shortcutItem
               completionHandler:(void (^)(BOOL succeeded))completionHandler
    API_AVAILABLE(ios(9.0));

/**
123 124
 Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until
 some plugin handles the request.
125 126 127 128 129 130 131 132

  - Returns: `YES` if any plugin handles the request.
*/
- (BOOL)application:(UIApplication*)application
    handleEventsForBackgroundURLSession:(nonnull NSString*)identifier
                      completionHandler:(nonnull void (^)(void))completionHandler;

/**
133 134
 Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until
 some plugin handles the request.
135 136 137 138 139

  - Returns: `YES` if any plugin handles the request.
*/
- (BOOL)application:(UIApplication*)application
    performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler;
140 141

/**
142 143
 Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until
 some plugin handles the request.
144 145 146 147 148
  - Returns: `YES` if any plugin handles the request.
*/
- (BOOL)application:(UIApplication*)application
    continueUserActivity:(NSUserActivity*)userActivity
      restorationHandler:(void (^)(NSArray*))restorationHandler;
149 150 151 152
@end

NS_ASSUME_NONNULL_END

153
#endif  // FLUTTER_FLUTTERPLUGINAPPLIFECYCLEDELEGATE_H_