Commit a007ad47 authored by Rohit Rao's avatar Rohit Rao Committed by Commit Bot

Stops calling deprecated widget vibrancy effect APIs on iOS 13.

BUG=1086653

Change-Id: Id91956ebcf96d1058e987b025c3dddc6620916de
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2216590Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Commit-Queue: Rohit Rao <rohitrao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772234}
parent 11845ef7
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#import <NotificationCenter/NotificationCenter.h> #import <NotificationCenter/NotificationCenter.h>
#include "base/check.h"
#import "ios/chrome/common/ui/favicon/favicon_view.h" #import "ios/chrome/common/ui/favicon/favicon_view.h"
#import "ios/chrome/common/ui/util/constraints_ui_util.h" #import "ios/chrome/common/ui/util/constraints_ui_util.h"
...@@ -35,12 +36,14 @@ const CGFloat kTileWidth = 73; ...@@ -35,12 +36,14 @@ const CGFloat kTileWidth = 73;
- (instancetype)init { - (instancetype)init {
self = [super initWithFrame:CGRectZero]; self = [super initWithFrame:CGRectZero];
if (self) { if (self) {
UIVibrancyEffect* labelEffect = UIVibrancyEffect* labelEffect = nil;
[UIVibrancyEffect widgetSecondaryVibrancyEffect];
if (@available(iOS 13, *)) { if (@available(iOS 13, *)) {
labelEffect = [UIVibrancyEffect labelEffect = [UIVibrancyEffect
widgetEffectForVibrancyStyle:UIVibrancyEffectStyleSecondaryLabel]; widgetEffectForVibrancyStyle:UIVibrancyEffectStyleSecondaryLabel];
} else {
labelEffect = [UIVibrancyEffect widgetSecondaryVibrancyEffect];
} }
DCHECK(labelEffect);
UIVisualEffectView* titleLabelEffectView = UIVisualEffectView* titleLabelEffectView =
[[UIVisualEffectView alloc] initWithEffect:labelEffect]; [[UIVisualEffectView alloc] initWithEffect:labelEffect];
......
...@@ -56,14 +56,10 @@ const CGFloat kURLButtonMargin = 10; ...@@ -56,14 +56,10 @@ const CGFloat kURLButtonMargin = 10;
action:actionSelector action:actionSelector
forControlEvents:UIControlEventTouchUpInside]; forControlEvents:UIControlEventTouchUpInside];
UIVibrancyEffect* primaryEffect = UIVibrancyEffect* primaryEffect = nil;
[UIVibrancyEffect widgetPrimaryVibrancyEffect]; UIVibrancyEffect* secondaryEffect = nil;
UIVibrancyEffect* secondaryEffect = UIVibrancyEffect* backgroundEffect = nil;
[UIVibrancyEffect widgetSecondaryVibrancyEffect]; UIVibrancyEffect* hairlineEffect = nil;
UIVibrancyEffect* backgroundEffect =
[UIVibrancyEffect widgetSecondaryVibrancyEffect];
UIVibrancyEffect* hairlineEffect =
[UIVibrancyEffect widgetSecondaryVibrancyEffect];
if (@available(iOS 13, *)) { if (@available(iOS 13, *)) {
primaryEffect = [UIVibrancyEffect primaryEffect = [UIVibrancyEffect
widgetEffectForVibrancyStyle:UIVibrancyEffectStyleLabel]; widgetEffectForVibrancyStyle:UIVibrancyEffectStyleLabel];
...@@ -73,7 +69,16 @@ const CGFloat kURLButtonMargin = 10; ...@@ -73,7 +69,16 @@ const CGFloat kURLButtonMargin = 10;
widgetEffectForVibrancyStyle:UIVibrancyEffectStyleTertiaryFill]; widgetEffectForVibrancyStyle:UIVibrancyEffectStyleTertiaryFill];
hairlineEffect = [UIVibrancyEffect hairlineEffect = [UIVibrancyEffect
widgetEffectForVibrancyStyle:UIVibrancyEffectStyleSeparator]; widgetEffectForVibrancyStyle:UIVibrancyEffectStyleSeparator];
} else {
primaryEffect = [UIVibrancyEffect widgetPrimaryVibrancyEffect];
secondaryEffect = [UIVibrancyEffect widgetSecondaryVibrancyEffect];
backgroundEffect = [UIVibrancyEffect widgetSecondaryVibrancyEffect];
hairlineEffect = [UIVibrancyEffect widgetSecondaryVibrancyEffect];
} }
DCHECK(primaryEffect);
DCHECK(secondaryEffect);
DCHECK(backgroundEffect);
DCHECK(hairlineEffect);
_primaryEffectView = _primaryEffectView =
[[UIVisualEffectView alloc] initWithEffect:primaryEffect]; [[UIVisualEffectView alloc] initWithEffect:primaryEffect];
......
...@@ -32,12 +32,9 @@ const CGFloat kIconSize = 35; ...@@ -32,12 +32,9 @@ const CGFloat kIconSize = 35;
if (self) { if (self) {
self.translatesAutoresizingMaskIntoConstraints = NO; self.translatesAutoresizingMaskIntoConstraints = NO;
UIVibrancyEffect* primaryEffect = UIVibrancyEffect* primaryEffect = nil;
[UIVibrancyEffect widgetPrimaryVibrancyEffect]; UIVibrancyEffect* secondaryEffect = nil;
UIVibrancyEffect* secondaryEffect = UIVibrancyEffect* iconBackgroundEffect = nil;
[UIVibrancyEffect widgetSecondaryVibrancyEffect];
UIVibrancyEffect* iconBackgroundEffect =
[UIVibrancyEffect widgetSecondaryVibrancyEffect];
if (@available(iOS 13, *)) { if (@available(iOS 13, *)) {
primaryEffect = [UIVibrancyEffect primaryEffect = [UIVibrancyEffect
widgetEffectForVibrancyStyle:UIVibrancyEffectStyleLabel]; widgetEffectForVibrancyStyle:UIVibrancyEffectStyleLabel];
...@@ -45,7 +42,14 @@ const CGFloat kIconSize = 35; ...@@ -45,7 +42,14 @@ const CGFloat kIconSize = 35;
widgetEffectForVibrancyStyle:UIVibrancyEffectStyleSecondaryLabel]; widgetEffectForVibrancyStyle:UIVibrancyEffectStyleSecondaryLabel];
iconBackgroundEffect = [UIVibrancyEffect iconBackgroundEffect = [UIVibrancyEffect
widgetEffectForVibrancyStyle:UIVibrancyEffectStyleTertiaryFill]; widgetEffectForVibrancyStyle:UIVibrancyEffectStyleTertiaryFill];
} else {
primaryEffect = [UIVibrancyEffect widgetPrimaryVibrancyEffect];
secondaryEffect = [UIVibrancyEffect widgetSecondaryVibrancyEffect];
iconBackgroundEffect = [UIVibrancyEffect widgetSecondaryVibrancyEffect];
} }
DCHECK(primaryEffect);
DCHECK(secondaryEffect);
DCHECK(iconBackgroundEffect);
UIVisualEffectView* primaryEffectView = UIVisualEffectView* primaryEffectView =
[[UIVisualEffectView alloc] initWithEffect:primaryEffect]; [[UIVisualEffectView alloc] initWithEffect:primaryEffect];
......
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