aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase
diff options
context:
space:
mode:
authorGravatar Chen Liang <chliang@google.com>2018-06-29 11:39:45 -0700
committerGravatar GitHub <noreply@github.com>2018-06-29 11:39:45 -0700
commit5e1472b49283e8c2374529ce89edb65ee0e8ea0b (patch)
tree571a2b4132f2e4c92a5081d4c7f6cb606d6296c5 /Firebase
parent7c34f464d8b1d530bba08a3adc5191112adb4ff1 (diff)
Fix the race condition of global data flag and fcm auto init enabled flag (#1466)
Diffstat (limited to 'Firebase')
-rw-r--r--Firebase/Messaging/FIRMessaging+FIRApp.m22
-rw-r--r--Firebase/Messaging/FIRMessaging.m8
-rw-r--r--Firebase/Messaging/FIRMessaging_Private.h3
3 files changed, 2 insertions, 31 deletions
diff --git a/Firebase/Messaging/FIRMessaging+FIRApp.m b/Firebase/Messaging/FIRMessaging+FIRApp.m
index d48a3b4..dda360c 100644
--- a/Firebase/Messaging/FIRMessaging+FIRApp.m
+++ b/Firebase/Messaging/FIRMessaging+FIRApp.m
@@ -26,12 +26,6 @@
#import "FIRMessagingVersionUtilities.h"
#import "FIRMessaging_Private.h"
-@interface FIRMessaging ()
-
-@property(nonatomic, readwrite, strong) NSString *fcmSenderID;
-
-@end
-
@implementation FIRMessaging (FIRApp)
+ (void)load {
@@ -58,22 +52,6 @@
}
- (void)configureMessaging:(FIRApp *)app {
- FIROptions *options = app.options;
- NSError *error;
- if (!options.GCMSenderID.length) {
- error =
- [FIRApp errorForSubspecConfigurationFailureWithDomain:kFirebaseCloudMessagingErrorDomain
- errorCode:FIRErrorCodeCloudMessagingFailed
- service:kFIRServiceMessaging
- reason:@"Google Sender ID must not be nil"
- @" or empty."];
- [self exitApp:app withError:error];
- return;
- }
-
- self.fcmSenderID = [options.GCMSenderID copy];
- self.globalAutomaticDataCollectionEnabled = [app isAutomaticDataCollectionEnabled];
-
// Swizzle remote-notification-related methods (app delegate and UNUserNotificationCenter)
if ([FIRMessagingRemoteNotificationsProxy canSwizzleMethods]) {
NSString *docsURLString = @"https://firebase.google.com/docs/cloud-messaging/ios/client"
diff --git a/Firebase/Messaging/FIRMessaging.m b/Firebase/Messaging/FIRMessaging.m
index fa4bdbc..1152032 100644
--- a/Firebase/Messaging/FIRMessaging.m
+++ b/Firebase/Messaging/FIRMessaging.m
@@ -36,6 +36,7 @@
#import "FIRMessagingUtilities.h"
#import "FIRMessagingVersionUtilities.h"
+#import <FirebaseCore/FIRAppInternal.h>
#import <FirebaseCore/FIRReachabilityChecker.h>
#import <FirebaseInstanceID/FirebaseInstanceID.h>
@@ -127,7 +128,6 @@ NSString *const kFIRMessagingPlistAutoInitEnabled =
FIRReachabilityDelegate>
// FIRApp properties
-@property(nonatomic, readwrite, copy) NSString *fcmSenderID;
@property(nonatomic, readwrite, strong) NSData *apnsTokenData;
@property(nonatomic, readwrite, strong) NSString *defaultFcmToken;
@@ -173,10 +173,6 @@ NSString *const kFIRMessagingPlistAutoInitEnabled =
_loggedMessageIDs = [NSMutableSet set];
_instanceID = instanceID;
_messagingUserDefaults = defaults;
-
- // TODO: Remove this once the race condition with FIRApp configuring and InstanceID
- // is fixed. This must be fixed before Core's flag becomes public.
- _globalAutomaticDataCollectionEnabled = YES;
}
return self;
}
@@ -479,7 +475,7 @@ NSString *const kFIRMessagingPlistAutoInitEnabled =
}
// If none of above exists, we default to the global switch that comes from FIRApp.
- return self.isGlobalAutomaticDataCollectionEnabled;
+ return [[FIRApp defaultApp] isAutomaticDataCollectionEnabled];
}
- (void)setAutoInitEnabled:(BOOL)autoInitEnabled {
diff --git a/Firebase/Messaging/FIRMessaging_Private.h b/Firebase/Messaging/FIRMessaging_Private.h
index 6bac99d..143cc9f 100644
--- a/Firebase/Messaging/FIRMessaging_Private.h
+++ b/Firebase/Messaging/FIRMessaging_Private.h
@@ -38,9 +38,6 @@ FOUNDATION_EXPORT NSString *const kFIRMessagingUserDefaultsKeyAutoInitEnabled;
#pragma mark - Private API
-// The data collection flag from Core.
-@property(nonatomic, readwrite, getter=isGlobalAutomaticDataCollectionEnabled) BOOL globalAutomaticDataCollectionEnabled;
-
- (NSString *)defaultFcmToken;
- (FIRMessagingClient *)client;
- (FIRMessagingPubSub *)pubsub;