Commit 4b6a74a1 authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS] Don't show the NTP avatar when signed out

This CL hides the NTP avatar when the user isn't signed in.

Fixed: 1115654
Change-Id: Idfcdadddbfb2ccd81000833d561aca46ac8074cf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2375247
Auto-Submit: Gauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801693}
parent 75363679
...@@ -706,6 +706,7 @@ const NSString* kScribbleFakeboxElementId = @"fakebox"; ...@@ -706,6 +706,7 @@ const NSString* kScribbleFakeboxElementId = @"fakebox";
#pragma mark - UserAccountImageUpdateDelegate #pragma mark - UserAccountImageUpdateDelegate
- (void)updateAccountImage:(UIImage*)image { - (void)updateAccountImage:(UIImage*)image {
self.identityDiscButton.hidden = !image;
[self.identityDiscButton setImage:image forState:UIControlStateNormal]; [self.identityDiscButton setImage:image forState:UIControlStateNormal];
self.identityDiscButton.imageView.layer.cornerRadius = image.size.width / 2; self.identityDiscButton.imageView.layer.cornerRadius = image.size.width / 2;
self.identityDiscButton.imageView.layer.masksToBounds = YES; self.identityDiscButton.imageView.layer.masksToBounds = YES;
......
...@@ -681,13 +681,14 @@ const char kNTPHelpURL[] = ...@@ -681,13 +681,14 @@ const char kNTPHelpURL[] =
identityService->GetAvatarForIdentity(identity, nil); identityService->GetAvatarForIdentity(identity, nil);
} }
} else { } else {
// User is not signed in, show default avatar. // User is not signed in, don't show any avatar.
image = [self defaultAvatar]; image = nil;
} }
// TODO(crbug.com/965962): Use ResizedAvatarCache when it accepts the // TODO(crbug.com/965962): Use ResizedAvatarCache when it accepts the
// specification of different image sizes. // specification of different image sizes.
CGFloat dimension = ntp_home::kIdentityAvatarDimension; CGFloat dimension = ntp_home::kIdentityAvatarDimension;
if (image.size.width != dimension || image.size.height != dimension) { if (image &&
(image.size.width != dimension || image.size.height != dimension)) {
image = ResizeImage(image, CGSizeMake(dimension, dimension), image = ResizeImage(image, CGSizeMake(dimension, dimension),
ProjectionMode::kAspectFit); ProjectionMode::kAspectFit);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment