@@ -24,14 +24,14 @@ - (void)dealloc
2424}
2525
2626//  TODO: Implement
27- + (void ) setup : (UIApplication *) application 
27+ + (void ) setup : (UIApplication *) application 
2828withLaunchOptions :  (NSDictionary  *) launchOptions 
2929{
3030 NSLog (@" Called setup for firestack with application" 
31- 
31+ 3232 dispatch_once (&onceToken, ^{
3333 [application registerForRemoteNotifications ];
34- 
34+ 3535 [[NSNotificationCenter  defaultCenter ]
3636 postNotificationName: kFirestackInitialized 
3737 object: nil ];
@@ -42,7 +42,7 @@ - (id) init
4242{
4343 self = [super  init ];
4444 if  (self != nil ) {
45-  NSLog (@" Setting up Firestace  instance" 
45+  NSLog (@" Setting up Firestack  instance" 
4646 [Firestack initializeFirestack: self ];
4747 }
4848 return  self;
@@ -52,12 +52,7 @@ + (void) initializeFirestack:(Firestack *) instance
5252{
5353 dispatch_once (&onceToken, ^{
5454 _sharedInstance = instance;
55- 56-  [[NSNotificationCenter  defaultCenter ] addObserver: self 
57-  selector: @selector (reloadFirestack )
58-  name: RCTReloadNotification
59-  object: nil ];
60- 55+ 6156 [[NSNotificationCenter  defaultCenter ]
6257 postNotificationName: kFirestackInitialized 
6358 object: nil ];
@@ -70,15 +65,6 @@ + (instancetype) sharedInstance
7065 return  _sharedInstance;
7166}
7267
73- + (void ) reloadFirestack 
74- {
75-  //  Reloading firestack
76-  onceToken = 0 ; //  not sure if this is a good idea or a bad idea...
77-  [[Firestack sharedInstance ] debugLog: @" Firestack" 
78-  msg: @" Reloading firestack" 
79-  _sharedInstance = nil ;
80- }
81- 8268- (FIRApp *) firebaseApp 
8369{
8470 return  [FIRApp defaultApp ];
@@ -101,7 +87,7 @@ - (FIRApp *) firebaseApp
10187 //  Are we debugging, yo?
10288 self.debug  = [opts valueForKey: @" debug" nil  ? YES  : NO ;
10389 NSLog (@" options passed into configureWithOptions: %@ " valueForKey: @" debug" 
104- 
90+ 10591 NSDictionary  *keyMapping = @{
10692 @" GOOGLE_APP_ID" 
10793 @" appId" 
@@ -158,18 +144,18 @@ - (FIRApp *) firebaseApp
158144 ]
159145 };
160146 NSArray  *optionKeys = [keyMapping allKeys ];
161- 
147+ 162148 NSMutableDictionary  *props;
163- 
149+ 164150 NSString  *plistPath = [[NSBundle  mainBundle ] pathForResource: @" GoogleService-Info" ofType: @" plist" 
165- 
151+ 166152 if  ([[NSFileManager  defaultManager ] fileExistsAtPath: plistPath]) {
167153 //  If the Firebase plist is included
168154 props = [NSMutableDictionary  dictionaryWithContentsOfFile: plistPath];
169155 } else  {
170156 props = [[NSMutableDictionary  alloc ] initWithCapacity: [optionKeys count ]];
171157 }
172- 
158+ 173159 //  Bundle ID either from options OR from the main bundle
174160 NSString  *bundleID;
175161 if  ([opts valueForKey: @" bundleID" 
@@ -178,7 +164,7 @@ - (FIRApp *) firebaseApp
178164 bundleID = [[NSBundle  mainBundle ] bundleIdentifier ];
179165 }
180166 [props setValue: bundleID forKey: @" BUNDLE_ID" 
181- 
167+ 182168 //  Prefer the user configuration options over the default options
183169 for  (int  i=0 ; i < [optionKeys count ]; i++) {
184170 //  Traditional for loop here
@@ -189,9 +175,9 @@ - (FIRApp *) firebaseApp
189175 NSString  *value = [opts valueForKey: key];
190176 [props setValue: value forKey: key];
191177 }
192- 
178+ 193179 NSArray  *possibleNames = [keyMapping objectForKey: key];
194- 
180+ 195181 for  (NSString  *name in possibleNames) {
196182 if  ([opts valueForKey: name] != nil ) {
197183 //  The user passed this option in
@@ -205,7 +191,7 @@ - (FIRApp *) firebaseApp
205191 NSLog (@" An error occurred: %@ " 
206192 }
207193 }
208- 
194+ 209195 @try  {
210196 if  (self.debug ) {
211197 NSLog (@" props ->: %@ " 
@@ -220,7 +206,7 @@ - (FIRApp *) firebaseApp
220206 NSLog (@" STORAGE_BUCKET: %@ " valueForKey: @" STORAGE_BUCKET" 
221207 NSLog (@" DEEP_LINK_SCHEME: %@ " valueForKey: @" DEEP_LINK_SCHEME" 
222208 }
223- 
209+ 224210 FIROptions *finalOptions = [[FIROptions alloc ]
225211 initWithGoogleAppID: [props valueForKey: @" GOOGLE_APP_ID" 
226212 bundleID: [props valueForKey: @" BUNDLE_ID" 
@@ -232,16 +218,16 @@ - (FIRApp *) firebaseApp
232218 databaseURL: [props valueForKey: @" DATABASE_URL" 
233219 storageBucket: [props valueForKey: @" STORAGE_BUCKET" 
234220 deepLinkURLScheme: [props valueForKey: @" DEEP_LINK_SCHEME" 
235- 
221+ 236222 //  Save configuration option
237223 //  NSDictionary *cfg = [self getConfig];
238224 //  [cfg setValuesForKeysWithDictionary:props];
239- 
225+ 240226 //  if (!self.configured) {
241- 
227+ 242228 if  ([FIRApp defaultApp ] == NULL ) {
243229 [FIRApp configureWithOptions: finalOptions];
244-  }
230+  }
245231 [Firestack initializeFirestack: self ];
246232 callback (@[[NSNull  null ], props]);
247233 }
@@ -382,8 +368,8 @@ - (void) debugLog:(NSString *)title
382368//  Not sure how to get away from this... yet
383369- (NSArray <NSString *> *)supportedEvents  {
384370 return  @[
385-  INITIALIZED_EVENT,
386-  DEBUG_EVENT,
371+  INITIALIZED_EVENT,
372+  DEBUG_EVENT,
387373 AUTH_CHANGED_EVENT ];
388374}
389375
0 commit comments