Flutter Engine
The Flutter Engine
Instance Methods | Class Methods | Properties | List of all members
FlutterAppLifecycleRegistrar Class Reference

#import <FlutterAppLifecycleDelegate.h>

Inheritance diagram for FlutterAppLifecycleRegistrar:
<FlutterAppLifecycleDelegate>

Instance Methods

(void) - addDelegate:
 
(void) - removeDelegate:
 
(void) - addObserverFor:selector: [implementation]
 
(instancetype) - init [implementation]
 
- Instance Methods inherited from <FlutterAppLifecycleDelegate>
(void) - handleWillFinishLaunching:
 
(void) - handleDidFinishLaunching:
 
(void) - handleWillBecomeActive:
 
(void) - handleDidBecomeActive:
 
(void) - handleWillResignActive:
 
(void) - handleDidResignActive:
 
(void) - handleWillHide:
 
(void) - handleDidHide:
 
(void) - handleWillUnhide:
 
(void) - handleDidUnhide:
 
(void) - handleDidChangeScreenParameters:
 
(void) - handleDidChangeOcclusionState:
 
(BOOL- handleOpenURLs:
 
(void) - handleWillTerminate:
 

Class Methods

(static BOOL+ IsPowerOfTwo [implementation]
 

Properties

NSPointerArray * delegates [implementation]
 

Detailed Description

Propagates NSAppDelegate callbacks to registered delegates.

Definition at line 126 of file FlutterAppLifecycleDelegate.h.

Method Documentation

◆ addDelegate:

- (void) addDelegate: (NSObject<FlutterAppLifecycleDelegate>*)  delegate

Registers delegate to receive lifecycle callbacks via this FlutterAppLifecycleDelegate as long as it is alive.

delegate will only be referenced weakly.

Definition at line 54 of file FlutterAppLifecycleDelegate.mm.

58 :(NSObject<FlutterAppLifecycleDelegate>*)delegate {
59 [_delegates addPointer:(__bridge void*)delegate];
61 [_delegates compact];
62 }
63}
NSPointerArray * _delegates
int count
Definition: FontMgrTest.cpp:50

◆ addObserverFor:selector:

- (void) addObserverFor: (NSString*)  name
selector: (SEL)  selector 
implementation

Definition at line 1 of file FlutterAppLifecycleDelegate.mm.

18 :(NSString*)name selector:(SEL)selector {
19 [[NSNotificationCenter defaultCenter] addObserver:self selector:selector name:name object:nil];
20}
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

◆ init

- (instancetype) init
implementation

Definition at line 1 of file FlutterAppLifecycleDelegate.mm.

22 {
23 if (self = [super init]) {
24// Using a macro to avoid errors where the notification doesn't match the
25// selector.
26#ifdef OBSERVE_NOTIFICATION
27#error OBSERVE_NOTIFICATION ALREADY DEFINED!
28#else
29#define OBSERVE_NOTIFICATION(SELECTOR) \
30 [self addObserverFor:NSApplication##SELECTOR##Notification selector:@selector(handle##SELECTOR:)]
31#endif
32
33 OBSERVE_NOTIFICATION(WillFinishLaunching);
34 OBSERVE_NOTIFICATION(DidFinishLaunching);
35 OBSERVE_NOTIFICATION(WillBecomeActive);
36 OBSERVE_NOTIFICATION(DidBecomeActive);
37 OBSERVE_NOTIFICATION(WillResignActive);
38 OBSERVE_NOTIFICATION(DidResignActive);
39 OBSERVE_NOTIFICATION(WillTerminate);
40 OBSERVE_NOTIFICATION(WillHide);
41 OBSERVE_NOTIFICATION(DidHide);
42 OBSERVE_NOTIFICATION(WillUnhide);
43 OBSERVE_NOTIFICATION(DidUnhide);
44 OBSERVE_NOTIFICATION(DidChangeScreenParameters);
45 OBSERVE_NOTIFICATION(DidChangeOcclusionState);
46
47#undef OBSERVE_NOTIFICATION
48
49 _delegates = [NSPointerArray weakObjectsPointerArray];
50 }
51 return self;
52}
#define OBSERVE_NOTIFICATION(SELECTOR)

◆ IsPowerOfTwo

+ (static BOOL) IsPowerOfTwo (NSUInteger)  x
implementation

Definition at line 54 of file FlutterAppLifecycleDelegate.mm.

54 {
55 return x != 0 && (x & (x - 1)) == 0;
56}
double x

◆ removeDelegate:

- (void) removeDelegate: (NSObject<FlutterAppLifecycleDelegate>*)  delegate

Unregisters delegate so that it will no longer receive life cycle callbacks via this FlutterAppLifecycleDelegate.

delegate will only be referenced weakly.

Definition at line 54 of file FlutterAppLifecycleDelegate.mm.

65 :(NSObject<FlutterAppLifecycleDelegate>*)delegate {
66 NSUInteger index = [[_delegates allObjects] indexOfObject:delegate];
67 if (index != NSNotFound) {
68 [_delegates removePointerAtIndex:index];
69 }
70}

Property Documentation

◆ delegates

- (NSPointerArray*) delegates
readwritenonatomicstrongimplementation

Registered delegates. Exposed to allow FlutterAppDelegate to share the delegate list for handling non-notification delegation.

Definition at line 15 of file FlutterAppLifecycleDelegate_Internal.h.


The documentation for this class was generated from the following files: