FlutterPluginAppLifeCycleDelegate.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. #ifndef FLUTTER_FLUTTERPLUGINAPPLIFECYCLEDELEGATE_H_
  5. #define FLUTTER_FLUTTERPLUGINAPPLIFECYCLEDELEGATE_H_
  6. #include "FlutterPlugin.h"
  7. NS_ASSUME_NONNULL_BEGIN
  8. /**
  9. * Propagates `UIAppDelegate` callbacks to registered plugins.
  10. */
  11. FLUTTER_EXPORT
  12. @interface FlutterPluginAppLifeCycleDelegate : NSObject
  13. #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
  14. <UNUserNotificationCenterDelegate>
  15. #endif
  16. /**
  17. * Registers `delegate` to receive life cycle callbacks via this FlutterPluginAppLifecycleDelegate
  18. * as long as it is alive.
  19. *
  20. * `delegate` will only referenced weakly.
  21. */
  22. - (void)addDelegate:(NSObject<FlutterApplicationLifeCycleDelegate>*)delegate;
  23. /**
  24. * Calls all plugins registered for `UIApplicationDelegate` callbacks.
  25. *
  26. * @return `NO` if any plugin vetoes application launch.
  27. */
  28. - (BOOL)application:(UIApplication*)application
  29. didFinishLaunchingWithOptions:(NSDictionary*)launchOptions;
  30. /**
  31. * Calls all plugins registered for `UIApplicationDelegate` callbacks.
  32. *
  33. * @return `NO` if any plugin vetoes application launch.
  34. */
  35. - (BOOL)application:(UIApplication*)application
  36. willFinishLaunchingWithOptions:(NSDictionary*)launchOptions;
  37. /**
  38. * Called if this plugin has been registered for `UIApplicationDelegate` callbacks.
  39. */
  40. - (void)application:(UIApplication*)application
  41. didRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings
  42. API_DEPRECATED(
  43. "See -[UIApplicationDelegate application:didRegisterUserNotificationSettings:] deprecation",
  44. ios(8.0, 10.0));
  45. /**
  46. * Calls all plugins registered for `UIApplicationDelegate` callbacks.
  47. */
  48. - (void)application:(UIApplication*)application
  49. didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken;
  50. /**
  51. * Calls all plugins registered for `UIApplicationDelegate` callbacks.
  52. */
  53. - (void)application:(UIApplication*)application
  54. didReceiveRemoteNotification:(NSDictionary*)userInfo
  55. fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler;
  56. /**
  57. * Calls all plugins registered for `UIApplicationDelegate` callbacks.
  58. */
  59. - (void)application:(UIApplication*)application
  60. didReceiveLocalNotification:(UILocalNotification*)notification
  61. API_DEPRECATED(
  62. "See -[UIApplicationDelegate application:didReceiveLocalNotification:] deprecation",
  63. ios(4.0, 10.0));
  64. /**
  65. * Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until
  66. * some plugin handles the request.
  67. *
  68. * @return `YES` if any plugin handles the request.
  69. */
  70. - (BOOL)application:(UIApplication*)application
  71. openURL:(NSURL*)url
  72. options:(NSDictionary<UIApplicationOpenURLOptionsKey, id>*)options;
  73. /**
  74. * Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until
  75. * some plugin handles the request.
  76. *
  77. * @return `YES` if any plugin handles the request.
  78. */
  79. - (BOOL)application:(UIApplication*)application handleOpenURL:(NSURL*)url;
  80. /**
  81. * Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until
  82. * some plugin handles the request.
  83. *
  84. * @return `YES` if any plugin handles the request.
  85. */
  86. - (BOOL)application:(UIApplication*)application
  87. openURL:(NSURL*)url
  88. sourceApplication:(NSString*)sourceApplication
  89. annotation:(id)annotation;
  90. /**
  91. * Calls all plugins registered for `UIApplicationDelegate` callbacks.
  92. */
  93. - (void)application:(UIApplication*)application
  94. performActionForShortcutItem:(UIApplicationShortcutItem*)shortcutItem
  95. completionHandler:(void (^)(BOOL succeeded))completionHandler
  96. API_AVAILABLE(ios(9.0));
  97. /**
  98. * Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until
  99. * some plugin handles the request.
  100. *
  101. * @return `YES` if any plugin handles the request.
  102. */
  103. - (BOOL)application:(UIApplication*)application
  104. handleEventsForBackgroundURLSession:(nonnull NSString*)identifier
  105. completionHandler:(nonnull void (^)(void))completionHandler;
  106. /**
  107. * Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until
  108. * some plugin handles the request.
  109. *
  110. * @returns `YES` if any plugin handles the request.
  111. */
  112. - (BOOL)application:(UIApplication*)application
  113. performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler;
  114. /**
  115. * Calls all plugins registered for `UIApplicationDelegate` callbacks in order of registration until
  116. * some plugin handles the request.
  117. *
  118. * @return `YES` if any plugin handles the request.
  119. */
  120. - (BOOL)application:(UIApplication*)application
  121. continueUserActivity:(NSUserActivity*)userActivity
  122. restorationHandler:(void (^)(NSArray*))restorationHandler;
  123. @end
  124. NS_ASSUME_NONNULL_END
  125. #endif // FLUTTER_FLUTTERPLUGINAPPLIFECYCLEDELEGATE_H_