Skip to content

Commit e6d17e9

Browse files
Fix callback for nested signIn or addScopes (#29)
* fix calling callback on addScopes * fixes due review
1 parent 954652d commit e6d17e9

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

GoogleSignIn/Sources/GIDSignIn.m

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,9 @@ - (void)signInWithOptions:(GIDSignInInternalOptions *)options {
390390
[self authenticateWithOptions:options];
391391
} else {
392392
if (options.callback) {
393+
self->_currentOptions = nil;
393394
dispatch_async(dispatch_get_main_queue(), ^{
394395
options.callback(self->_currentUser, nil);
395-
self->_currentOptions = nil;
396396
});
397397
}
398398
}
@@ -522,9 +522,9 @@ - (void)authenticateWithOptions:(GIDSignInInternalOptions *)options {
522522
code:kGIDSignInErrorCodeHasNoAuthInKeychain
523523
userInfo:nil];
524524
if (options.callback) {
525+
self->_currentOptions = nil;
525526
dispatch_async(dispatch_get_main_queue(), ^{
526527
options.callback(nil, error);
527-
self->_currentOptions = nil;
528528
});
529529
}
530530
return;
@@ -690,9 +690,10 @@ - (void)addCompletionCallback:(GIDAuthFlow *)authFlow {
690690
[authFlow addCallback:^() {
691691
GIDAuthFlow *handlerAuthFlow = weakAuthFlow;
692692
if (self->_currentOptions.callback) {
693+
GIDSignInCallback callback = self->_currentOptions.callback;
694+
self->_currentOptions = nil;
693695
dispatch_async(dispatch_get_main_queue(), ^{
694-
self->_currentOptions.callback(self->_currentUser, handlerAuthFlow.error);
695-
self->_currentOptions = nil;
696+
callback(self->_currentUser, handlerAuthFlow.error);
696697
});
697698
}
698699
}];

0 commit comments

Comments
 (0)