react-native-firebase/ios/RNFirebase/RNFirebase.m

36 lines
794 B
Mathematica
Raw Normal View History

2017-03-09 15:26:28 +00:00
#import "RNFirebase.h"
#import "RNFirebaseEvents.h"
static dispatch_once_t onceToken;
@implementation RNFirebase
RCT_EXPORT_MODULE(RNFirebase);
2017-03-09 15:26:28 +00:00
- (void)dealloc {
2017-03-09 15:26:28 +00:00
NSLog(@"Dealloc called on RNFirebase: %@", self);
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (id)init {
2017-03-09 15:26:28 +00:00
self = [super init];
if (self != nil) {
NSLog(@"Setting up RNFirebase instance");
[RNFirebase initializeRNFirebase];
2017-03-09 15:26:28 +00:00
}
return self;
}
+ (void)initializeRNFirebase {
#if __has_include(<FirebaseMessaging/FirebaseMessaging.h>)
2017-03-09 15:26:28 +00:00
dispatch_once(&onceToken, ^{
[[NSNotificationCenter defaultCenter] postNotificationName:kRNFirebaseInitialized object:nil];
2017-03-09 15:26:28 +00:00
});
#endif
2017-03-09 15:26:28 +00:00
}
- (NSArray<NSString *> *)supportedEvents {
return @[INITIALIZED_EVENT];
2017-03-09 15:26:28 +00:00
}
@end