diff options
Diffstat (limited to 'Firebase')
-rw-r--r-- | Firebase/Database/Core/FPersistentConnection.m | 16 | ||||
-rw-r--r-- | Firebase/Database/Core/FRepo.m | 4 | ||||
-rw-r--r-- | Firebase/Messaging/FIRMessaging.m | 12 | ||||
-rw-r--r-- | Firebase/Messaging/Public/FIRMessaging.h | 13 |
4 files changed, 16 insertions, 29 deletions
diff --git a/Firebase/Database/Core/FPersistentConnection.m b/Firebase/Database/Core/FPersistentConnection.m index 870727c..c32d18c 100644 --- a/Firebase/Database/Core/FPersistentConnection.m +++ b/Firebase/Database/Core/FPersistentConnection.m @@ -735,18 +735,22 @@ static void reachabilityCallback(SCNetworkReachabilityRef ref, SCNetworkReachabi } - (void) cancelSentTransactions { - NSMutableArray* toPrune = [[NSMutableArray alloc] init]; + NSMutableDictionary<NSNumber*, FOutstandingPut*>* cancelledOutstandingPuts = [[NSMutableDictionary alloc] init]; + for (NSNumber* index in self.outstandingPuts) { FOutstandingPut* put = self.outstandingPuts[index]; if (put.request[kFWPRequestHash] && put.sent) { - // This is a sent transaction put - put.onCompleteBlock(kFTransactionDisconnect, @"Client was disconnected while running a transaction"); - [toPrune addObject:index]; + // This is a sent transaction put. + cancelledOutstandingPuts[index] = put; } } - for (NSNumber* index in toPrune) { + + [cancelledOutstandingPuts enumerateKeysAndObjectsUsingBlock:^(NSNumber *index, FOutstandingPut *outstandingPut, BOOL *stop) { + // `onCompleteBlock:` may invoke `rerunTransactionsForPath:` and enqueue new writes. We defer calling + // it until we have finished enumerating all existing writes. + outstandingPut.onCompleteBlock(kFTransactionDisconnect, @"Client was disconnected while running a transaction"); [self.outstandingPuts removeObjectForKey:index]; - } + }]; } - (void) onDataPushWithAction:(NSString *)action andBody:(NSDictionary *)body { diff --git a/Firebase/Database/Core/FRepo.m b/Firebase/Database/Core/FRepo.m index 1c4b956..ae1d8e8 100644 --- a/Firebase/Database/Core/FRepo.m +++ b/Firebase/Database/Core/FRepo.m @@ -513,11 +513,11 @@ } - (void)onConnect:(FPersistentConnection *)fpconnection { - [self updateInfo:kDotInfoConnected withValue:@true]; + [self updateInfo:kDotInfoConnected withValue:@YES]; } - (void)onDisconnect:(FPersistentConnection *)fpconnection { - [self updateInfo:kDotInfoConnected withValue:@false]; + [self updateInfo:kDotInfoConnected withValue:@NO]; [self runOnDisconnectEvents]; } diff --git a/Firebase/Messaging/FIRMessaging.m b/Firebase/Messaging/FIRMessaging.m index e02a125..15561d5 100644 --- a/Firebase/Messaging/FIRMessaging.m +++ b/Firebase/Messaging/FIRMessaging.m @@ -142,7 +142,9 @@ FIRInstanceIDAPNSTokenType FIRIIDAPNSTokenTypeFromAPNSTokenType(FIRMessagingAPNS @end @interface FIRMessaging ()<FIRMessagingClientDelegate, FIRMessagingReceiverDelegate, - FIRReachabilityDelegate> + FIRReachabilityDelegate> { + BOOL _shouldEstablishDirectChannel; +} // FIRApp properties @property(nonatomic, readwrite, copy) NSString *fcmSenderID; @@ -206,14 +208,6 @@ FIRInstanceIDAPNSTokenType FIRIIDAPNSTokenTypeFromAPNSTokenType(FIRMessagingAPNS [self teardown]; } -- (void)setRemoteMessageDelegate:(id<FIRMessagingDelegate>)delegate { - _delegate = delegate; -} - -- (id<FIRMessagingDelegate>)remoteMessageDelegate { - return self.delegate; -} - #pragma mark - Config - (void)start { diff --git a/Firebase/Messaging/Public/FIRMessaging.h b/Firebase/Messaging/Public/FIRMessaging.h index 160ada6..f545147 100644 --- a/Firebase/Messaging/Public/FIRMessaging.h +++ b/Firebase/Messaging/Public/FIRMessaging.h @@ -302,23 +302,12 @@ NS_SWIFT_NAME(Messaging) @property(nonatomic, weak, nullable) id<FIRMessagingDelegate> delegate; /** - * Delegate to handle remote data messages received via FCM for devices running iOS 10 or above. - */ -@property(nonatomic, weak, nullable) id<FIRMessagingDelegate> remoteMessageDelegate - __deprecated_msg("Use 'delegate' property"); - -/** * When set to `YES`, Firebase Messaging will automatically establish a socket-based, direct * channel to the FCM server. Enable this only if you are sending upstream messages or * receiving non-APNS, data-only messages in foregrounded apps. * Default is `NO`. */ -@property(nonatomic) BOOL shouldEstablishDirectChannel; - -/** - * Returns `YES` if the direct channel to the FCM server is active, and `NO` otherwise. - */ -@property(nonatomic, readonly) BOOL isDirectChannelEstablished; +@property(nonatomic, assign, getter=isDirectChannelEstablished) BOOL shouldEstablishDirectChannel; /** * FIRMessaging |