Respond to CR.

pull/1/head
Matthew Chen 7 years ago
parent d161e5ff3d
commit cbaf40d4ce

@ -30,10 +30,15 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)init NS_UNAVAILABLE;
+ (OWSBubbleShapeView *)bubbleDrawView;
+ (OWSBubbleShapeView *)bubbleShadowView;
+ (OWSBubbleShapeView *)bubbleClipView;
+ (OWSBubbleShapeView *)bubbleInnerShadowView;
- (instancetype)initDraw NS_DESIGNATED_INITIALIZER;
- (instancetype)initShadow NS_DESIGNATED_INITIALIZER;
;
- (instancetype)initClip NS_DESIGNATED_INITIALIZER;
;
- (instancetype)initInnerShadowWithColor:(UIColor *)color
radius:(CGFloat)radius
opacity:(float)opacity NS_DESIGNATED_INITIALIZER;
;
@end

@ -31,13 +31,8 @@ typedef NS_ENUM(NSUInteger, OWSBubbleShapeViewMode) {
@implementation OWSBubbleShapeView
- (instancetype)init
- (void)configure
{
self = [super init];
if (!self) {
return self;
}
self.mode = OWSBubbleShapeViewMode_Draw;
self.opaque = NO;
self.backgroundColor = [UIColor clearColor];
@ -47,36 +42,67 @@ typedef NS_ENUM(NSUInteger, OWSBubbleShapeViewMode) {
[self.layer addSublayer:self.shapeLayer];
self.maskLayer = [CAShapeLayer new];
return self;
}
+ (OWSBubbleShapeView *)bubbleDrawView
- (instancetype)initDraw
{
OWSBubbleShapeView *instance = [OWSBubbleShapeView new];
instance.mode = OWSBubbleShapeViewMode_Draw;
return instance;
self = [super init];
if (!self) {
return self;
}
self.mode = OWSBubbleShapeViewMode_Draw;
[self configure];
return self;
}
+ (OWSBubbleShapeView *)bubbleShadowView
- (instancetype)initShadow
{
OWSBubbleShapeView *instance = [OWSBubbleShapeView new];
instance.mode = OWSBubbleShapeViewMode_Shadow;
return instance;
self = [super init];
if (!self) {
return self;
}
self.mode = OWSBubbleShapeViewMode_Shadow;
[self configure];
return self;
}
+ (OWSBubbleShapeView *)bubbleClipView
- (instancetype)initClip
{
OWSBubbleShapeView *instance = [OWSBubbleShapeView new];
instance.mode = OWSBubbleShapeViewMode_Clip;
return instance;
self = [super init];
if (!self) {
return self;
}
self.mode = OWSBubbleShapeViewMode_Clip;
[self configure];
return self;
}
+ (OWSBubbleShapeView *)bubbleInnerShadowView
- (instancetype)initInnerShadowWithColor:(UIColor *)color radius:(CGFloat)radius opacity:(float)opacity
{
OWSBubbleShapeView *instance = [OWSBubbleShapeView new];
instance.mode = OWSBubbleShapeViewMode_InnerShadow;
return instance;
self = [super init];
if (!self) {
return self;
}
self.mode = OWSBubbleShapeViewMode_InnerShadow;
_innerShadowColor = color;
_innerShadowRadius = radius;
_innerShadowOpacity = opacity;
[self configure];
[self updateLayers];
return self;
}
- (void)setFillColor:(nullable UIColor *)fillColor

@ -352,11 +352,11 @@ const UIDataDetectorTypes kOWSAllowedDataDetectorTypes
if (self.hasBodyMediaWithThumbnail) {
[self.stackView addArrangedSubview:bodyMediaView];
OWSBubbleShapeView *innerShadowView = [OWSBubbleShapeView bubbleInnerShadowView];
innerShadowView.innerShadowColor
= (Theme.isDarkThemeEnabled ? UIColor.ows_whiteColor : UIColor.ows_blackColor);
innerShadowView.innerShadowRadius = 0.5f;
innerShadowView.innerShadowOpacity = 0.15f;
OWSBubbleShapeView *innerShadowView = [[OWSBubbleShapeView alloc]
initInnerShadowWithColor:(Theme.isDarkThemeEnabled ? UIColor.ows_whiteColor
: UIColor.ows_blackColor)
radius:0.5f
opacity:0.15f];
[bodyMediaView addSubview:innerShadowView];
[self.bubbleView addPartnerView:innerShadowView];
[self.viewConstraints addObjectsFromArray:[innerShadowView ows_autoPinToSuperviewEdges]];
@ -497,8 +497,8 @@ const UIDataDetectorTypes kOWSAllowedDataDetectorTypes
UIView *proxyView = [UIView new];
[self.stackView addArrangedSubview:proxyView];
OWSBubbleShapeView *shadowView = [OWSBubbleShapeView bubbleShadowView];
OWSBubbleShapeView *clipView = [OWSBubbleShapeView bubbleClipView];
OWSBubbleShapeView *shadowView = [[OWSBubbleShapeView alloc] initShadow];
OWSBubbleShapeView *clipView = [[OWSBubbleShapeView alloc] initClip];
[self addSubview:shadowView];
[self addSubview:clipView];

Loading…
Cancel
Save