Commit 1dd496e0 authored by Javier Ernesto Flores Robles's avatar Javier Ernesto Flores Robles Committed by Chromium LUCI CQ

[iOS][CredentialProvider] Cells are now selectable

Bug: 1100887
Change-Id: I000ab80315270109c59f0a80c4fbfac2addc77ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2583209Reviewed-by: default avatarDavid Jean <djean@chromium.org>
Commit-Queue: Javier Flores <javierrobles@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835651}
parent 599362e8
......@@ -34,7 +34,8 @@ typedef NS_ENUM(NSInteger, RowIdentifier) {
} // namespace
@interface CredentialDetailsViewController () <UITableViewDataSource>
@interface CredentialDetailsViewController () <TooltipViewDelegate,
UITableViewDataSource>
// Current credential.
@property(nonatomic, weak) id<Credential> credential;
......@@ -89,11 +90,8 @@ typedef NS_ENUM(NSInteger, RowIdentifier) {
reuseIdentifier:kCellIdentifier];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.textLabel.textColor = [UIColor colorNamed:kTextPrimaryColor];
cell.detailTextLabel.textColor = [UIColor colorNamed:kTextSecondaryColor];
cell.contentView.backgroundColor = [UIColor colorNamed:kBackgroundColor];
cell.backgroundColor = [UIColor colorNamed:kBackgroundColor];
cell.accessibilityTraits |= UIAccessibilityTraitButton;
switch (indexPath.row) {
......@@ -164,6 +162,13 @@ typedef NS_ENUM(NSInteger, RowIdentifier) {
}
}
#pragma mark - TooltipViewDelegate
- (void)tooltipViewWillDismiss:(TooltipView*)tooltipView {
NSIndexPath* selectedIndexPath = self.tableView.indexPathForSelectedRow;
[self.tableView deselectRowAtIndexPath:selectedIndexPath animated:YES];
}
#pragma mark - Private
// Copy credential URL to clipboard.
......@@ -219,7 +224,6 @@ typedef NS_ENUM(NSInteger, RowIdentifier) {
HighlightButton* button = [HighlightButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0.0, 0.0, image.size.width, image.size.height);
button.backgroundColor = [UIColor colorNamed:kBackgroundColor];
[button setBackgroundImage:image forState:UIControlStateNormal];
[button setTintColor:[UIColor colorNamed:kBlueColor]];
[button addTarget:self
......@@ -287,6 +291,7 @@ typedef NS_ENUM(NSInteger, RowIdentifier) {
TooltipView* tooltip = [[TooltipView alloc] initWithKeyWindow:self.view
target:self
action:action];
tooltip.delegate = self;
[tooltip showMessage:message atBottomOf:cell];
UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification,
tooltip);
......
......@@ -7,8 +7,20 @@
#import <UIKit/UIKit.h>
@class TooltipView;
@protocol TooltipViewDelegate
// Informs the delegate that the tooltip is going to be dismissed.
- (void)tooltipViewWillDismiss:(TooltipView*)tooltipView;
@end
@interface TooltipView : UIView
// Delegate for a tooltip view instance.
@property(nonatomic, weak) id<TooltipViewDelegate> delegate;
// Init with the target and |action| parameter-less selector.
- (instancetype)initWithKeyWindow:(UIView*)keyWindow
target:(NSObject*)target
......
......@@ -121,6 +121,7 @@ static __weak TooltipView* _active;
if (self == _active) {
_active = nil;
}
[self.delegate tooltipViewWillDismiss:self];
[UIView animateWithDuration:kTooltipFadeInTime
delay:0.0
options:UIViewAnimationOptionCurveEaseOut
......
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