Skip to content
This repository has been archived by the owner on Jan 16, 2021. It is now read-only.

Commit

Permalink
Merge pull request #36 from ParsePlatform/nlutsenko.v3.generics
Browse files Browse the repository at this point in the history
Remove all usages of PF_GENERIC macro.
  • Loading branch information
nlutsenko committed Jan 7, 2016
2 parents 39bb21a + 91e2bcd commit 74e3219
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ - (void)initializeSession {
self.session = FBSession.activeSession = sessionProxy;
}

- (BOOL)restoreAuthenticationWithAuthData:(nullable NSDictionary PF_GENERIC(NSString *,NSString *)*)authData {
- (BOOL)restoreAuthenticationWithAuthData:(nullable NSDictionary<NSString *, NSString *> *)authData {
if (!authData) {
OSAtomicIncrement32(&_currentOperationId);
self.tokenCache.facebookId = nil;
Expand Down Expand Up @@ -213,10 +213,9 @@ - (BOOL)restoreAuthenticationWithAuthData:(nullable NSDictionary PF_GENERIC(NSSt
if (!rawSession.isOpen ||
!([rawSession.accessTokenData.accessToken isEqualToString:self.tokenCache.accessToken] &&
[rawSession.accessTokenData.expirationDate isEqualToDate:self.tokenCache.expirationDate])) {
// We don't pass the permissions here because we don't actually know the permissions for this access token at this point.
rawSession = [self.sessionProvider sessionWithAppID:self.appId
permissions:nil // We don't pass the permissions here because
// we don't actually know the permissions for
// this access token at this point.
permissions:nil
urlSchemeSuffix:self.urlSchemeSuffix
tokenCacheStrategy:self.tokenCache];
if ([rawSession respondsToSelector:@selector(clearAffinitizedThread)]) {
Expand Down
42 changes: 21 additions & 21 deletions ParseFacebookUtils/PFFacebookUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ NS_ASSUME_NONNULL_BEGIN
@returns The task, that encapsulates the work being done.
*/
+ (BFTask PF_GENERIC(PFUser *)*)logInWithPermissionsInBackground:(nullable NSArray PF_GENERIC(NSString *)*)permissions;
+ (BFTask<PFUser *> *)logInWithPermissionsInBackground:(nullable NSArray<NSString *> *)permissions;

/*!
@abstract Logs in a user using Facebook.
Expand All @@ -143,7 +143,7 @@ NS_ASSUME_NONNULL_BEGIN
@param block The block to execute.
It should have the following argument signature: `^(PFUser *user, NSError *error)`.
*/
+ (void)logInWithPermissions:(nullable NSArray PF_GENERIC(NSString *)*)permissions
+ (void)logInWithPermissions:(nullable NSArray<NSString *> *)permissions
block:(nullable PFUserResultBlock)block;

/*
Expand All @@ -161,7 +161,7 @@ NS_ASSUME_NONNULL_BEGIN
@param selector The selector that will be called when the asynchronous request is complete.
It should have the following signature: `(void)callbackWithUser:(PFUser *)user error:(NSError *)error`.
*/
+ (void)logInWithPermissions:(nullable NSArray PF_GENERIC(NSString *)*)permissions
+ (void)logInWithPermissions:(nullable NSArray<NSString *> *)permissions
target:(nullable id)target
selector:(nullable SEL)selector;

Expand All @@ -177,9 +177,9 @@ NS_ASSUME_NONNULL_BEGIN
@returns The task, that encapsulates the work being done.
*/
+ (BFTask PF_GENERIC(PFUser *)*)logInWithFacebookIdInBackground:(NSString *)facebookId
accessToken:(NSString *)accessToken
expirationDate:(NSDate *)expirationDate;
+ (BFTask<PFUser *> *)logInWithFacebookIdInBackground:(NSString *)facebookId
accessToken:(NSString *)accessToken
expirationDate:(NSDate *)expirationDate;

/*!
@abstract Logs in a user using Facebook *asynchronously*.
Expand Down Expand Up @@ -233,7 +233,7 @@ NS_ASSUME_NONNULL_BEGIN
@deprecated Please use `[PFFacebookUtils linkUserInBackground:permissions:]` instead.
*/
+ (void)linkUser:(PFUser *)user permissions:(nullable NSArray PF_GENERIC(NSString *)*)permissions PARSE_DEPRECATED("Please use `[PFFacebookUtils linkUserInBackground:permissions:]` instead.");
+ (void)linkUser:(PFUser *)user permissions:(nullable NSArray<NSString *> *)permissions PARSE_DEPRECATED("Please use `[PFFacebookUtils linkUserInBackground:permissions:]` instead.");

/*!
@abstract Links Facebook to an existing <PFUser> *asynchronously*.
Expand All @@ -247,8 +247,8 @@ NS_ASSUME_NONNULL_BEGIN
@returns The task, that encapsulates the work being done.
*/
+ (BFTask PF_GENERIC(NSNumber *)*)linkUserInBackground:(PFUser *)user
permissions:(nullable NSArray PF_GENERIC(NSString *)*)permissions;
+ (BFTask<NSNumber *> *)linkUserInBackground:(PFUser *)user
permissions:(nullable NSArray<NSString *> *)permissions;

/*!
@abstract Links Facebook to an existing <PFUser> *asynchronously*.
Expand All @@ -263,7 +263,7 @@ NS_ASSUME_NONNULL_BEGIN
It should have the following argument signature: `^(BOOL *success, NSError *error)`.
*/
+ (void)linkUser:(PFUser *)user
permissions:(nullable NSArray PF_GENERIC(NSString *)*)permissions
permissions:(nullable NSArray<NSString *> *)permissions
block:(nullable PFBooleanResultBlock)block;

/*
Expand All @@ -280,7 +280,7 @@ NS_ASSUME_NONNULL_BEGIN
It should have the following signature: `(void)callbackWithResult:(NSNumber *)result error:(NSError *)error`.
*/
+ (void)linkUser:(PFUser *)user
permissions:(nullable NSArray PF_GENERIC(NSString *)*)permissions
permissions:(nullable NSArray<NSString *> *)permissions
target:(nullable id)target
selector:(nullable SEL)selector;

Expand All @@ -297,10 +297,10 @@ NS_ASSUME_NONNULL_BEGIN
@returns The task, that encapsulates the work being done.
*/
+ (BFTask PF_GENERIC(NSNumber *)*)linkUserInBackground:(PFUser *)user
facebookId:(NSString *)facebookId
accessToken:(NSString *)accessToken
expirationDate:(NSDate *)expirationDate;
+ (BFTask<NSNumber *> *)linkUserInBackground:(PFUser *)user
facebookId:(NSString *)facebookId
accessToken:(NSString *)accessToken
expirationDate:(NSDate *)expirationDate;

/*!
@abstract Links Facebook to an existing <PFUser> *asynchronously*.
Expand Down Expand Up @@ -371,7 +371,7 @@ NS_ASSUME_NONNULL_BEGIN
@param user User to unlink from Facebook.
@returns The task, that encapsulates the work being done.
*/
+ (BFTask PF_GENERIC(NSNumber *)*)unlinkUserInBackground:(PFUser *)user;
+ (BFTask<NSNumber *> *)unlinkUserInBackground:(PFUser *)user;

/*!
@abstract Unlinks the <PFUser> from a Facebook account *asynchronously*.
Expand Down Expand Up @@ -409,9 +409,9 @@ NS_ASSUME_NONNULL_BEGIN
@returns The task, that encapsulates the work being done.
*/
+ (BFTask PF_GENERIC(NSNumber *)*)reauthorizeUserInBackground:(PFUser *)user
withPublishPermissions:(nullable NSArray PF_GENERIC(NSString *)*)permissions
audience:(FBSessionDefaultAudience)audience;
+ (BFTask<NSNumber *> *)reauthorizeUserInBackground:(PFUser *)user
withPublishPermissions:(nullable NSArray<NSString *> *)permissions
audience:(FBSessionDefaultAudience)audience;

/*!
@abstract Requests new Facebook publish permissions for the given user *asynchronously*.
Expand All @@ -427,7 +427,7 @@ NS_ASSUME_NONNULL_BEGIN
It should have the following argument signature: `^(BOOL succeeded, NSError *error)`.
*/
+ (void)reauthorizeUser:(PFUser *)user
withPublishPermissions:(nullable NSArray PF_GENERIC(NSString *)*)permissions
withPublishPermissions:(nullable NSArray<NSString *> *)permissions
audience:(FBSessionDefaultAudience)audience
block:(nullable PFBooleanResultBlock)block;

Expand All @@ -446,7 +446,7 @@ NS_ASSUME_NONNULL_BEGIN
It should have the following signature: `(void)callbackWithResult:(NSNumber *)result error:(NSError *)error`.
*/
+ (void)reauthorizeUser:(PFUser *)user
withPublishPermissions:(nullable NSArray PF_GENERIC(NSString *)*)permissions
withPublishPermissions:(nullable NSArray<NSString *> *)permissions
audience:(FBSessionDefaultAudience)audience
target:(nullable id)target
selector:(nullable SEL)selector;
Expand Down
40 changes: 20 additions & 20 deletions ParseFacebookUtils/PFFacebookUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ + (FBSessionLoginBehavior)facebookLoginBehavior {
#pragma mark - Log In
///--------------------------------------

+ (BFTask PF_GENERIC(PFUser *)*)logInWithPermissionsInBackground:(nullable NSArray PF_GENERIC(NSString *)*)permissions {
+ (BFTask<PFUser *> *)logInWithPermissionsInBackground:(nullable NSArray<NSString *> *)permissions {
[self checkInitialization];
provider.permissions = permissions;

Expand All @@ -100,22 +100,22 @@ + (FBSessionLoginBehavior)facebookLoginBehavior {
}];
}

+ (void)logInWithPermissions:(nullable NSArray PF_GENERIC(NSString *)*)permissions
+ (void)logInWithPermissions:(nullable NSArray<NSString *> *)permissions
block:(nullable PFUserResultBlock)block {
[[self logInWithPermissionsInBackground:permissions] pffb_continueWithMainThreadUserBlock:block];
}

+ (void)logInWithPermissions:(nullable NSArray PF_GENERIC(NSString *)*)permissions
+ (void)logInWithPermissions:(nullable NSArray<NSString *> *)permissions
target:(nullable id)target
selector:(nullable SEL)selector {
[self logInWithPermissions:permissions block:^(PFUser *user, NSError *error) {
[PFFacebookPrivateUtilities safePerformSelector:selector onTarget:target withObject:user object:error];
}];
}

+ (BFTask PF_GENERIC(PFUser *)*)logInWithFacebookIdInBackground:(NSString *)facebookId
accessToken:(NSString *)accessToken
expirationDate:(NSDate *)expirationDate {
+ (BFTask<PFUser *> *)logInWithFacebookIdInBackground:(NSString *)facebookId
accessToken:(NSString *)accessToken
expirationDate:(NSDate *)expirationDate {
[self checkInitialization];

NSDictionary *authData = [provider authDataWithFacebookId:facebookId
Expand Down Expand Up @@ -154,13 +154,13 @@ + (void)logInWithFacebookId:(NSString *)facebookId
#pragma mark - Link
///--------------------------------------

+ (void)linkUser:(PFUser *)user permissions:(nullable NSArray PF_GENERIC(NSString *)*)permissions {
+ (void)linkUser:(PFUser *)user permissions:(nullable NSArray<NSString *> *)permissions {
// This is misnamed `*InBackground` method. Left as is for backward compatability.
[self linkUserInBackground:user permissions:permissions];
}

+ (BFTask PF_GENERIC(NSNumber *)*)linkUserInBackground:(PFUser *)user
permissions:(nullable NSArray PF_GENERIC(NSString *)*)permissions {
+ (BFTask<NSNumber *> *)linkUserInBackground:(PFUser *)user
permissions:(nullable NSArray<NSString *> *)permissions {
[self checkInitialization];
provider.permissions = permissions;

Expand All @@ -170,7 +170,7 @@ + (void)linkUser:(PFUser *)user permissions:(nullable NSArray PF_GENERIC(NSStrin
}

+ (void)linkUser:(PFUser *)user
permissions:(nullable NSArray PF_GENERIC(NSString *)*)permissions
permissions:(nullable NSArray<NSString *> *)permissions
block:(nullable PFBooleanResultBlock)block {
[[self linkUserInBackground:user permissions:permissions] pffb_continueWithMainThreadBooleanBlock:block];
}
Expand All @@ -184,10 +184,10 @@ + (void)linkUser:(PFUser *)user
}];
}

+ (BFTask PF_GENERIC(NSNumber *)*)linkUserInBackground:(PFUser *)user
facebookId:(NSString *)facebookId
accessToken:(NSString *)accessToken
expirationDate:(NSDate *)expirationDate {
+ (BFTask<NSNumber *> *)linkUserInBackground:(PFUser *)user
facebookId:(NSString *)facebookId
accessToken:(NSString *)accessToken
expirationDate:(NSDate *)expirationDate {
[self checkInitialization];

NSDictionary *authData = [provider authDataWithFacebookId:facebookId
Expand Down Expand Up @@ -237,7 +237,7 @@ + (BOOL)unlinkUser:(PFUser *)user error:(NSError **)error {
return [[[self unlinkUserInBackground:user] pffb_waitForResult:error] boolValue];
}

+ (BFTask PF_GENERIC(NSNumber *)*)unlinkUserInBackground:(PFUser *)user {
+ (BFTask<NSNumber *> *)unlinkUserInBackground:(PFUser *)user {
[self checkInitialization];
return [user unlinkWithAuthTypeInBackground:PFFacebookUserAuthenticationType];
}
Expand All @@ -256,9 +256,9 @@ + (void)unlinkUserInBackground:(PFUser *)user target:(nullable id)target selecto
#pragma mark - Reauthorize
///--------------------------------------

+ (BFTask PF_GENERIC(NSNumber *)*)reauthorizeUserInBackground:(PFUser *)user
withPublishPermissions:(nullable NSArray PF_GENERIC(NSString *)*)permissions
audience:(FBSessionDefaultAudience)audience {
+ (BFTask<NSNumber *> *)reauthorizeUserInBackground:(PFUser *)user
withPublishPermissions:(nullable NSArray<NSString *> *)permissions
audience:(FBSessionDefaultAudience)audience {
[self checkInitialization];
if (![self isLinkedWithUser:user]) {
[NSException raise:NSInternalInconsistencyException
Expand All @@ -273,7 +273,7 @@ + (void)unlinkUserInBackground:(PFUser *)user target:(nullable id)target selecto
}

+ (void)reauthorizeUser:(PFUser *)user
withPublishPermissions:(nullable NSArray PF_GENERIC(NSString *)*)permissions
withPublishPermissions:(nullable NSArray<NSString *> *)permissions
audience:(FBSessionDefaultAudience)audience
block:(nullable PFBooleanResultBlock)block {
[[self reauthorizeUserInBackground:user
Expand All @@ -282,7 +282,7 @@ + (void)reauthorizeUser:(PFUser *)user
}

+ (void)reauthorizeUser:(PFUser *)user
withPublishPermissions:(nullable NSArray PF_GENERIC(NSString *)*)permissions
withPublishPermissions:(nullable NSArray<NSString *> *)permissions
audience:(FBSessionDefaultAudience)audience
target:(nullable id)target
selector:(nullable SEL)selector {
Expand Down

0 comments on commit 74e3219

Please sign in to comment.