aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase/Messaging/FIRMessagingClient.m
diff options
context:
space:
mode:
Diffstat (limited to 'Firebase/Messaging/FIRMessagingClient.m')
-rw-r--r--Firebase/Messaging/FIRMessagingClient.m26
1 files changed, 10 insertions, 16 deletions
diff --git a/Firebase/Messaging/FIRMessagingClient.m b/Firebase/Messaging/FIRMessagingClient.m
index d36778d..0bfb5a8 100644
--- a/Firebase/Messaging/FIRMessagingClient.m
+++ b/Firebase/Messaging/FIRMessagingClient.m
@@ -185,7 +185,6 @@ static NSUInteger FIRMessagingServerPort() {
handler(error);
};
- [self.registrar tryToLoadValidCheckinInfo];
[self.registrar updateSubscriptionToTopic:topic
withToken:token
options:options
@@ -266,7 +265,6 @@ static NSUInteger FIRMessagingServerPort() {
}
self.lastDisconnectedTimestamp = FIRMessagingCurrentTimestampInMilliseconds();
self.connectHandler = handler;
- [self.registrar tryToLoadValidCheckinInfo];
[self connect];
}
@@ -279,21 +277,17 @@ static NSUInteger FIRMessagingServerPort() {
}
self.stayConnected = YES;
- BOOL isRegistrationComplete = [self.registrar hasValidCheckinInfo];
-
- if (!isRegistrationComplete) {
- if (![self.registrar tryToLoadValidCheckinInfo]) {
- // Checkin info is not available. This may be due to the checkin still being fetched.
- if (self.connectHandler) {
- NSError *error = [NSError errorWithFCMErrorCode:kFIRMessagingErrorCodeMissingDeviceID];
- self.connectHandler(error);
- }
- FIRMessagingLoggerDebug(kFIRMessagingMessageCodeClient009,
- @"Failed to connect to MCS. No deviceID and secret found.");
- // Return for now. If checkin is, in fact, retrieved, the
- // |kFIRMessagingCheckinFetchedNotification| will be fired.
- return;
+ if (![self.registrar tryToLoadValidCheckinInfo]) {
+ // Checkin info is not available. This may be due to the checkin still being fetched.
+ if (self.connectHandler) {
+ NSError *error = [NSError errorWithFCMErrorCode:kFIRMessagingErrorCodeMissingDeviceID];
+ self.connectHandler(error);
}
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeClient009,
+ @"Failed to connect to MCS. No deviceID and secret found.");
+ // Return for now. If checkin is, in fact, retrieved, the
+ // |kFIRMessagingCheckinFetchedNotification| will be fired.
+ return;
}
[self setupConnectionAndConnect];
}