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) { ...@@ -34,7 +34,8 @@ typedef NS_ENUM(NSInteger, RowIdentifier) {
} // namespace } // namespace
@interface CredentialDetailsViewController () <UITableViewDataSource> @interface CredentialDetailsViewController () <TooltipViewDelegate,
UITableViewDataSource>
// Current credential. // Current credential.
@property(nonatomic, weak) id<Credential> credential; @property(nonatomic, weak) id<Credential> credential;
...@@ -89,11 +90,8 @@ typedef NS_ENUM(NSInteger, RowIdentifier) { ...@@ -89,11 +90,8 @@ typedef NS_ENUM(NSInteger, RowIdentifier) {
reuseIdentifier:kCellIdentifier]; reuseIdentifier:kCellIdentifier];
} }
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.textLabel.textColor = [UIColor colorNamed:kTextPrimaryColor]; cell.textLabel.textColor = [UIColor colorNamed:kTextPrimaryColor];
cell.detailTextLabel.textColor = [UIColor colorNamed:kTextSecondaryColor]; cell.detailTextLabel.textColor = [UIColor colorNamed:kTextSecondaryColor];
cell.contentView.backgroundColor = [UIColor colorNamed:kBackgroundColor];
cell.backgroundColor = [UIColor colorNamed:kBackgroundColor];
cell.accessibilityTraits |= UIAccessibilityTraitButton; cell.accessibilityTraits |= UIAccessibilityTraitButton;
switch (indexPath.row) { switch (indexPath.row) {
...@@ -164,6 +162,13 @@ typedef NS_ENUM(NSInteger, RowIdentifier) { ...@@ -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 #pragma mark - Private
// Copy credential URL to clipboard. // Copy credential URL to clipboard.
...@@ -219,7 +224,6 @@ typedef NS_ENUM(NSInteger, RowIdentifier) { ...@@ -219,7 +224,6 @@ typedef NS_ENUM(NSInteger, RowIdentifier) {
HighlightButton* button = [HighlightButton buttonWithType:UIButtonTypeCustom]; HighlightButton* button = [HighlightButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0.0, 0.0, image.size.width, image.size.height); button.frame = CGRectMake(0.0, 0.0, image.size.width, image.size.height);
button.backgroundColor = [UIColor colorNamed:kBackgroundColor];
[button setBackgroundImage:image forState:UIControlStateNormal]; [button setBackgroundImage:image forState:UIControlStateNormal];
[button setTintColor:[UIColor colorNamed:kBlueColor]]; [button setTintColor:[UIColor colorNamed:kBlueColor]];
[button addTarget:self [button addTarget:self
...@@ -287,6 +291,7 @@ typedef NS_ENUM(NSInteger, RowIdentifier) { ...@@ -287,6 +291,7 @@ typedef NS_ENUM(NSInteger, RowIdentifier) {
TooltipView* tooltip = [[TooltipView alloc] initWithKeyWindow:self.view TooltipView* tooltip = [[TooltipView alloc] initWithKeyWindow:self.view
target:self target:self
action:action]; action:action];
tooltip.delegate = self;
[tooltip showMessage:message atBottomOf:cell]; [tooltip showMessage:message atBottomOf:cell];
UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification,
tooltip); tooltip);
......
...@@ -7,8 +7,20 @@ ...@@ -7,8 +7,20 @@
#import <UIKit/UIKit.h> #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 @interface TooltipView : UIView
// Delegate for a tooltip view instance.
@property(nonatomic, weak) id<TooltipViewDelegate> delegate;
// Init with the target and |action| parameter-less selector. // Init with the target and |action| parameter-less selector.
- (instancetype)initWithKeyWindow:(UIView*)keyWindow - (instancetype)initWithKeyWindow:(UIView*)keyWindow
target:(NSObject*)target target:(NSObject*)target
......
...@@ -121,6 +121,7 @@ static __weak TooltipView* _active; ...@@ -121,6 +121,7 @@ static __weak TooltipView* _active;
if (self == _active) { if (self == _active) {
_active = nil; _active = nil;
} }
[self.delegate tooltipViewWillDismiss:self];
[UIView animateWithDuration:kTooltipFadeInTime [UIView animateWithDuration:kTooltipFadeInTime
delay:0.0 delay:0.0
options:UIViewAnimationOptionCurveEaseOut 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