Skip to content

Commit 6b68308

Browse files
committed
Added private method for checking if user is linked with a given auth type.
1 parent 96ee524 commit 6b68308

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

Parse/Internal/User/PFUserPrivate.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ extern NSString *const PFUserCurrentUserKeychainItemName;
8686
// TODO: (nlutsenko) Add Documentation
8787
- (BFTask *)unlinkWithAuthTypeInBackground:(NSString *)authType;
8888

89+
// TODO: (nlutsenko) Add Documentation
90+
- (BOOL)isLinkedWithAuthType:(NSString *)authType;
91+
8992
///--------------------------------------
9093
/// @name Authentication Providers (Private)
9194
///--------------------------------------

Parse/PFAnonymousUtils.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ + (void)logInWithTarget:(id)target selector:(SEL)selector {
4242
///--------------------------------------
4343

4444
+ (BOOL)isLinkedWithUser:(PFUser *)user {
45-
return [user.linkedServiceNames containsObject:[[[self _authenticationProvider] class] authType]];
45+
return [user isLinkedWithAuthType:[[[self _authenticationProvider] class] authType]];
4646
}
4747

4848
///--------------------------------------

Parse/PFUser.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,15 @@ - (BFTask *)unlinkWithAuthTypeInBackground:(NSString *)authType {
891891
return save;
892892
}
893893

894+
#pragma mark Linked
895+
896+
- (BOOL)isLinkedWithAuthType:(NSString *)authType {
897+
PFParameterAssert(authType, @"Authentication type can't be `nil`.");
898+
@synchronized(self.lock) {
899+
return [self.linkedServiceNames containsObject:authType];
900+
}
901+
}
902+
894903
#pragma mark Private
895904

896905
+ (void)_unregisterAuthenticationProvider:(id<PFAuthenticationProvider>)provider {

0 commit comments

Comments
 (0)