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 @@ ...@@ -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_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_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_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" #import "ios/chrome/browser/ui/table_view/table_view_model.h"
#include "ios/chrome/browser/ui/ui_feature_flags.h" #include "ios/chrome/browser/ui/ui_feature_flags.h"
#import "ios/chrome/common/ui/colors/semantic_color_names.h" #import "ios/chrome/common/ui/colors/semantic_color_names.h"
...@@ -313,8 +314,8 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -313,8 +314,8 @@ typedef NS_ENUM(NSInteger, ItemType) {
} }
- (TableViewItem*)experimentalSignOutItem { - (TableViewItem*)experimentalSignOutItem {
TableViewDetailTextItem* item = TableViewTextItem* item =
[[TableViewDetailTextItem alloc] initWithType:ItemTypeSignOut]; [[TableViewTextItem alloc] initWithType:ItemTypeSignOut];
item.text = item.text =
l10n_util::GetNSString(IDS_IOS_DISCONNECT_DIALOG_CONTINUE_BUTTON_MOBILE); l10n_util::GetNSString(IDS_IOS_DISCONNECT_DIALOG_CONTINUE_BUTTON_MOBILE);
item.textColor = [UIColor colorNamed:kBlueColor]; item.textColor = [UIColor colorNamed:kBlueColor];
...@@ -324,8 +325,8 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -324,8 +325,8 @@ typedef NS_ENUM(NSInteger, ItemType) {
} }
- (TableViewItem*)experimentalSignOutAndClearDataItem { - (TableViewItem*)experimentalSignOutAndClearDataItem {
TableViewDetailTextItem* item = [[TableViewDetailTextItem alloc] TableViewTextItem* item =
initWithType:ItemTypeSignOutAndClearData]; [[TableViewTextItem alloc] initWithType:ItemTypeSignOutAndClearData];
item.text = l10n_util::GetNSString( item.text = l10n_util::GetNSString(
IDS_IOS_DISCONNECT_DIALOG_CONTINUE_AND_CLEAR_MOBILE); IDS_IOS_DISCONNECT_DIALOG_CONTINUE_AND_CLEAR_MOBILE);
item.textColor = [UIColor colorNamed:kRedColor]; item.textColor = [UIColor colorNamed:kRedColor];
...@@ -352,19 +353,26 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -352,19 +353,26 @@ typedef NS_ENUM(NSInteger, ItemType) {
[self showAccountDetails:item.chromeIdentity]; [self showAccountDetails:item.chromeIdentity];
break; break;
} }
case ItemTypeAddAccount: case ItemTypeAddAccount: {
[self showAddAccount]; [self showAddAccount];
break; break;
case ItemTypeSignOut: }
case ItemTypeSignOut: {
if (base::FeatureList::IsEnabled(kClearSyncedData)) { if (base::FeatureList::IsEnabled(kClearSyncedData)) {
[self showSignOutWithClearData:NO]; UIView* itemView =
[[tableView cellForRowAtIndexPath:indexPath] contentView];
[self showSignOutWithClearData:NO itemView:itemView];
} else { } else {
[self showSignOut]; [self showSignOut];
} }
break; break;
case ItemTypeSignOutAndClearData: }
[self showSignOutWithClearData:YES]; case ItemTypeSignOutAndClearData: {
UIView* itemView =
[[tableView cellForRowAtIndexPath:indexPath] contentView];
[self showSignOutWithClearData:YES itemView:itemView];
break; break;
}
default: default:
break; break;
} }
...@@ -426,7 +434,8 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -426,7 +434,8 @@ typedef NS_ENUM(NSInteger, ItemType) {
->PresentAccountDetailsController(identity, self, /*animated=*/YES); ->PresentAccountDetailsController(identity, self, /*animated=*/YES);
} }
- (void)showSignOutWithClearData:(BOOL)forceClearData { - (void)showSignOutWithClearData:(BOOL)forceClearData
itemView:(UIView*)itemView {
NSString* alertMessage = nil; NSString* alertMessage = nil;
NSString* signOutTitle = nil; NSString* signOutTitle = nil;
UIAlertActionStyle actionStyle = UIAlertActionStyleDefault; UIAlertActionStyle actionStyle = UIAlertActionStyleDefault;
...@@ -449,8 +458,8 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -449,8 +458,8 @@ typedef NS_ENUM(NSInteger, ItemType) {
[[ActionSheetCoordinator alloc] initWithBaseViewController:self [[ActionSheetCoordinator alloc] initWithBaseViewController:self
title:nil title:nil
message:alertMessage message:alertMessage
rect:self.view.frame rect:itemView.frame
view:self.view]; view:itemView];
__weak AccountsTableViewController* weakSelf = self; __weak AccountsTableViewController* weakSelf = self;
[_alertCoordinator [_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