Commit ca2e472b authored by edchin's avatar edchin Committed by Commit Bot

[ios] Reduce pointer boilerplate in Credential Provider

crrev.com/c/2199891 introduces a reusable class for pointer
interactions for non-button views. This class internally handles
all the delegate callbacks. So usage is simplified to a single line.

This CL should have no impact/change on the UI.

Bug: 1073961
Change-Id: I28904804916d0c112f73fe6e372bea6aede504d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2199727Reviewed-by: default avatarJavier Ernesto Flores Robles <javierrobles@chromium.org>
Commit-Queue: edchin <edchin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#768924}
parent e6cc2e07
......@@ -33,6 +33,7 @@ source_set("ui") {
"//ios/chrome/common/credential_provider:ui",
"//ios/chrome/common/ui/colors",
"//ios/chrome/common/ui/confirmation_alert",
"//ios/chrome/common/ui/util",
"//ios/chrome/credential_provider_extension:metrics_util",
"//ios/chrome/credential_provider_extension:password_util",
"//ios/chrome/credential_provider_extension:reauthentication_handler",
......
......@@ -8,6 +8,7 @@
#include "ios/chrome/common/app_group/app_group_metrics.h"
#import "ios/chrome/common/credential_provider/credential.h"
#import "ios/chrome/common/ui/colors/semantic_color_names.h"
#import "ios/chrome/common/ui/util/pointer_interaction_util.h"
#import "ios/chrome/credential_provider_extension/metrics_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
......@@ -24,7 +25,7 @@ const CGFloat kHeaderHeight = 70;
#if defined(__IPHONE_13_4)
// This cell just adds a simple hover pointer interaction to the TableViewCell.
@interface CredentialListCell : UITableViewCell <UIPointerInteractionDelegate>
@interface CredentialListCell : UITableViewCell
@end
@implementation CredentialListCell
......@@ -34,33 +35,12 @@ const CGFloat kHeaderHeight = 70;
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
if (@available(iOS 13.4, *)) {
[self
addInteraction:[[UIPointerInteraction alloc] initWithDelegate:self]];
[self addInteraction:[[ViewPointerInteraction alloc] init]];
}
}
return self;
}
#pragma mark UIPointerInteractionDelegate
- (UIPointerRegion*)pointerInteraction:(UIPointerInteraction*)interaction
regionForRequest:(UIPointerRegionRequest*)request
defaultRegion:(UIPointerRegion*)defaultRegion
API_AVAILABLE(ios(13.4)) {
return defaultRegion;
}
- (UIPointerStyle*)pointerInteraction:(UIPointerInteraction*)interaction
styleForRegion:(UIPointerRegion*)region
API_AVAILABLE(ios(13.4)) {
UIPointerHoverEffect* effect = [UIPointerHoverEffect
effectWithPreview:[[UITargetedPreview alloc] initWithView:self]];
effect.prefersScaledContent = NO;
effect.prefersShadow = NO;
return [UIPointerStyle styleWithEffect:effect shape:nil];
}
@end
#endif // defined(__IPHONE_13_4)
@interface CredentialListViewController () <UITableViewDataSource,
......
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