Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit e5cac53

Browse files
BrianLitwinrnystrom
authored andcommitted
mergeButton background bug fix (#2078)
1 parent 6b42450 commit e5cac53

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

Classes/Issues/Merge/MergeButton.swift

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,20 +84,14 @@ final class MergeButton: UIView {
8484
func configure(title: String, enabled: Bool, loading: Bool) {
8585
isUserInteractionEnabled = enabled && !loading
8686

87-
switch (enabled, loading) {
88-
case (false, false):
89-
backgroundColor = Styles.Colors.Gray.light.color
90-
alpha = 0.3
91-
92-
case (false , true):
93-
backgroundColor = Styles.Colors.Gray.light.color.withAlphaComponent(0.2)
94-
alpha = 0.3
95-
96-
case (true, true):
97-
backgroundColor = Styles.Colors.Green.medium.color.withAlphaComponent(0.2)
98-
99-
case (true, false):
100-
guard gradientLayer.superlayer == nil else { break }
87+
backgroundColor = (enabled
88+
? (loading ? Styles.Colors.Green.medium.color : .clear)
89+
: Styles.Colors.Gray.light.color)
90+
.withAlphaComponent(loading ? 0.2 : 1)
91+
alpha = enabled ? 1 : 0.3
92+
93+
if enabled && !loading {
94+
guard gradientLayer.superlayer == nil else { return }
10195
gradientLayer.cornerRadius = layer.cornerRadius
10296
gradientLayer.colors = [
10397
UIColor.fromHex("34d058").cgColor,
@@ -108,6 +102,8 @@ final class MergeButton: UIView {
108102
[mergeLabel, optionIconView, optionBorder, activityView].forEach {
109103
bringSubview(toFront: $0)
110104
}
105+
} else {
106+
gradientLayer.removeFromSuperlayer()
111107
}
112108

113109
let titleColor = enabled ? .white : Styles.Colors.Gray.dark.color

0 commit comments

Comments
 (0)