diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSBubbleStrokeView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSBubbleStrokeView.m index 425bed494a..415de838b4 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSBubbleStrokeView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSBubbleStrokeView.m @@ -85,19 +85,21 @@ NS_ASSUME_NONNULL_BEGIN return; } + // Prevent the shape layer from animating changes. + [CATransaction begin]; + [CATransaction setDisableActions:YES]; + // Don't fill the shape layer; we just want a stroke around the border. self.shapeLayer.fillColor = [UIColor clearColor].CGColor; + [CATransaction commit]; + self.clipsToBounds = YES; if (!self.bubbleView) { return; } - self.shapeLayer.strokeColor = self.strokeColor.CGColor; - self.shapeLayer.lineWidth = self.strokeThickness; - self.shapeLayer.zPosition = 100.f; - UIBezierPath *bezierPath = [UIBezierPath new]; UIBezierPath *boundsBezierPath = [UIBezierPath bezierPathWithRect:self.bounds]; @@ -110,7 +112,16 @@ NS_ASSUME_NONNULL_BEGIN [bubbleBezierPath applyTransform:transform]; [bezierPath appendPath:bubbleBezierPath]; + // Prevent the shape layer from animating changes. + [CATransaction begin]; + [CATransaction setDisableActions:YES]; + + self.shapeLayer.strokeColor = self.strokeColor.CGColor; + self.shapeLayer.lineWidth = self.strokeThickness; + self.shapeLayer.zPosition = 100.f; self.shapeLayer.path = bezierPath.CGPath; + + [CATransaction commit]; } @end diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSBubbleView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSBubbleView.m index 6d428768a2..b14f604a30 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSBubbleView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSBubbleView.m @@ -130,7 +130,14 @@ const CGFloat kBubbleTextVInset = 10.f; if (!self.shapeLayer) { [self updateLayers]; } + + // Prevent the shape layer from animating changes. + [CATransaction begin]; + [CATransaction setDisableActions:YES]; + self.shapeLayer.fillColor = bubbleColor.CGColor; + + [CATransaction commit]; } - (void)updateLayers @@ -144,9 +151,15 @@ const CGFloat kBubbleTextVInset = 10.f; UIBezierPath *bezierPath = [self maskPath]; + // Prevent the shape layer from animating changes. + [CATransaction begin]; + [CATransaction setDisableActions:YES]; + self.shapeLayer.fillColor = self.bubbleColor.CGColor; self.shapeLayer.path = bezierPath.CGPath; self.maskLayer.path = bezierPath.CGPath; + + [CATransaction commit]; } - (UIBezierPath *)maskPath diff --git a/Signal/src/views/AudioProgressView.swift b/Signal/src/views/AudioProgressView.swift index a5052511f5..d897e5e984 100644 --- a/Signal/src/views/AudioProgressView.swift +++ b/Signal/src/views/AudioProgressView.swift @@ -73,6 +73,10 @@ import SignalServiceKit internal func updateContent() { SwiftAssertIsOnMainThread(#function) + // Prevent the shape layer from animating changes. + CATransaction.begin() + CATransaction.setDisableActions(true) + let horizontalBarPath = UIBezierPath() let horizontalBarHeightFraction = CGFloat(0.25) let horizontalBarHeight = bounds.size.height * horizontalBarHeightFraction @@ -89,5 +93,7 @@ import SignalServiceKit progressPath.append(UIBezierPath(roundedRect: progressBounds, cornerRadius: progressCornerRadius)) progressLayer.path = progressPath.cgPath progressLayer.fillColor = progressColor.cgColor + + CATransaction.commit() } } diff --git a/Signal/src/views/OWSBezierPathView.m b/Signal/src/views/OWSBezierPathView.m index 323b0ed5f4..119842eb77 100644 --- a/Signal/src/views/OWSBezierPathView.m +++ b/Signal/src/views/OWSBezierPathView.m @@ -84,12 +84,18 @@ NS_ASSUME_NONNULL_BEGIN [layer removeFromSuperlayer]; } + // Prevent the shape layer from animating changes. + [CATransaction begin]; + [CATransaction setDisableActions:YES]; + for (ConfigureShapeLayerBlock configureShapeLayerBlock in self.configureShapeLayerBlocks) { CAShapeLayer *shapeLayer = [CAShapeLayer new]; configureShapeLayerBlock(shapeLayer, self.bounds); [self.layer addSublayer:shapeLayer]; } + [CATransaction commit]; + [self setNeedsDisplay]; } diff --git a/Signal/src/views/OWSProgressView.m b/Signal/src/views/OWSProgressView.m index 554f2e4c16..f643856074 100644 --- a/Signal/src/views/OWSProgressView.m +++ b/Signal/src/views/OWSProgressView.m @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // #import "OWSProgressView.h" @@ -43,6 +43,10 @@ NS_ASSUME_NONNULL_BEGIN self.backgroundColor = [UIColor clearColor]; self.color = [UIColor whiteColor]; + // Prevent the shape layer from animating changes. + [CATransaction begin]; + [CATransaction setDisableActions:YES]; + self.borderLayer = [CAShapeLayer new]; self.borderLayer.fillColor = self.color.CGColor; [self.layer addSublayer:self.borderLayer]; @@ -51,6 +55,8 @@ NS_ASSUME_NONNULL_BEGIN self.progressLayer.fillColor = self.color.CGColor; [self.layer addSublayer:self.progressLayer]; + [CATransaction commit]; + [self setContentCompressionResistancePriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisVertical]; [self setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisVertical]; } @@ -79,6 +85,10 @@ NS_ASSUME_NONNULL_BEGIN - (void)update { + // Prevent the shape layer from animating changes. + [CATransaction begin]; + [CATransaction setDisableActions:YES]; + CGFloat kBorderThickness = self.bounds.size.height * 0.1f; CGFloat kOuterRadius = self.bounds.size.height * 0.25f; CGFloat kInnerRadius = kOuterRadius - kBorderThickness; @@ -107,6 +117,8 @@ NS_ASSUME_NONNULL_BEGIN self.progressLayer.path = progressPath.CGPath; self.progressLayer.fillColor = self.color.CGColor; + + [CATransaction commit]; } - (CGSize)sizeThatFits:(CGSize)size