Skip to content

Commit 4962d4d

Browse files
committed
Merge pull request #236 from ParsePlatform/nlutsenko.async
Make PFUser.unlinkWithAuthTypeInBackground() fully async.
2 parents 460ddb3 + f2b69c0 commit 4962d4d

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

Parse/PFUser.m

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -877,18 +877,16 @@ - (BFTask *)linkWithAuthTypeInBackground:(NSString *)authType authData:(NSDictio
877877
#pragma mark Unlink
878878

879879
- (BFTask *)unlinkWithAuthTypeInBackground:(NSString *)authType {
880-
// TODO: (nlutsenko) Make it fully async.
881-
BFTask *save = nil;
882-
@synchronized ([self lock]) {
883-
if (!self.authData[authType]) {
884-
save = [BFTask taskWithResult:@YES];
885-
} else {
886-
self.authData[authType] = [NSNull null];
887-
dirty = YES;
888-
save = [self saveInBackground];
880+
return [BFTask taskFromExecutor:[BFExecutor defaultPriorityBackgroundExecutor] withBlock:^id{
881+
@synchronized (self.lock) {
882+
if (self.authData[authType]) {
883+
self.authData[authType] = [NSNull null];
884+
dirty = YES;
885+
return [self saveInBackground];
886+
}
889887
}
890-
}
891-
return save;
888+
return @YES;
889+
}];
892890
}
893891

894892
#pragma mark Linked

0 commit comments

Comments
 (0)