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