Skip to content

Commit 71e2629

Browse files
committed
Refactor ring color update
1 parent 61f1379 commit 71e2629

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Authenticator/Source/OTPProgressRing.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class OTPProgressRing: UIView {
5353
private func configureSublayers() {
5454
layer.addSublayer(backgroundRingLayer)
5555
layer.addSublayer(foregroundRingLayer)
56-
updateRingColor(tintColor)
56+
updateWithRingColor(tintColor)
5757
}
5858

5959
// MARK: Layout
@@ -71,7 +71,12 @@ class OTPProgressRing: UIView {
7171

7272
override func tintColorDidChange() {
7373
super.tintColorDidChange()
74-
updateRingColor(tintColor)
74+
updateWithRingColor(tintColor)
75+
}
76+
77+
private func updateWithRingColor(_ ringColor: UIColor) {
78+
foregroundRingLayer.strokeColor = ringColor.cgColor
79+
backgroundRingLayer.strokeColor = ringColor.withAlphaComponent(0.2).cgColor
7580
}
7681

7782
func updateWithViewModel(_ viewModel: ProgressRingViewModel) {
@@ -84,11 +89,6 @@ class OTPProgressRing: UIView {
8489
animation.toValue = 1
8590
foregroundRingLayer.add(animation, forKey: path)
8691
}
87-
88-
private func updateRingColor(_ tintColor: UIColor) {
89-
foregroundRingLayer.strokeColor = tintColor.cgColor
90-
backgroundRingLayer.strokeColor = tintColor.withAlphaComponent(0.2).cgColor
91-
}
9292
}
9393

9494
private class RingLayer: CAShapeLayer {

0 commit comments

Comments
 (0)