Skip to content

Commit

Permalink
Deprecate TestUsersManager
Browse files Browse the repository at this point in the history
Summary:
This type exists to make it easier to work with the Graph API to provide test user accounts.

A few reasons to get rid of this:

1. It's shipped as production code but really just exists for setting up integration tests. This is clearly wrong.
2. It's generally not the SDKs job to maintain specific calls to endpoints (outside of a few specific use cases such as login and app events). CoreKit should only implement the specific graph requests that are required to enable a user to form their own graph requests.
3. This is easily implemented by anyone who is currently using it. The internal CoreKit import can be replaced by
```
#import "FBSDKCoreKit_Basics.h"
#import "FBSDKCoreKit.h"
```
4. Graph API usage suggests that barely anyone is using this type. Effectively 0% usage.

Reviewed By: KylinChang

Differential Revision: D26915949

fbshipit-source-id: 9218d23f04c6008d151a142887fbcf1d0ce48ce5
  • Loading branch information
joesus authored and facebook-github-bot committed Mar 10, 2021
1 parent 83c8dfe commit 441f7fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion FBSDKCoreKit/FBSDKCoreKit/FBSDKTestUsersManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ NS_ASSUME_NONNULL_BEGIN
Callback block for returning an array of FBSDKAccessToken instances (and possibly `NSNull` instances); or an error.
*/
typedef void (^FBSDKAccessTokensBlock)(NSArray<FBSDKAccessToken *> *tokens, NSError *_Nullable error)
NS_SWIFT_NAME(AccessTokensBlock);
NS_SWIFT_NAME(AccessTokensBlock)
DEPRECATED_MSG_ATTRIBUTE("AccessTokensBlock is deprecated and will be removed in the next major release");


/**
Expand All @@ -44,6 +45,7 @@ NS_SWIFT_NAME(AccessTokensBlock);
an app id and app secret. You will typically use this class to write unit or integration tests.
Make sure you NEVER include your app secret in your production app.
*/
DEPRECATED_MSG_ATTRIBUTE("FBSDKTestUsersManager is deprecated and will be removed in the next major release")
NS_SWIFT_NAME(TestUsersManager)
@interface FBSDKTestUsersManager : NSObject

Expand Down
6 changes: 6 additions & 0 deletions FBSDKCoreKit/FBSDKCoreKit/FBSDKTestUsersManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

#import "FBSDKCoreKit+Internal.h"

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#pragma clang diagnostic ignored "-Wdeprecated-implementations"

static NSString *const kFBGraphAPITestUsersPathFormat = @"%@/accounts/test-users";
static NSString *const kAccountsDictionaryTokenKey = @"access_token";
static NSString *const kAccountsDictionaryPermissionsKey = @"permissions";
Expand Down Expand Up @@ -336,3 +340,5 @@ - (void)fetchExistingTestAccountsWithAfterCursor:(NSString *)after handler:(FBSD
}

@end

#pragma clang diagnostic pop

0 comments on commit 441f7fc

Please sign in to comment.