Commit fc96af84 authored by Nohemi Fernandez's avatar Nohemi Fernandez Committed by Commit Bot

[iOS] Clarify button intent for ClearSyncedData sign-out feature.

This CL clarifies the intent of the sign-out options by making two UI
tweaks suggested by our UI designer:
  1. Ensure that popover is anchored to the button requesting it.
  2. Ensure that long text wraps instead of cutting off.

Bug: 1043949
Change-Id: I8483b51634ba21516b58314a11cfeb29757f8ed5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2134367Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Nohemi Fernandez <fernandex@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755834}
parent d2bc86c2
......@@ -35,6 +35,7 @@
#import "ios/chrome/browser/ui/table_view/cells/table_view_detail_text_item.h"
#import "ios/chrome/browser/ui/table_view/cells/table_view_link_header_footer_item.h"
#import "ios/chrome/browser/ui/table_view/cells/table_view_text_header_footer_item.h"
#import "ios/chrome/browser/ui/table_view/cells/table_view_text_item.h"
#import "ios/chrome/browser/ui/table_view/table_view_model.h"
#include "ios/chrome/browser/ui/ui_feature_flags.h"
#import "ios/chrome/common/ui/colors/semantic_color_names.h"
......@@ -313,8 +314,8 @@ typedef NS_ENUM(NSInteger, ItemType) {
}
- (TableViewItem*)experimentalSignOutItem {
TableViewDetailTextItem* item =
[[TableViewDetailTextItem alloc] initWithType:ItemTypeSignOut];
TableViewTextItem* item =
[[TableViewTextItem alloc] initWithType:ItemTypeSignOut];
item.text =
l10n_util::GetNSString(IDS_IOS_DISCONNECT_DIALOG_CONTINUE_BUTTON_MOBILE);
item.textColor = [UIColor colorNamed:kBlueColor];
......@@ -324,8 +325,8 @@ typedef NS_ENUM(NSInteger, ItemType) {
}
- (TableViewItem*)experimentalSignOutAndClearDataItem {
TableViewDetailTextItem* item = [[TableViewDetailTextItem alloc]
initWithType:ItemTypeSignOutAndClearData];
TableViewTextItem* item =
[[TableViewTextItem alloc] initWithType:ItemTypeSignOutAndClearData];
item.text = l10n_util::GetNSString(
IDS_IOS_DISCONNECT_DIALOG_CONTINUE_AND_CLEAR_MOBILE);
item.textColor = [UIColor colorNamed:kRedColor];
......@@ -352,19 +353,26 @@ typedef NS_ENUM(NSInteger, ItemType) {
[self showAccountDetails:item.chromeIdentity];
break;
}
case ItemTypeAddAccount:
case ItemTypeAddAccount: {
[self showAddAccount];
break;
case ItemTypeSignOut:
}
case ItemTypeSignOut: {
if (base::FeatureList::IsEnabled(kClearSyncedData)) {
[self showSignOutWithClearData:NO];
UIView* itemView =
[[tableView cellForRowAtIndexPath:indexPath] contentView];
[self showSignOutWithClearData:NO itemView:itemView];
} else {
[self showSignOut];
}
break;
case ItemTypeSignOutAndClearData:
[self showSignOutWithClearData:YES];
}
case ItemTypeSignOutAndClearData: {
UIView* itemView =
[[tableView cellForRowAtIndexPath:indexPath] contentView];
[self showSignOutWithClearData:YES itemView:itemView];
break;
}
default:
break;
}
......@@ -426,7 +434,8 @@ typedef NS_ENUM(NSInteger, ItemType) {
->PresentAccountDetailsController(identity, self, /*animated=*/YES);
}
- (void)showSignOutWithClearData:(BOOL)forceClearData {
- (void)showSignOutWithClearData:(BOOL)forceClearData
itemView:(UIView*)itemView {
NSString* alertMessage = nil;
NSString* signOutTitle = nil;
UIAlertActionStyle actionStyle = UIAlertActionStyleDefault;
......@@ -449,8 +458,8 @@ typedef NS_ENUM(NSInteger, ItemType) {
[[ActionSheetCoordinator alloc] initWithBaseViewController:self
title:nil
message:alertMessage
rect:self.view.frame
view:self.view];
rect:itemView.frame
view:itemView];
__weak AccountsTableViewController* weakSelf = self;
[_alertCoordinator
......
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