Skip to content

Commit

Permalink
Rename profile view controller userID to profileID
Browse files Browse the repository at this point in the history
Summary: Renamed userID to profileID in FBProfilePictureView

Test Plan: Ran unit tests

Reviewers: jacl, clang

Reviewed By: jacl

CC: bhiller, scottg

Differential Revision: https://phabricator.fb.com/D525702

Task ID: 1192590
  • Loading branch information
aydenw committed Jul 20, 2012
1 parent d24a0a3 commit 1905f74
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 33 deletions.
Expand Up @@ -95,9 +95,9 @@ - (void)loginViewFetchedUserInfo:(FBLoginView *)loginView
// id properties of the json response from the server; alternatively we could use
// NSDictionary methods such as objectForKey to get values from the my json object
self.labelFirstName.text = [NSString stringWithFormat:@"Hello %@!", user.first_name];
// setting the userID property of the FBProfilePictureView instance
// setting the profileID property of the FBProfilePictureView instance
// causes the control to fetch and display the profile picture for the user
self.profilePic.userID = user.id;
self.profilePic.profileID = user.id;
self.loggedInUser = user;
}

Expand All @@ -106,7 +106,7 @@ - (void)loginViewShowingLoggedOutUser:(FBLoginView *)loginView {
self.buttonPostStatus.enabled = NO;
self.buttonPickFriends.enabled = NO;

self.profilePic.userID = nil;
self.profilePic.profileID = nil;
self.labelFirstName.text = nil;
}

Expand Down
Expand Up @@ -79,28 +79,28 @@ - (IBAction)showJasonProfile:(id)sender {
// FBSample logic
// The following example uses an fbid to indicate which profile
// picture to display, however a vanity name would work as well
profilePictureView.userID = @"100002768941660";
profilePictureView.profileID = @"100002768941660";
}

- (IBAction)showMichaelProfile:(id)sender {
// FBSample logic
// This example and the one after it, in contrast to the prvious one,
// uses a vanity name to indicate which profile picture to display
profilePictureView.userID = @"michael.marucheck";
profilePictureView.profileID = @"michael.marucheck";
}

- (IBAction)showVijayeProfile:(id)sender {
profilePictureView.userID = @"vijaye";
profilePictureView.profileID = @"vijaye";
}

