Flutter Engine
The Flutter Engine
FlutterAppLifecycleDelegate.h
Go to the documentation of this file.
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_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_HEADERS_FLUTTERAPPLIFECYCLEDELEGATE_H_
6#define FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_HEADERS_FLUTTERAPPLIFECYCLEDELEGATE_H_
7
8#import <Cocoa/Cocoa.h>
9#include <Foundation/Foundation.h>
10
11#import "FlutterMacros.h"
12
14
15#pragma mark -
16/**
17 * Protocol for listener of lifecycle events from the NSApplication, typically a
18 * FlutterPlugin.
19 */
21@protocol FlutterAppLifecycleDelegate <NSObject>
22
23@optional
24/**
25 * Called when the |FlutterAppDelegate| gets the applicationWillFinishLaunching
26 * notification.
27 */
28- (void)handleWillFinishLaunching:(NSNotification*)notification;
29
30/**
31 * Called when the |FlutterAppDelegate| gets the applicationDidFinishLaunching
32 * notification.
33 */
34- (void)handleDidFinishLaunching:(NSNotification*)notification;
35
36/**
37 * Called when the |FlutterAppDelegate| gets the applicationWillBecomeActive
38 * notification.
39 */
40- (void)handleWillBecomeActive:(NSNotification*)notification;
41
42/**
43 * Called when the |FlutterAppDelegate| gets the applicationDidBecomeActive
44 * notification.
45 */
46- (void)handleDidBecomeActive:(NSNotification*)notification;
47
48/**
49 * Called when the |FlutterAppDelegate| gets the applicationWillResignActive
50 * notification.
51 */
52- (void)handleWillResignActive:(NSNotification*)notification;
53
54/**
55 * Called when the |FlutterAppDelegate| gets the applicationWillResignActive
56 * notification.
57 */
58- (void)handleDidResignActive:(NSNotification*)notification;
59
60/**
61 * Called when the |FlutterAppDelegate| gets the applicationWillHide
62 * notification.
63 */
64- (void)handleWillHide:(NSNotification*)notification;
65
66/**
67 * Called when the |FlutterAppDelegate| gets the applicationDidHide
68 * notification.
69 */
70- (void)handleDidHide:(NSNotification*)notification;
71
72/**
73 * Called when the |FlutterAppDelegate| gets the applicationWillUnhide
74 * notification.
75 */
76- (void)handleWillUnhide:(NSNotification*)notification;
77
78/**
79 * Called when the |FlutterAppDelegate| gets the applicationDidUnhide
80 * notification.
81 */
82- (void)handleDidUnhide:(NSNotification*)notification;
83
84/**
85 * Called when the |FlutterAppDelegate| gets the applicationDidUnhide
86 * notification.
87 */
88- (void)handleDidChangeScreenParameters:(NSNotification*)notification;
89
90/**
91 * Called when the |FlutterAppDelegate| gets the applicationDidUnhide
92 * notification.
93 */
94- (void)handleDidChangeOcclusionState:(NSNotification*)notification;
95
96/**
97 * Called when the |FlutterAppDelegate| gets the application:openURLs:
98 * callback.
99 *
100 * Implementers should return YES if they handle the URLs, otherwise NO.
101 * Delegates will be called in order of registration, and once a delegate
102 * returns YES, no further delegates will reiceve this callback.
103 */
104- (BOOL)handleOpenURLs:(NSArray<NSURL*>*)urls;
105
106/**
107 * Called when the |FlutterAppDelegate| gets the applicationWillTerminate
108 * notification.
109 *
110 * Applications should not rely on always receiving all possible notifications.
111 *
112 * For example, if the application is killed with a task manager, a kill signal,
113 * the user pulls the power from the device, or there is a rapid unscheduled
114 * disassembly of the device, no notification will be sent before the
115 * application is suddenly terminated, and this notification may be skipped.
116 */
117- (void)handleWillTerminate:(NSNotification*)notification;
118@end
119
120#pragma mark -
121
122/**
123 * Propagates `NSAppDelegate` callbacks to registered delegates.
124 */
127
128/**
129 * Registers `delegate` to receive lifecycle callbacks via this
130 * FlutterAppLifecycleDelegate as long as it is alive.
131 *
132 * `delegate` will only be referenced weakly.
133 */
134- (void)addDelegate:(NSObject<FlutterAppLifecycleDelegate>*)delegate;
135
136/**
137 * Unregisters `delegate` so that it will no longer receive life cycle callbacks
138 * via this FlutterAppLifecycleDelegate.
139 *
140 * `delegate` will only be referenced weakly.
141 */
142- (void)removeDelegate:(NSObject<FlutterAppLifecycleDelegate>*)delegate;
143@end
144
146
147#endif // FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_HEADERS_FLUTTERAPPLIFECYCLEDELEGATE_H_
#define NS_ASSUME_NONNULL_BEGIN
Definition: FlutterMacros.h:19
#define NS_ASSUME_NONNULL_END
Definition: FlutterMacros.h:20
#define FLUTTER_DARWIN_EXPORT
Definition: FlutterMacros.h:14
int BOOL
Definition: windows_types.h:37