File tree Expand file tree Collapse file tree 3 files changed +14
-9
lines changed Expand file tree Collapse file tree 3 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -86,12 +86,12 @@ - (instancetype)initWithApp:(FIRApp *)app {
86
86
87
87
NSString *userID = userInfo[FIRAuthStateDidChangeInternalNotificationUIDKey];
88
88
User newUser = User (userID);
89
- if (newUser != _currentUser) {
90
- _currentUser = newUser;
89
+ if (newUser != self-> _currentUser ) {
90
+ self-> _currentUser = newUser;
91
91
self.userCounter ++;
92
92
FSTVoidUserBlock listenerBlock = self.userChangeListener ;
93
93
if (listenerBlock) {
94
- listenerBlock (_currentUser);
94
+ listenerBlock (self-> _currentUser );
95
95
}
96
96
}
97
97
}
@@ -121,7 +121,7 @@ - (void)getTokenForcingRefresh:(BOOL)forceRefresh
121
121
userInfo: errorInfo];
122
122
completion (Token::Invalid (), cancelError);
123
123
} else {
124
- completion (Token (util::MakeStringView (token), _currentUser), error);
124
+ completion (Token (util::MakeStringView (token), self-> _currentUser ), error);
125
125
}
126
126
};
127
127
};
Original file line number Diff line number Diff line change @@ -507,10 +507,10 @@ - (void)processBatchedWatchChanges:(NSArray<FSTWatchChange *> *)changes
507
507
FSTBoxedTargetID *target, FSTTargetChange *change, BOOL *stop) {
508
508
NSData *resumeToken = change.resumeToken ;
509
509
if (resumeToken.length > 0 ) {
510
- FSTQueryData *queryData = _listenTargets[target];
510
+ FSTQueryData *queryData = self-> _listenTargets [target];
511
511
// A watched target might have been removed already.
512
512
if (queryData) {
513
- _listenTargets[target] =
513
+ self-> _listenTargets [target] =
514
514
[queryData queryDataByReplacingSnapshotVersion: change.snapshotVersion
515
515
resumeToken: resumeToken];
516
516
}
Original file line number Diff line number Diff line change @@ -34,10 +34,15 @@ - (instancetype)initWithDispatchQueue:(FSTDispatchQueue *)dispatchQueue
34
34
}
35
35
36
36
- (FSTViewSnapshotHandler)asyncSnapshotHandler {
37
+ // Retain `self` strongly in resulting snapshot handler so that even if the
38
+ // user releases the `FSTAsyncQueryListener` we'll continue to deliver
39
+ // events. This is done specifically to facilitate the common case where
40
+ // users just want to turn on notifications "forever" and don't want to have
41
+ // to keep track of our handle to keep them going.
37
42
return ^(FSTViewSnapshot *_Nullable snapshot, NSError *_Nullable error) {
38
- [_dispatchQueue dispatchAsync: ^{
39
- if (!_muted) {
40
- _snapshotHandler (snapshot, error);
43
+ [self -> _dispatchQueue dispatchAsync: ^{
44
+ if (!self-> _muted ) {
45
+ self-> _snapshotHandler (snapshot, error);
41
46
}
42
47
}];
43
48
};
You can’t perform that action at this time.
0 commit comments