- (IBAction)showRandomProfile:(id)sender {
int index = arc4random() % kNumInterestingIDs;
profilePictureView.userID = [NSString stringWithCString:interestingIDs[index]
profilePictureView.profileID = [NSString stringWithCString:interestingIDs[index]
encoding:NSASCIIStringEncoding];
}

- (IBAction)showNoProfile:(id)sender {
profilePictureView.userID = nil;
profilePictureView.profileID = nil;
}

// Cropping selections
Expand Down Expand Up @@ -133,7 +133,7 @@ - (void)viewDidLoad {
[super viewDidLoad];

[self makeViewLarge:nil];
profilePictureView.userID = @"45963418107"; // Hello world
profilePictureView.profileID = @"45963418107"; // Hello world
}

- (void)viewDidUnload {
Expand Down
2 changes: 1 addition & 1 deletion samples/Scrumptious/scrumptious/SCViewController.m
Expand Up @@ -342,7 +342,7 @@ - (void)populateUserDetails {
^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *user, NSError *error) {
if (!error) {
self.userNameLabel.text = user.name;
self.userProfileImage.userID = [user objectForKey:@"id"];
self.userProfileImage.profileID = [user objectForKey:@"id"];
}
}];
}
Expand Down
Expand Up @@ -99,14 +99,14 @@ - (void) layoutSubviews {
#pragma mark - Properties

- (NSString*)userID {
return self.profilePic.userID;
return self.profilePic.profileID;
}

- (void)setUserID:(NSString *)userID {
// FBSample logic
// Setting the userID property of the profile picture view causes the view to fetch and display
// Setting the profileID property of the profile picture view causes the view to fetch and display
// the profile picture for the given user
self.profilePic.userID = userID;
self.profilePic.profileID = userID;
}

- (NSString*)userName {
Expand Down
Expand Up @@ -80,7 +80,7 @@ - (void)updateControls {
}

self.nameLabel.text = [NSString stringWithFormat:@"Hello, %@!", user.first_name];
self.picView.userID = user.id;
self.picView.profileID = user.id;
if (user.birthday.length > 0) {
self.birthdayLabel.text = [NSString stringWithFormat:@"Your birthday is: %@", user.birthday];
} else {
Expand Down
10 changes: 5 additions & 5 deletions src/FBLoginView.m
Expand Up @@ -184,8 +184,8 @@ - (void)initialize {
autorelease];

// setup profile picture
self.profilePicture = [[[FBProfilePictureView alloc] initWithUserID:nil
pictureCropping:FBProfilePictureCroppingSquare]
self.profilePicture = [[[FBProfilePictureView alloc] initWithProfileID:nil
pictureCropping:FBProfilePictureCroppingSquare]
autorelease];

// setup profile picture
Expand Down Expand Up @@ -268,7 +268,7 @@ - (void)configureViewForStateLoggedIn:(BOOL)isLoggedIn {
a.profileExtent,
a.profileExtent);

self.profilePicture.userID = nil;
self.profilePicture.profileID = nil;
self.user = nil;
}
}
Expand All @@ -280,11 +280,11 @@ - (void)fetchMeInfo {
[self.request addRequest:request
completionHandler:^(FBRequestConnection *connection, NSMutableDictionary<FBGraphUser> *result, NSError *error) {
if (result) {
self.profilePicture.userID = [result objectForKey:@"id"];
self.profilePicture.profileID = [result objectForKey:@"id"];
self.user = result;
[self informDelegate:YES];
} else {
self.profilePicture.userID = nil;
self.profilePicture.profileID = nil;
self.user = nil;
}
self.request = nil;
Expand Down
6 changes: 3 additions & 3 deletions src/FBProfilePictureView.h
Expand Up @@ -51,7 +51,7 @@ typedef enum {
@abstract
The Facebook ID of the user, place or object for which a picture should be fetched and displayed.
*/
@property (copy, nonatomic) NSString* userID;
@property (copy, nonatomic) NSString* profileID;

/*!
@abstract
Expand All @@ -70,10 +70,10 @@ typedef enum {
@abstract
Initializes and returns a profile view object for the given Facebook ID and cropping.
@param userID The Facebook ID of the user, place or object for which a picture should be fetched and displayed.
@param profileID The Facebook ID of the user, place or object for which a picture should be fetched and displayed.
@param pictureCropping The cropping to use for the profile picture.
*/
- (id)initWithUserID:(NSString*)userID
- (id)initWithProfileID:(NSString*)profileID
pictureCropping:(FBProfilePictureCropping)pictureCropping;


Expand Down
22 changes: 11 additions & 11 deletions src/FBProfilePictureView.m
Expand Up @@ -34,7 +34,7 @@ - (void)ensureImageViewContentMode;

@implementation FBProfilePictureView

@synthesize userID = _userID;
@synthesize profileID = _profileID;
@synthesize pictureCropping = _pictureCropping;
@synthesize connection = _connection;
@synthesize imageView = _imageView;
Expand All @@ -43,7 +43,7 @@ @implementation FBProfilePictureView
#pragma mark - Lifecycle

- (void)dealloc {
[_userID release];
[_profileID release];
[_imageView release];
[_connection release];
[_previousImageQueryParamString release];
Expand All @@ -60,12 +60,12 @@ - (id)init {
return self;
}

- (id)initWithUserID:(NSString *)userID
pictureCropping:(FBProfilePictureCropping)pictureCropping {
- (id)initWithProfileID:(NSString *)profileID
pictureCropping:(FBProfilePictureCropping)pictureCropping {
self = [self init];
if (self) {
self.pictureCropping = pictureCropping;
self.userID = userID;
self.profileID = profileID;
}

return self;
Expand Down Expand Up @@ -149,7 +149,7 @@ - (void)refreshImage:(BOOL)forceRefresh {
return;
}

if (self.userID) {
if (self.profileID) {

[self.connection cancel];

Expand All @@ -167,7 +167,7 @@ - (void)refreshImage:(BOOL)forceRefresh {
NSString *template = @"%@/%@/picture?%@";
NSString *urlString = [NSString stringWithFormat:template,
FBGraphBasePath,
self.userID,
self.profileID,
newImageQueryParamString];
NSURL *url = [NSURL URLWithString:urlString];

Expand Down Expand Up @@ -209,10 +209,10 @@ - (void)ensureImageViewContentMode {
self.imageView.contentMode = contentMode;
}

- (void)setUserID:(NSString*)userID {
if (!_userID || ![_userID isEqualToString:userID]) {
[_userID release];
_userID = [userID copy];
- (void)setProfileID:(NSString*)profileID {
if (!_profileID || ![_profileID isEqualToString:profileID]) {
[_profileID release];
_profileID = [profileID copy];
[self refreshImage:YES];
}
}
Expand Down

0 comments on commit 1905f74

Please sign in to comment.