Skip to content

Commit ef5949d

Browse files
authored
Remove unnecessary notification flag (#1993)
* Remove unnecessary notification flag. This was added when the Google pod could configure Firebase but the Google pod is deprecated and can only work with Firebase 3.X. These flags and conditional checks can be safely removed. * Resolve issues from commit split. * Style fixes.
1 parent 69b17eb commit ef5949d

File tree

2 files changed

+7
-35
lines changed

2 files changed

+7
-35
lines changed

Example/Core/Tests/FIRAppTest.m

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323

2424
@interface FIRApp (TestInternal)
2525

26-
@property(nonatomic) BOOL alreadySentConfigureNotification;
27-
@property(nonatomic) BOOL alreadySentDeleteNotification;
28-
2926
+ (void)resetApps;
3027
- (instancetype)initInstanceWithName:(NSString *)name options:(FIROptions *)options;
3128
- (BOOL)configureCore;
@@ -98,7 +95,6 @@ - (void)testConfigure {
9895
XCTAssertEqualObjects(self.app.name, kFIRDefaultAppName);
9996
XCTAssertEqualObjects(self.app.options.clientID, kClientID);
10097
XCTAssertTrue([FIRApp allApps].count == 1);
101-
XCTAssertTrue(self.app.alreadySentConfigureNotification);
10298

10399
// Test if options is nil
104100
id optionsClassMock = OCMClassMock([FIROptions class]);
@@ -268,7 +264,6 @@ - (void)testDeleteApp {
268264
}];
269265

270266
OCMVerifyAll(self.observerMock);
271-
XCTAssertTrue(self.app.alreadySentDeleteNotification);
272267
XCTAssertTrue([FIRApp allApps].count == 0);
273268
}
274269

Firebase/Core/FIRApp.m

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,6 @@
8585

8686
@interface FIRApp ()
8787

88-
@property(nonatomic) BOOL alreadySentConfigureNotification;
89-
90-
@property(nonatomic) BOOL alreadySentDeleteNotification;
91-
9288
#ifdef DEBUG
9389
@property(nonatomic) BOOL alreadyOutputDataCollectionFlag;
9490
#endif // DEBUG
@@ -147,22 +143,13 @@ + (void)configureWithOptions:(FIROptions *)options {
147143
+ (void)configureDefaultAppWithOptions:(FIROptions *)options
148144
sendingNotifications:(BOOL)sendNotifications {
149145
if (sDefaultApp) {
150-
// FIRApp sets up FirebaseAnalytics and does plist validation, but does not cause it
151-
// to fire notifications. So, if the default app already exists, but has not sent out
152-
// configuration notifications, then continue re-initializing it.
153-
if (!sendNotifications || sDefaultApp.alreadySentConfigureNotification) {
154-
[NSException raise:kFirebaseCoreErrorDomain
155-
format:@"Default app has already been configured."];
156-
}
146+
[NSException raise:kFirebaseCoreErrorDomain format:@"Default app has already been configured."];
157147
}
158148
@synchronized(self) {
159149
FIRLogDebug(kFIRLoggerCore, @"I-COR000001", @"Configuring the default app.");
160150
sDefaultApp = [[FIRApp alloc] initInstanceWithName:kFIRDefaultAppName options:options];
161151
[FIRApp addAppToAppDictionary:sDefaultApp];
162-
if (!sDefaultApp.alreadySentConfigureNotification && sendNotifications) {
163-
[FIRApp sendNotificationsToSDKs:sDefaultApp];
164-
sDefaultApp.alreadySentConfigureNotification = YES;
165-
}
152+
[FIRApp sendNotificationsToSDKs:sDefaultApp];
166153
}
167154
}
168155

@@ -196,10 +183,7 @@ + (void)configureWithName:(NSString *)name options:(FIROptions *)options {
196183
FIRLogDebug(kFIRLoggerCore, @"I-COR000002", @"Configuring app named %@", name);
197184
FIRApp *app = [[FIRApp alloc] initInstanceWithName:name options:options];
198185
[FIRApp addAppToAppDictionary:app];
199-
if (!app.alreadySentConfigureNotification) {
200-
[FIRApp sendNotificationsToSDKs:app];
201-
app.alreadySentConfigureNotification = YES;
202-
}
186+
[FIRApp sendNotificationsToSDKs:app];
203187
}
204188
}
205189

@@ -259,13 +243,10 @@ - (void)deleteApp:(FIRAppVoidBoolCallback)completion {
259243
if ([self.name isEqualToString:kFIRDefaultAppName]) {
260244
sDefaultApp = nil;
261245
}
262-
if (!self.alreadySentDeleteNotification) {
263-
NSDictionary *appInfoDict = @{kFIRAppNameKey : self.name};
264-
[[NSNotificationCenter defaultCenter] postNotificationName:kFIRAppDeleteNotification
265-
object:[self class]
266-
userInfo:appInfoDict];
267-
self.alreadySentDeleteNotification = YES;
268-
}
246+
NSDictionary *appInfoDict = @{kFIRAppNameKey : self.name};
247+
[[NSNotificationCenter defaultCenter] postNotificationName:kFIRAppDeleteNotification
248+
object:[self class]
249+
userInfo:appInfoDict];
269250
completion(YES);
270251
} else {
271252
FIRLogError(kFIRLoggerCore, @"I-COR000007", @"App does not exist.");
@@ -296,10 +277,6 @@ - (instancetype)initInstanceWithName:(NSString *)name options:(FIROptions *)opti
296277
_options.editingLocked = YES;
297278
_isDefaultApp = [name isEqualToString:kFIRDefaultAppName];
298279
_container = [[FIRComponentContainer alloc] initWithApp:self];
299-
300-
FIRApp *app = sAllApps[name];
301-
_alreadySentConfigureNotification = app.alreadySentConfigureNotification;
302-
_alreadySentDeleteNotification = app.alreadySentDeleteNotification;
303280
}
304281
return self;
305282
}

0 commit comments

Comments
 (0)