| 
				
			 | 
			
			
				@@ -1,6 +1,9 @@ 
			 | 
		
	
		
			
			| 
				1
			 | 
			
				1
			 | 
			
			
				 #import "RNNEventEmitter.h" 
			 | 
		
	
		
			
			| 
				2
			 | 
			
				2
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				3
			 | 
			
				
			 | 
			
			
				-@implementation RNNEventEmitter 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3
			 | 
			
			
				+@implementation RNNEventEmitter { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				4
			 | 
			
			
				+  NSInteger _appLaunchedListenerCount; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				5
			 | 
			
			
				+  BOOL _appLaunchedEventDeferred; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				6
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				4
			 | 
			
				7
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				5
			 | 
			
				8
			 | 
			
			
				 RCT_EXPORT_MODULE(); 
			 | 
		
	
		
			
			| 
				6
			 | 
			
				9
			 | 
			
			
				  
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -16,7 +19,11 @@ static NSString* const onNavigationButtonPressed	= @"RNN.navigationButtonPressed 
			 | 
		
	
		
			
			| 
				16
			 | 
			
				19
			 | 
			
			
				 # pragma mark public 
			 | 
		
	
		
			
			| 
				17
			 | 
			
				20
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				18
			 | 
			
				21
			 | 
			
			
				 -(void)sendOnAppLaunched { 
			 | 
		
	
		
			
			| 
				19
			 | 
			
				
			 | 
			
			
				-	[self send:onAppLaunched body:nil]; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				22
			 | 
			
			
				+	if (_appLaunchedListenerCount > 0) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				23
			 | 
			
			
				+		[self send:onAppLaunched body:nil]; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				24
			 | 
			
			
				+	} else { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				25
			 | 
			
			
				+		_appLaunchedEventDeferred = TRUE; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				26
			 | 
			
			
				+	} 
			 | 
		
	
		
			
			| 
				20
			 | 
			
				27
			 | 
			
			
				 } 
			 | 
		
	
		
			
			| 
				21
			 | 
			
				28
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				22
			 | 
			
				29
			 | 
			
			
				 -(void)sendContainerDidAppear:(NSString *)containerId { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -31,6 +38,17 @@ static NSString* const onNavigationButtonPressed	= @"RNN.navigationButtonPressed 
			 | 
		
	
		
			
			| 
				31
			 | 
			
				38
			 | 
			
			
				 	[self send:onNavigationButtonPressed body:@{@"containerId":containerId , @"buttonId": buttonId }]; 
			 | 
		
	
		
			
			| 
				32
			 | 
			
				39
			 | 
			
			
				 } 
			 | 
		
	
		
			
			| 
				33
			 | 
			
				40
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				
			 | 
			
				41
			 | 
			
			
				+- (void)addListener:(NSString *)eventName { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				42
			 | 
			
			
				+	[super addListener:eventName]; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				43
			 | 
			
			
				+	if ([eventName isEqualToString:onAppLaunched]) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				44
			 | 
			
			
				+		_appLaunchedListenerCount++; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				45
			 | 
			
			
				+		if (_appLaunchedEventDeferred) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				46
			 | 
			
			
				+			_appLaunchedEventDeferred = FALSE; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				47
			 | 
			
			
				+			[self sendOnAppLaunched]; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				48
			 | 
			
			
				+		} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				49
			 | 
			
			
				+	} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				50
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				51
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				34
			 | 
			
				52
			 | 
			
			
				 # pragma mark private 
			 | 
		
	
		
			
			| 
				35
			 | 
			
				53
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				36
			 | 
			
				54
			 | 
			
			
				 -(void)send:(NSString *)eventName body:(id)body { 
			 |