Commit 1baf3a7d authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS] Remove the legacy CollectionVC for Settings

The Settings used to have CollectionViews instead of TableViews.
Now that the use of CollectionView has been removed, we can remove the
classes used to implement it.

Bug: 894800
Change-Id: I0865b61f884760d956855d0771f5524e12662a7e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1993281
Auto-Submit: Gauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#729733}
parent 1264abaf
......@@ -13,7 +13,6 @@
@class ChromeIdentity;
// TODO(crbug.com/894800): Remove this.
// Item for account avatar, used everywhere an account cell is shown.
@interface CollectionViewAccountItem : CollectionViewItem
......
......@@ -26,7 +26,6 @@ source_set("commands") {
"reading_list_add_command.mm",
"send_tab_to_self_command.h",
"send_tab_to_self_command.mm",
"settings_main_page_commands.h",
"show_signin_command.h",
"show_signin_command.mm",
"snackbar_commands.h",
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_COMMANDS_SETTINGS_MAIN_PAGE_COMMANDS_H_
#define IOS_CHROME_BROWSER_UI_COMMANDS_SETTINGS_MAIN_PAGE_COMMANDS_H_
// Command protocol for commands related to the Settings Main Page.
@protocol SettingsMainPageCommands
// Called when the Material Cell Catalog cell is tapped.
- (void)showMaterialCellCatalog;
@end
#endif // IOS_CHROME_BROWSER_UI_COMMANDS_SETTINGS_MAIN_PAGE_COMMANDS_H_
......@@ -8,8 +8,6 @@ source_set("settings_root") {
"bar_button_activity_indicator.h",
"bar_button_activity_indicator.mm",
"settings_navigation_controller.h",
"settings_root_collection_view_controller.h",
"settings_root_collection_view_controller.mm",
"settings_root_table_view_controller.h",
"settings_root_table_view_controller.mm",
"settings_root_view_controlling.h",
......@@ -19,9 +17,6 @@ source_set("settings_root") {
"//ios/chrome/app/strings",
"//ios/chrome/browser/browser_state",
"//ios/chrome/browser/ui:feature_flags",
"//ios/chrome/browser/ui/collection_view",
"//ios/chrome/browser/ui/collection_view/cells",
"//ios/chrome/browser/ui/collection_view/cells",
"//ios/chrome/browser/ui/commands",
"//ios/chrome/browser/ui/material_components",
"//ios/chrome/browser/ui/settings/cells",
......@@ -33,7 +28,6 @@ source_set("settings_root") {
"//ios/chrome/common/ui_util",
"//ios/public/provider/chrome/browser",
"//ios/public/provider/chrome/browser/user_feedback",
"//ios/third_party/material_components_ios",
"//ui/base",
]
}
......@@ -66,8 +60,6 @@ source_set("settings") {
"handoff_table_view_controller.mm",
"import_data_table_view_controller.h",
"import_data_table_view_controller.mm",
"material_cell_catalog_view_controller.h",
"material_cell_catalog_view_controller.mm",
"privacy_table_view_controller.h",
"privacy_table_view_controller.mm",
"search_engine_table_view_controller.h",
......@@ -154,7 +146,6 @@ source_set("settings") {
"//ios/chrome/browser/ui/authentication",
"//ios/chrome/browser/ui/authentication/cells",
"//ios/chrome/browser/ui/autofill/cells",
"//ios/chrome/browser/ui/collection_view",
"//ios/chrome/browser/ui/colors",
"//ios/chrome/browser/ui/commands",
"//ios/chrome/browser/ui/content_suggestions/cells",
......@@ -196,14 +187,10 @@ source_set("settings") {
"//ios/public/provider/chrome/browser/signin",
"//ios/public/provider/chrome/browser/user_feedback",
"//ios/public/provider/chrome/browser/voice",
"//ios/third_party/material_components_ios",
"//net",
"//ui/base",
"//url",
]
public_deps = [
"//ios/chrome/browser/ui/collection_view/cells",
]
allow_circular_includes_from = [ "//ios/chrome/browser/ui/authentication" ]
libs = [
"CoreLocation.framework",
......@@ -277,7 +264,6 @@ source_set("unit_tests") {
"privacy_table_view_controller_unittest.mm",
"search_engine_table_view_controller_unittest.mm",
"settings_navigation_controller_unittest.mm",
"settings_root_collection_view_controller_unittest.mm",
"settings_root_table_view_controller_unittest.mm",
"translate_table_view_controller_unittest.mm",
"voice_search_table_view_controller_unittest.mm",
......@@ -322,9 +308,6 @@ source_set("unit_tests") {
"//ios/chrome/browser/sync",
"//ios/chrome/browser/translate",
"//ios/chrome/browser/ui:feature_flags",
"//ios/chrome/browser/ui/collection_view",
"//ios/chrome/browser/ui/collection_view:test_support",
"//ios/chrome/browser/ui/collection_view/cells",
"//ios/chrome/browser/ui/icons",
"//ios/chrome/browser/ui/settings/cells",
"//ios/chrome/browser/ui/table_view",
......@@ -337,7 +320,6 @@ source_set("unit_tests") {
"//ios/chrome/test/app:test_support",
"//ios/public/provider/chrome/browser",
"//ios/public/provider/chrome/browser/voice",
"//ios/third_party/material_components_ios",
"//ios/web/public/test",
"//net",
"//net:test_support",
......
......@@ -24,8 +24,6 @@ source_set("cells") {
"settings_switch_cell.mm",
"settings_switch_item.h",
"settings_switch_item.mm",
"settings_text_item.h",
"settings_text_item.mm",
"sync_switch_item.h",
"sync_switch_item.mm",
"table_view_clear_browsing_data_item.h",
......@@ -57,7 +55,6 @@ source_set("cells") {
public_deps = [
":clear_browsing_data_constants",
"//ios/chrome/browser/ui/settings/cells/legacy",
]
configs += [ "//build/config/compiler:enable_arc" ]
......
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
source_set("legacy") {
sources = [
"legacy_settings_detail_item.h",
"legacy_settings_detail_item.mm",
]
deps = [
"//components/strings",
"//ios/chrome/app/strings",
"//ios/chrome/browser/ui/collection_view/cells",
"//ios/chrome/browser/ui/colors",
"//ios/chrome/browser/ui/icons",
"//ios/chrome/browser/ui/util",
"//ios/chrome/common/colors",
"//ios/chrome/common/ui_util",
"//ui/base",
]
configs += [ "//build/config/compiler:enable_arc" ]
}
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_SETTINGS_CELLS_LEGACY_LEGACY_SETTINGS_DETAIL_ITEM_H_
#define IOS_CHROME_BROWSER_UI_SETTINGS_CELLS_LEGACY_LEGACY_SETTINGS_DETAIL_ITEM_H_
#import <UIKit/UIKit.h>
#import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h"
#import "ios/third_party/material_components_ios/src/components/CollectionCells/src/MaterialCollectionCells.h"
// LegacySettingsDetailItem is a model class that uses LegacySettingsDetailCell.
@interface LegacySettingsDetailItem : CollectionViewItem
// The filename for the leading icon. If empty, no icon will be shown.
@property(nonatomic, copy) NSString* iconImageName;
// The accessory type to display on the trailing edge of the cell.
@property(nonatomic) MDCCollectionViewCellAccessoryType accessoryType;
// The main text string.
@property(nonatomic, copy) NSString* text;
// The detail text string.
@property(nonatomic, copy) NSString* detailText;
@end
// LegacySettingsDetailCell implements an MDCCollectionViewCell subclass
// containing an optional leading icon and two text labels: a "main" label and a
// "detail" label. The two labels are laid out side-by-side and fill the full
// width of the cell. Labels are truncated as needed to fit in the cell.
@interface LegacySettingsDetailCell : MDCCollectionViewCell
// UILabels corresponding to |text| and |detailText| from the item.
@property(nonatomic, readonly, strong) UILabel* textLabel;
@property(nonatomic, readonly, strong) UILabel* detailTextLabel;
// Sets the image that should be displayed at the leading edge of the cell. If
// set to nil, the icon will be hidden and the text labels will expand to fill
// the full width of the cell.
- (void)setIconImage:(UIImage*)image;
// The amount of horizontal space to provide to each of the labels. These values
// are determined with the following logic:
//
// - If there is sufficient room (after accounting for margins) for the full
// width of each label, use the current width of each label.
// - If not, use the current width of the main label and a clipped width for the
// detail label.
// - Unless the main label wants more than 75% of the available width and the
// detail label wants 25% or less of the available width, in which case use a
// clipped width for the main label and the current width of the detail label.
// - If both labels want more width than their guaranteed minimums (75% and
// 25%), use the guaranteed minimum amount for each.
//
// Exposed for testing.
@property(nonatomic, readonly) CGFloat textLabelTargetWidth;
@property(nonatomic, readonly) CGFloat detailTextLabelTargetWidth;
@end
#endif // IOS_CHROME_BROWSER_UI_SETTINGS_CELLS_LEGACY_LEGACY_SETTINGS_DETAIL_ITEM_H_
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/ui/settings/cells/legacy/legacy_settings_detail_item.h"
#include <algorithm>
#import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrome.h"
#include "ios/chrome/browser/ui/collection_view/cells/collection_view_cell_constants.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h"
#import "ios/chrome/common/colors/UIColor+cr_semantic_colors.h"
#import "ios/chrome/common/ui_util/constraints_ui_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace {
// Padding used on the leading and trailing edges of the cell and between the
// two labels.
const CGFloat kHorizontalPadding = 16;
// Padding used between the icon and the text labels.
const CGFloat kIconTrailingPadding = 12;
// Padding used on the top and bottom edges of the cell.
const CGFloat kVerticalPadding = 16;
// Size of the icon image.
const CGFloat kIconImageSize = 28;
// Minimum proportion of the available width to guarantee to the main and detail
// labels.
const CGFloat kMinTextWidthRatio = 0.75f;
const CGFloat kMinDetailTextWidthRatio = 0.25f;
} // namespace
@implementation LegacySettingsDetailItem
@synthesize accessoryType = _accessoryType;
@synthesize iconImageName = _iconImageName;
@synthesize text = _text;
@synthesize detailText = _detailText;
- (instancetype)initWithType:(NSInteger)type {
self = [super initWithType:type];
if (self) {
self.cellClass = [LegacySettingsDetailCell class];
}
return self;
}
#pragma mark CollectionViewItem
- (void)configureCell:(LegacySettingsDetailCell*)cell {
[super configureCell:cell];
[cell cr_setAccessoryType:self.accessoryType];
cell.textLabel.text = self.text;
cell.detailTextLabel.text = self.detailText;
// Update the icon image, if one is present.
UIImage* iconImage = nil;
if ([self.iconImageName length]) {
iconImage = [UIImage imageNamed:self.iconImageName];
}
[cell setIconImage:iconImage];
}
@end
@implementation LegacySettingsDetailCell {
UIImageView* _iconImageView;
UILayoutGuide* _labelContainerGuide;
NSLayoutConstraint* _iconHiddenConstraint;
NSLayoutConstraint* _iconVisibleConstraint;
NSLayoutConstraint* _textLabelWidthConstraint;
NSLayoutConstraint* _detailTextLabelWidthConstraint;
}
@synthesize detailTextLabel = _detailTextLabel;
@synthesize textLabel = _textLabel;
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
self.isAccessibilityElement = YES;
UIView* contentView = self.contentView;
_iconImageView = [[UIImageView alloc] init];
_iconImageView.translatesAutoresizingMaskIntoConstraints = NO;
_iconImageView.hidden = YES;
[contentView addSubview:_iconImageView];
// Constrain the labels inside a container view, to make width computations
// easier.
_labelContainerGuide = [[UILayoutGuide alloc] init];
[contentView addLayoutGuide:_labelContainerGuide];
_textLabel = [[UILabel alloc] init];
_textLabel.translatesAutoresizingMaskIntoConstraints = NO;
_textLabel.font = [UIFont systemFontOfSize:kUIKitMainFontSize];
_textLabel.textColor = UIColor.cr_labelColor;
_textLabel.backgroundColor = UIColor.clearColor;
[contentView addSubview:_textLabel];
_detailTextLabel = [[UILabel alloc] init];
_detailTextLabel.translatesAutoresizingMaskIntoConstraints = NO;
_detailTextLabel.font = [UIFont systemFontOfSize:kUIKitDetailFontSize];
_detailTextLabel.textColor = UIColor.cr_secondaryLabelColor;
_detailTextLabel.backgroundColor = UIColor.clearColor;
[contentView addSubview:_detailTextLabel];
// Set up the width constraints. They are activated here and updated in
// layoutSubviews.
_textLabelWidthConstraint =
[_textLabel.widthAnchor constraintEqualToConstant:0];
_detailTextLabelWidthConstraint =
[_detailTextLabel.widthAnchor constraintEqualToConstant:0];
// Set up the constraints for when the icon is visible and hidden. One of
// these will be active at a time, defaulting to hidden.
_iconHiddenConstraint = [_labelContainerGuide.leadingAnchor
constraintEqualToAnchor:contentView.leadingAnchor
constant:kHorizontalPadding];
_iconVisibleConstraint = [_labelContainerGuide.leadingAnchor
constraintEqualToAnchor:_iconImageView.trailingAnchor
constant:kIconTrailingPadding];
[NSLayoutConstraint activateConstraints:@[
[_iconImageView.leadingAnchor
constraintEqualToAnchor:contentView.leadingAnchor
constant:kHorizontalPadding],
[_iconImageView.widthAnchor constraintEqualToConstant:kIconImageSize],
[_iconImageView.heightAnchor constraintEqualToConstant:kIconImageSize],
// Fix the edges of the text labels.
[_textLabel.leadingAnchor
constraintEqualToAnchor:_labelContainerGuide.leadingAnchor],
[_detailTextLabel.trailingAnchor
constraintEqualToAnchor:_labelContainerGuide.trailingAnchor],
[_labelContainerGuide.trailingAnchor
constraintEqualToAnchor:contentView.trailingAnchor
constant:-kHorizontalPadding],
// Set up the vertical constraints and align the baselines of the two text
// labels.
[_iconImageView.centerYAnchor
constraintEqualToAnchor:contentView.centerYAnchor],
[_textLabel.centerYAnchor
constraintEqualToAnchor:contentView.centerYAnchor],
[_detailTextLabel.firstBaselineAnchor
constraintEqualToAnchor:_textLabel.firstBaselineAnchor],
_textLabelWidthConstraint,
_detailTextLabelWidthConstraint,
_iconHiddenConstraint,
]];
AddOptionalVerticalPadding(contentView, _textLabel, kVerticalPadding);
}
return self;
}
- (void)setIconImage:(UIImage*)image {
BOOL hidden = (image == nil);
if (hidden == _iconImageView.hidden) {
return;
}
_iconImageView.image = image;
_iconImageView.hidden = hidden;
if (hidden) {
_iconVisibleConstraint.active = NO;
_iconHiddenConstraint.active = YES;
} else {
_iconHiddenConstraint.active = NO;
_iconVisibleConstraint.active = YES;
}
}
// Updates the layout constraints of the text labels and then calls the
// superclass's implementation of layoutSubviews which can then take account of
// the new constraints.
- (void)layoutSubviews {
[super layoutSubviews];
// Size the labels in order to determine how much width they want.
[self.textLabel sizeToFit];
[self.detailTextLabel sizeToFit];
// Update the width constraints.
_textLabelWidthConstraint.constant = self.textLabelTargetWidth;
_detailTextLabelWidthConstraint.constant = self.detailTextLabelTargetWidth;
// Now invoke the layout.
[super layoutSubviews];
}
- (void)prepareForReuse {
[super prepareForReuse];
[self setIconImage:nil];
}
- (CGFloat)textLabelTargetWidth {
CGFloat availableWidth =
CGRectGetWidth(_labelContainerGuide.layoutFrame) - kHorizontalPadding;
CGFloat textLabelWidth = self.textLabel.frame.size.width;
CGFloat detailTextLabelWidth = self.detailTextLabel.frame.size.width;
if (textLabelWidth + detailTextLabelWidth <= availableWidth)
return textLabelWidth;
return std::max(
availableWidth - detailTextLabelWidth,
std::min(availableWidth * kMinTextWidthRatio, textLabelWidth));
}
- (CGFloat)detailTextLabelTargetWidth {
CGFloat availableWidth =
CGRectGetWidth(_labelContainerGuide.layoutFrame) - kHorizontalPadding;
CGFloat textLabelWidth = self.textLabel.frame.size.width;
CGFloat detailTextLabelWidth = self.detailTextLabel.frame.size.width;
if (textLabelWidth + detailTextLabelWidth <= availableWidth)
return detailTextLabelWidth;
return std::max(availableWidth - textLabelWidth,
std::min(availableWidth * kMinDetailTextWidthRatio,
detailTextLabelWidth));
}
- (NSString*)accessibilityLabel {
return self.textLabel.text;
}
- (NSString*)accessibilityValue {
return self.detailTextLabel.text;
}
@end
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_SETTINGS_CELLS_SETTINGS_TEXT_ITEM_H_
#define IOS_CHROME_BROWSER_UI_SETTINGS_CELLS_SETTINGS_TEXT_ITEM_H_
#import <UIKit/UIKit.h>
#import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h"
#import "ios/third_party/material_components_ios/src/components/CollectionCells/src/MaterialCollectionCells.h"
// Collection view item to represent and configure a CollectionViewTextCell.
// TODO(crbug.com/894800): Remove this.
@interface SettingsTextItem : CollectionViewItem
// The accessory type for the represented cell.
@property(nonatomic) MDCCollectionViewCellAccessoryType accessoryType;
// The main text to display.
@property(nonatomic, nullable, copy) NSString* text;
// The secondary text to display.
@property(nonatomic, nullable, copy) NSString* detailText;
// The font of the main text. Default is the medium SF font of size 16.
@property(nonatomic, null_resettable, copy) UIFont* textFont;
// The color of the main text. Default is the 900 tint color of the grey
// palette.
@property(nonatomic, null_resettable, copy) UIColor* textColor;
@end
// MDCCollectionViewCell that displays two text fields.
@interface SettingsTextCell : MDCCollectionViewCell
// The first line of text to display.
@property(nonatomic, readonly, strong, nullable) UILabel* textLabel;
// The second line of detail text to display.
@property(nonatomic, readonly, strong, nullable) UILabel* detailTextLabel;
// Returns the height needed for a cell contained in |width| to display
// |titleLabel| and |detailTextLabel|.
+ (CGFloat)heightForTitleLabel:(nullable UILabel*)titleLabel
detailTextLabel:(nullable UILabel*)detailTextLabel
width:(CGFloat)width;
@end
#endif // IOS_CHROME_BROWSER_UI_SETTINGS_CELLS_SETTINGS_TEXT_ITEM_H_
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/ui/settings/cells/settings_text_item.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
#import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrome.h"
#include "ios/chrome/browser/ui/collection_view/cells/collection_view_cell_constants.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h"
#import "ios/chrome/common/colors/semantic_color_names.h"
#import "ios/chrome/common/ui_util/constraints_ui_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace {
const CGFloat kMargin = 16;
const CGFloat kMinimalHeight = 48;
}
@interface SettingsTextItem ()
// The maximum number of lines of the main text. Default is 1.
@property(nonatomic, assign) NSInteger numberOfTextLines;
// The font of the secondary text. Default is the regular Roboto font of size
// 14.
@property(nonatomic, null_resettable, copy) UIFont* detailTextFont;
// The color of the secondary text. Default is the 500 tint color of the grey
// palette.
@property(nonatomic, null_resettable, copy) UIColor* detailTextColor;
// The maximum number of lines of the secondary text. Default is 1.
@property(nonatomic, assign) NSInteger numberOfDetailTextLines;
@end
@implementation SettingsTextItem
@synthesize accessoryType = _accessoryType;
@synthesize text = _text;
@synthesize detailText = _detailText;
@synthesize textFont = _textFont;
@synthesize textColor = _textColor;
@synthesize numberOfTextLines = _numberOfTextLines;
@synthesize detailTextFont = _detailTextFont;
@synthesize detailTextColor = _detailTextColor;
@synthesize numberOfDetailTextLines = _numberOfDetailTextLines;
- (instancetype)initWithType:(NSInteger)type {
self = [super initWithType:type];
if (self) {
self.cellClass = [SettingsTextCell class];
_numberOfTextLines = 1;
_numberOfDetailTextLines = 1;
}
return self;
}
- (UIFont*)textFont {
if (!_textFont) {
_textFont = [UIFont systemFontOfSize:kUIKitMainFontSize];
}
return _textFont;
}
- (UIColor*)textColor {
if (!_textColor) {
_textColor = [UIColor colorNamed:kTextPrimaryColor];
}
return _textColor;
}
- (UIFont*)detailTextFont {
if (!_detailTextFont) {
_detailTextFont = [UIFont systemFontOfSize:kUIKitMultilineDetailFontSize];
}
return _detailTextFont;
}
- (UIColor*)detailTextColor {
if (!_detailTextColor) {
_detailTextColor = [UIColor colorNamed:kTextSecondaryColor];
}
return _detailTextColor;
}
#pragma mark CollectionViewItem
- (void)configureCell:(SettingsTextCell*)cell {
[super configureCell:cell];
[cell cr_setAccessoryType:self.accessoryType];
cell.textLabel.text = self.text;
cell.detailTextLabel.text = self.detailText;
cell.isAccessibilityElement = YES;
if ([self.accessibilityLabel length] != 0) {
cell.accessibilityLabel = self.accessibilityLabel;
} else {
if (self.detailText.length == 0) {
cell.accessibilityLabel = self.text;
} else {
cell.accessibilityLabel =
[NSString stringWithFormat:@"%@, %@", self.text, self.detailText];
}
}
// Styling.
cell.textLabel.font = self.textFont;
cell.textLabel.textColor = self.textColor;
cell.textLabel.numberOfLines = self.numberOfTextLines;
cell.detailTextLabel.font = self.detailTextFont;
cell.detailTextLabel.textColor = self.detailTextColor;
cell.detailTextLabel.numberOfLines = self.numberOfDetailTextLines;
}
@end
@implementation SettingsTextCell
@synthesize textLabel = _textLabel;
@synthesize detailTextLabel = _detailTextLabel;
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
UIView* containerView = [[UIView alloc] initWithFrame:CGRectZero];
containerView.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:containerView];
_textLabel = [[UILabel alloc] initWithFrame:CGRectZero];
_textLabel.translatesAutoresizingMaskIntoConstraints = NO;
[containerView addSubview:_textLabel];
_detailTextLabel = [[UILabel alloc] initWithFrame:CGRectZero];
_detailTextLabel.translatesAutoresizingMaskIntoConstraints = NO;
[containerView addSubview:_detailTextLabel];
CGFloat margin = kMargin;
[NSLayoutConstraint activateConstraints:@[
// Total height.
// The MDC specs ask for at least 48 pt.
[self.contentView.heightAnchor
constraintGreaterThanOrEqualToConstant:kMinimalHeight],
// Container.
[containerView.leadingAnchor
constraintEqualToAnchor:self.contentView.leadingAnchor
constant:margin],
[containerView.trailingAnchor
constraintEqualToAnchor:self.contentView.trailingAnchor
constant:-margin],
[containerView.centerYAnchor
constraintEqualToAnchor:self.contentView.centerYAnchor],
// Labels.
[_textLabel.leadingAnchor
constraintEqualToAnchor:containerView.leadingAnchor],
[_textLabel.trailingAnchor
constraintLessThanOrEqualToAnchor:containerView.trailingAnchor],
[_textLabel.topAnchor constraintEqualToAnchor:containerView.topAnchor],
[_textLabel.bottomAnchor
constraintEqualToAnchor:_detailTextLabel.topAnchor],
[_detailTextLabel.leadingAnchor
constraintEqualToAnchor:_textLabel.leadingAnchor],
[_detailTextLabel.trailingAnchor
constraintLessThanOrEqualToAnchor:containerView.trailingAnchor],
[_detailTextLabel.bottomAnchor
constraintLessThanOrEqualToAnchor:containerView.bottomAnchor],
]];
AddOptionalVerticalPadding(self.contentView, containerView, margin);
}
return self;
}
+ (CGFloat)heightForTitleLabel:(UILabel*)titleLabel
detailTextLabel:(UILabel*)detailTextLabel
width:(CGFloat)width {
CGSize sizeForLabel = CGSizeMake(width - 2 * kMargin, 500);
CGFloat cellHeight = 2 * kMargin;
cellHeight += [titleLabel sizeThatFits:sizeForLabel].height;
cellHeight += [detailTextLabel sizeThatFits:sizeForLabel].height;
return MAX(cellHeight, kMinimalHeight);
}
// Implement -layoutSubviews as per instructions in documentation for
// +[MDCCollectionViewCell cr_preferredHeightForWidth:forItem:].
- (void)layoutSubviews {
[super layoutSubviews];
// Adjust the text and detailText label preferredMaxLayoutWidth when the
// parent's width changes, for instance on screen rotation.
CGFloat preferedMaxLayoutWidth =
CGRectGetWidth(self.contentView.frame) - 2 * kMargin;
_textLabel.preferredMaxLayoutWidth = preferedMaxLayoutWidth;
_detailTextLabel.preferredMaxLayoutWidth = preferedMaxLayoutWidth;
// Re-layout with the new preferred width to allow the label to adjust its
// height.
[super layoutSubviews];
}
- (void)prepareForReuse {
[super prepareForReuse];
self.textLabel.text = nil;
self.detailTextLabel.text = nil;
}
@end
......@@ -49,7 +49,6 @@ source_set("clear_browsing_data") {
"//ios/chrome/browser/ui/list_model",
"//ios/chrome/browser/ui/settings:settings_root",
"//ios/chrome/browser/ui/settings/cells",
"//ios/chrome/browser/ui/settings/cells/legacy",
"//ios/chrome/browser/ui/table_view",
"//ios/chrome/browser/ui/table_view:styler",
"//ios/chrome/browser/ui/table_view/cells",
......
......@@ -41,7 +41,6 @@
#import "ios/chrome/browser/ui/icons/chrome_icon.h"
#import "ios/chrome/browser/ui/list_model/list_model.h"
#import "ios/chrome/browser/ui/settings/cells/clear_browsing_data_constants.h"
#import "ios/chrome/browser/ui/settings/cells/legacy/legacy_settings_detail_item.h"
#import "ios/chrome/browser/ui/settings/cells/table_view_clear_browsing_data_item.h"
#import "ios/chrome/browser/ui/settings/clear_browsing_data/browsing_data_counter_wrapper_producer.h"
#import "ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_consumer.h"
......
......@@ -27,7 +27,6 @@
#import "ios/chrome/browser/ui/commands/application_commands.h"
#import "ios/chrome/browser/ui/commands/open_new_tab_command.h"
#import "ios/chrome/browser/ui/icons/chrome_icon.h"
#import "ios/chrome/browser/ui/settings/cells/settings_text_item.h"
#import "ios/chrome/browser/ui/settings/google_services/accounts_table_view_controller_constants.h"
#import "ios/chrome/browser/ui/settings/sync/utils/sync_util.h"
#import "ios/chrome/browser/ui/signin_interaction/signin_interaction_coordinator.h"
......
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_SETTINGS_MATERIAL_CELL_CATALOG_VIEW_CONTROLLER_H_
#define IOS_CHROME_BROWSER_UI_SETTINGS_MATERIAL_CELL_CATALOG_VIEW_CONTROLLER_H_
#import "ios/chrome/browser/ui/settings/settings_root_collection_view_controller.h"
@interface MaterialCellCatalogViewController
: SettingsRootCollectionViewController
- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithLayout:(UICollectionViewLayout*)layout
style:(CollectionViewControllerStyle)style
NS_UNAVAILABLE;
@end
#endif // IOS_CHROME_BROWSER_UI_SETTINGS_MATERIAL_CELL_CATALOG_VIEW_CONTROLLER_H_
......@@ -20,7 +20,6 @@
#import "ios/chrome/browser/ui/settings/google_services/google_services_settings_view_controller.h"
#import "ios/chrome/browser/ui/settings/import_data_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/password/passwords_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/settings_root_collection_view_controller.h"
#import "ios/chrome/browser/ui/settings/settings_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/sync/sync_encryption_passphrase_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/utils/settings_utils.h"
......
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_SETTINGS_SETTINGS_ROOT_COLLECTION_VIEW_CONTROLLER_H_
#define IOS_CHROME_BROWSER_UI_SETTINGS_SETTINGS_ROOT_COLLECTION_VIEW_CONTROLLER_H_
#import "ios/chrome/browser/ui/collection_view/cells/collection_view_footer_item.h"
#import "ios/chrome/browser/ui/collection_view/collection_view_controller.h"
#import "ios/chrome/browser/ui/settings/settings_root_view_controlling.h"
// Root class for collection view controllers in settings.
@interface SettingsRootCollectionViewController
: CollectionViewController<CollectionViewFooterLinkDelegate,
SettingsRootViewControlling>
// Creates an autoreleased Edit button for the collection view. Calls
// |editButtonEnabled| to determine if the button should be enabled.
- (UIBarButtonItem*)createEditButton;
// Creates an autoreleased Done button for the collection view's edit state.
- (UIBarButtonItem*)createEditDoneButton;
// Updates the edit or done button to reflect editing state. If the
// collectionView is not in edit mode (and thus showing the 'Done' button), it
// calls the above two functions to determine the existence and state of an edit
// button.
- (void)updateEditButton;
// Reloads the collection view model with |loadModel| and then reloads the
// collection view data. This class calls this method in |viewWillAppear:|.
- (void)reloadData;
// Whether this collection view controller should hide the "Done" button (the
// right navigation bar button). Default is NO.
@property(nonatomic, assign) BOOL shouldHideDoneButton;
// The collection view accessibility identifier to be set on |viewDidLoad|.
@property(nonatomic, copy) NSString* collectionViewAccessibilityIdentifier;
@end
// Subclasses of SettingsRootCollectionViewController should implement the
// following methods to customize the behavior.
@interface SettingsRootCollectionViewController (Subclassing)
// Returns NO. Subclasses should overload this if an edit button is required.
- (BOOL)shouldShowEditButton;
// Returns NO. Subclasses should overload this if the edit button should be
// enabled.
- (BOOL)editButtonEnabled;
// Notifies the view controller that the edit button has been tapped. If you
// override this method, you must call -[super editButtonPressed] at some point
// in your implementation.
//
// Note that this method calls -[self setEditing:] in order to change the
// editing mode of this controller.
- (void)editButtonPressed;
// Prevents user interaction until |-allowUserInteraction| is called by doing
// the following:
// * Disables user interaction with the navigation bar.
// * Replaces the done button with an activity indicator.
// * Covers the collection view with a transparent veil.
- (void)preventUserInteraction;
// Allows user interaction:
// * Enables user interaction with the navigation bar.
// * Restores the done button.
// * Removes the transparent veil.
- (void)allowUserInteraction;
@end
#endif // IOS_CHROME_BROWSER_UI_SETTINGS_SETTINGS_ROOT_COLLECTION_VIEW_CONTROLLER_H_
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/ui/settings/settings_root_collection_view_controller.h"
#include "base/logging.h"
#import "base/mac/foundation_util.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#import "ios/chrome/browser/ui/collection_view/cells/collection_view_cell_constants.h"
#import "ios/chrome/browser/ui/commands/application_commands.h"
#import "ios/chrome/browser/ui/commands/open_new_tab_command.h"
#import "ios/chrome/browser/ui/material_components/chrome_app_bar_view_controller.h"
#import "ios/chrome/browser/ui/settings/bar_button_activity_indicator.h"
#import "ios/chrome/browser/ui/settings/settings_navigation_controller.h"
#include "ios/chrome/browser/ui/util/ui_util.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h"
#import "ios/chrome/common/colors/UIColor+cr_semantic_colors.h"
#include "ios/chrome/grit/ios_strings.h"
#import "ios/third_party/material_components_ios/src/components/Collections/src/MaterialCollections.h"
#include "ui/base/l10n/l10n_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace {
enum SavedBarButtomItemPositionEnum {
kUndefinedBarButtonItemPosition,
kLeftBarButtonItemPosition,
kRightBarButtonItemPosition
};
// Dimension of the authentication operation activity indicator frame.
const CGFloat kActivityIndicatorDimensionIPad = 64;
const CGFloat kActivityIndicatorDimensionIPhone = 56;
} // namespace
@implementation SettingsRootCollectionViewController {
SavedBarButtomItemPositionEnum _savedBarButtonItemPosition;
UIBarButtonItem* _savedBarButtonItem;
UIView* _veil;
}
@synthesize shouldHideDoneButton = _shouldHideDoneButton;
@synthesize collectionViewAccessibilityIdentifier =
_collectionViewAccessibilityIdentifier;
@synthesize dispatcher = _dispatcher;
- (void)viewDidLoad {
[super viewDidLoad];
self.collectionView.accessibilityIdentifier =
self.collectionViewAccessibilityIdentifier;
// Customize collection view settings.
self.collectionView.backgroundColor = UIColor.cr_systemGroupedBackgroundColor;
self.styler.cellStyle = MDCCollectionViewCellStyleGrouped;
self.styler.separatorColor = UIColorFromRGB(kUIKitSeparatorColor);
self.appBarViewController.headerView.backgroundColor =
UIColor.cr_systemGroupedBackgroundColor;
self.styler.separatorInset = UIEdgeInsetsMake(0, 16, 0, 16);
self.navigationItem.largeTitleDisplayMode =
UINavigationItemLargeTitleDisplayModeNever;
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
UIBarButtonItem* doneButton = [self doneButtonIfNeeded];
if (!self.navigationItem.rightBarButtonItem && doneButton) {
self.navigationItem.rightBarButtonItem = doneButton;
}
}
- (UIViewController*)childViewControllerForStatusBarHidden {
return nil;
}
- (UIViewController*)childViewControllerForStatusBarStyle {
return nil;
}
- (UIBarButtonItem*)doneButtonIfNeeded {
if (self.shouldHideDoneButton) {
return nil;
}
SettingsNavigationController* navigationController =
base::mac::ObjCCast<SettingsNavigationController>(
self.navigationController);
return [navigationController doneButton];
}
- (UIBarButtonItem*)createEditButton {
// Create a custom Edit bar button item, as Material Navigation Bar does not
// handle a system UIBarButtonSystemItemEdit item.
UIBarButtonItem* button = [[UIBarButtonItem alloc]
initWithTitle:l10n_util::GetNSString(IDS_IOS_NAVIGATION_BAR_EDIT_BUTTON)
style:UIBarButtonItemStyleDone
target:self
action:@selector(editButtonPressed)];
[button setEnabled:[self editButtonEnabled]];
return button;
}
- (UIBarButtonItem*)createEditDoneButton {
// Create a custom Done bar button item, as Material Navigation Bar does not
// handle a system UIBarButtonSystemItemDone item.
return [[UIBarButtonItem alloc]
initWithTitle:l10n_util::GetNSString(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON)
style:UIBarButtonItemStyleDone
target:self
action:@selector(editButtonPressed)];
}
- (void)updateEditButton {
if ([self.editor isEditing]) {
self.navigationItem.rightBarButtonItem = [self createEditDoneButton];
} else if ([self shouldShowEditButton]) {
self.navigationItem.rightBarButtonItem = [self createEditButton];
} else {
self.navigationItem.rightBarButtonItem = [self doneButtonIfNeeded];
}
}
- (void)editButtonPressed {
[self.editor setEditing:![self.editor isEditing] animated:YES];
[self updateEditButton];
}
- (void)reloadData {
[self loadModel];
[self.collectionView reloadData];
}
#pragma mark - CollectionViewFooterLinkDelegate
- (void)cell:(CollectionViewFooterCell*)cell didTapLinkURL:(GURL)URL {
// Subclass must have a valid dispatcher assigned.
DCHECK(self.dispatcher);
OpenNewTabCommand* command = [OpenNewTabCommand commandWithURLFromChrome:URL];
[self.dispatcher closeSettingsUIAndOpenURL:command];
}
#pragma mark - Subclassing
- (BOOL)shouldShowEditButton {
return NO;
}
- (BOOL)editButtonEnabled {
return NO;
}
- (void)preventUserInteraction {
DCHECK(!_savedBarButtonItem);
DCHECK_EQ(kUndefinedBarButtonItemPosition, _savedBarButtonItemPosition);
// Create |waitButton|.
BOOL displayActivityIndicatorOnTheRight =
self.navigationItem.rightBarButtonItem != nil;
CGFloat activityIndicatorDimension = IsIPadIdiom()
? kActivityIndicatorDimensionIPad
: kActivityIndicatorDimensionIPhone;
BarButtonActivityIndicator* indicator = [[BarButtonActivityIndicator alloc]
initWithFrame:CGRectMake(0.0, 0.0, activityIndicatorDimension,
activityIndicatorDimension)];
UIBarButtonItem* waitButton =
[[UIBarButtonItem alloc] initWithCustomView:indicator];
if (displayActivityIndicatorOnTheRight) {
// If there is a right bar button item, then it is the "Done" button.
_savedBarButtonItem = self.navigationItem.rightBarButtonItem;
_savedBarButtonItemPosition = kRightBarButtonItemPosition;
self.navigationItem.rightBarButtonItem = waitButton;
[self.navigationItem.leftBarButtonItem setEnabled:NO];
} else {
_savedBarButtonItem = self.navigationItem.leftBarButtonItem;
_savedBarButtonItemPosition = kLeftBarButtonItemPosition;
self.navigationItem.leftBarButtonItem = waitButton;
}
// Adds a veil that covers the collection view and prevents user interaction.
DCHECK(self.view);
DCHECK(!_veil);
_veil = [[UIView alloc] initWithFrame:self.view.bounds];
[_veil setAutoresizingMask:(UIViewAutoresizingFlexibleWidth |
UIViewAutoresizingFlexibleHeight)];
[_veil setBackgroundColor:[UIColor colorWithWhite:1.0 alpha:0.5]];
[self.view addSubview:_veil];
// Disable user interaction for the navigation controller view to ensure
// that the user cannot go back by swipping the navigation's top view
// controller
[self.navigationController.view setUserInteractionEnabled:NO];
}
- (void)allowUserInteraction {
DCHECK(self.navigationController)
<< "|allowUserInteraction| should always be called before this settings"
" controller is popped or dismissed.";
[self.navigationController.view setUserInteractionEnabled:YES];
// Removes the veil that prevents user interaction.
DCHECK(_veil);
[UIView animateWithDuration:0.3
animations:^{
[_veil removeFromSuperview];
}
completion:^(BOOL finished) {
_veil = nil;
}];
DCHECK(_savedBarButtonItem);
switch (_savedBarButtonItemPosition) {
case kLeftBarButtonItemPosition:
self.navigationItem.leftBarButtonItem = _savedBarButtonItem;
break;
case kRightBarButtonItemPosition:
self.navigationItem.rightBarButtonItem = _savedBarButtonItem;
[self.navigationItem.leftBarButtonItem setEnabled:YES];
break;
default:
NOTREACHED();
break;
}
_savedBarButtonItem = nil;
_savedBarButtonItemPosition = kUndefinedBarButtonItemPosition;
}
@end
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/ui/settings/settings_root_collection_view_controller.h"
#import <Foundation/Foundation.h>
#import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h"
#import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
#include "testing/gtest/include/gtest/gtest.h"
#import "testing/gtest_mac.h"
#include "testing/platform_test.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@interface TestSettingsRootCollectionViewController
: SettingsRootCollectionViewController
@property(nonatomic, readonly) NSMutableArray* items;
- (void)reset;
@end
@implementation TestSettingsRootCollectionViewController {
NSMutableArray* _items;
}
- (NSMutableArray*)items {
if (!_items) {
_items = [[NSMutableArray alloc] init];
}
return _items;
}
- (void)reset {
_items = nil;
}
- (void)loadModel {
[super loadModel];
if ([self.items count] > 0) {
[self.collectionViewModel
addSectionWithIdentifier:kSectionIdentifierEnumZero];
}
for (CollectionViewItem* item in self.items) {
[self.collectionViewModel addItem:item
toSectionWithIdentifier:kSectionIdentifierEnumZero];
}
}
@end
namespace {
class SettingsRootCollectionViewControllerTest : public PlatformTest {
public:
SettingsRootCollectionViewControllerTest()
: controller_([[TestSettingsRootCollectionViewController alloc]
initWithLayout:[[MDCCollectionViewFlowLayout alloc] init]
style:CollectionViewControllerStyleDefault]) {
item1_ = [[CollectionViewItem alloc] initWithType:kItemTypeEnumZero];
item2_ = [[CollectionViewItem alloc] initWithType:kItemTypeEnumZero + 10];
}
protected:
void SetUp() override {
PlatformTest::SetUp();
[controller() reset];
}
TestSettingsRootCollectionViewController* controller() { return controller_; }
CollectionViewItem* item1() { return item1_; }
CollectionViewItem* item2() { return item2_; }
id getCollectionViewItem(int section, int item) {
return [controller().collectionViewModel
itemAtIndexPath:[NSIndexPath indexPathForItem:item inSection:section]];
}
int numberOfSections() {
return [controller().collectionViewModel numberOfSections];
}
int numberOfItems(int section) {
return [controller().collectionViewModel numberOfItemsInSection:section];
}
TestSettingsRootCollectionViewController* controller_;
CollectionViewItem* item1_;
CollectionViewItem* item2_;
};
TEST_F(SettingsRootCollectionViewControllerTest, Empty) {
[controller() loadModel];
EXPECT_EQ(0, numberOfSections());
}
TEST_F(SettingsRootCollectionViewControllerTest, ModelContents) {
[controller().items addObjectsFromArray:@[ item1(), item2() ]];
[controller() loadModel];
EXPECT_EQ(1, numberOfSections());
EXPECT_EQ(2, numberOfItems(0));
EXPECT_EQ(item1(), getCollectionViewItem(0, 0));
EXPECT_EQ(item2(), getCollectionViewItem(0, 1));
}
} // namespace
......@@ -19,11 +19,6 @@ class Browser;
@interface SettingsTableViewController
: SettingsRootTableViewController <SettingsControllerProtocol>
// Dispatcher for SettingsMainPageCommands. Defaults to self if not set.
// TODO(crbug.com/738881): Unify this with the dispatcher passed into the init.
@property(weak, nonatomic) id<SettingsMainPageCommands>
settingsMainPageDispatcher;
// Initializes a new SettingsTableViewController. |browser| must not
// be nil and must not be associated with an off the record browser state.
- (instancetype)
......
......@@ -42,7 +42,6 @@
#import "ios/chrome/browser/ui/authentication/cells/table_view_account_item.h"
#import "ios/chrome/browser/ui/authentication/cells/table_view_signin_promo_item.h"
#import "ios/chrome/browser/ui/authentication/signin_promo_view_mediator.h"
#import "ios/chrome/browser/ui/commands/settings_main_page_commands.h"
#import "ios/chrome/browser/ui/settings/about_chrome_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/autofill/autofill_credit_card_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/autofill/autofill_profile_table_view_controller.h"
......@@ -55,7 +54,6 @@
#import "ios/chrome/browser/ui/settings/google_services/google_services_settings_coordinator.h"
#import "ios/chrome/browser/ui/settings/language/language_settings_mediator.h"
#import "ios/chrome/browser/ui/settings/language/language_settings_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/material_cell_catalog_view_controller.h"
#import "ios/chrome/browser/ui/settings/password/passwords_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/privacy_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/search_engine_table_view_controller.h"
......@@ -142,7 +140,6 @@ typedef NS_ENUM(NSInteger, ItemType) {
ItemTypeAboutChrome,
ItemTypeMemoryDebugging,
ItemTypeViewSource,
ItemTypeCollectionCellCatalog,
ItemTypeTableCellCatalog,
ItemTypeArticlesForYou,
};
......@@ -163,7 +160,6 @@ NSString* kDevViewSourceKey = @"DevViewSource";
PrefObserverDelegate,
SettingsControllerProtocol,
SearchEngineObserving,
SettingsMainPageCommands,
SigninPresenter,
SigninPromoViewConsumer,
SyncObserverModelBridge> {
......@@ -238,7 +234,6 @@ NSString* kDevViewSourceKey = @"DevViewSource";
@end
@implementation SettingsTableViewController
@synthesize settingsMainPageDispatcher = _settingsMainPageDispatcher;
@synthesize dispatcher = _dispatcher;
@synthesize signinInteractionCoordinator = _signinInteractionCoordinator;
......@@ -308,7 +303,6 @@ NSString* kDevViewSourceKey = @"DevViewSource";
_prefObserverBridge->ObserveChangesForPreference(
autofill::prefs::kAutofillProfileEnabled, &_prefChangeRegistrar);
_settingsMainPageDispatcher = self;
_dispatcher = dispatcher;
// TODO(crbug.com/764578): -loadModel should not be called from
......@@ -440,8 +434,6 @@ NSString* kDevViewSourceKey = @"DevViewSource";
#if BUILDFLAG(CHROMIUM_BRANDING) && !defined(NDEBUG)
[model addItem:[self viewSourceSwitchItem]
toSectionWithIdentifier:SectionIdentifierDebug];
[model addItem:[self collectionViewCatalogDetailItem]
toSectionWithIdentifier:SectionIdentifierDebug];
[model addItem:[self tableViewCatalogDetailItem]
toSectionWithIdentifier:SectionIdentifierDebug];
#endif // BUILDFLAG(CHROMIUM_BRANDING) && !defined(NDEBUG)
......@@ -651,13 +643,6 @@ NSString* kDevViewSourceKey = @"DevViewSource";
withDefaultsKey:kDevViewSourceKey];
}
- (TableViewDetailIconItem*)collectionViewCatalogDetailItem {
return [self detailItemWithType:ItemTypeCollectionCellCatalog
text:@"Collection Cell Catalog"
detailText:nil
iconImageName:kSettingsDebugImageName];
}
- (TableViewDetailIconItem*)tableViewCatalogDetailItem {
return [self detailItemWithType:ItemTypeTableCellCatalog
text:@"TableView Cell Catalog"
......@@ -849,9 +834,6 @@ NSString* kDevViewSourceKey = @"DevViewSource";
// Taps on these don't do anything. They have a switch as accessory view
// and only the switch is tappable.
break;
case ItemTypeCollectionCellCatalog:
[self.settingsMainPageDispatcher showMaterialCellCatalog];
break;
case ItemTypeTableCellCatalog:
[self.navigationController
pushViewController:[[TableCellCatalogViewController alloc] init]
......@@ -1080,14 +1062,6 @@ NSString* kDevViewSourceKey = @"DevViewSource";
[self reloadData];
}
#pragma mark Material Cell Catalog
- (void)showMaterialCellCatalog {
[self.navigationController
pushViewController:[[MaterialCellCatalogViewController alloc] init]
animated:YES];
}
#pragma mark SettingsControllerProtocol
- (void)settingsWillBeDismissed {
......
......@@ -38,7 +38,6 @@ source_set("sync") {
"//ios/chrome/browser/ui/commands",
"//ios/chrome/browser/ui/settings:settings_root",
"//ios/chrome/browser/ui/settings/cells",
"//ios/chrome/browser/ui/settings/cells/legacy",
"//ios/chrome/browser/ui/settings/sync/utils",
"//ios/chrome/browser/ui/settings/utils",
"//ios/chrome/browser/ui/table_view",
......@@ -83,7 +82,6 @@ source_set("unit_tests") {
"//ios/chrome/browser/ui/collection_view:test_support",
"//ios/chrome/browser/ui/settings:test_support",
"//ios/chrome/browser/ui/settings/cells",
"//ios/chrome/browser/ui/settings/cells/legacy",
"//ios/chrome/browser/ui/settings/sync/utils",
"//ios/chrome/browser/ui/table_view",
"//ios/chrome/browser/ui/table_view:test_support",
......
......@@ -389,6 +389,7 @@ source_set("eg_app_support+eg2") {
"//ios/chrome/browser/ui/autofill/manual_fill:manual_fill_ui",
"//ios/chrome/browser/ui/bookmarks:bookmarks_ui",
"//ios/chrome/browser/ui/bookmarks:eg_app_support+eg2",
"//ios/chrome/browser/ui/collection_view/cells",
"//ios/chrome/browser/ui/commands",
"//ios/chrome/browser/ui/content_suggestions:constants",
"//ios/chrome/browser/ui/content_suggestions:content_suggestions_constant",
......
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