From a3757adacdd1a99f36b0faf9db964a018ce15eca Mon Sep 17 00:00:00 2001 From: "Robinson, Blake" Date: Wed, 4 Sep 2019 11:25:23 -0400 Subject: [PATCH 1/2] Adds nil check on contentColor to account for future possibility of contentColor having a value in this situation, which would a different tintColor on the button. --- MVMCoreUI/TopAlert/MVMCoreUITopAlertMainView.m | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertMainView.m b/MVMCoreUI/TopAlert/MVMCoreUITopAlertMainView.m index eab759e8..b7e3a80a 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertMainView.m +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertMainView.m @@ -173,7 +173,16 @@ if (closeButton && !self.closeButton) { self.closeButton = [self addCloseButtonWithAnimationDelegate:animationDelegate]; - [self.closeButton setTintColor:[UIColor whiteColor]]; + //Based on the way the code is ordered now in lines 68-70, contentColor should + //still be nil when setupCloseButton is called, making a nil check superflous. + //Since this ordering could change, however, it would be best to handle a situation + //in which the contentColor is black, for example, and the closeButton + //would need to be black as well. + if (self.contentColor == nil) { + [self.closeButton setTintColor:[UIColor whiteColor]]; + } else { + [self.closeButton setTintColor:self.contentColor]; + } } else if (!closeButton && self.closeButton) { [self.closeButton removeFromSuperview]; self.closeButton = nil; From 5adce500533c509d03f0db7273f9b7cd0bd9a31b Mon Sep 17 00:00:00 2001 From: "Robinson, Blake" Date: Thu, 5 Sep 2019 10:28:50 -0400 Subject: [PATCH 2/2] Removed comment and used ternary operator based on code review --- MVMCoreUI/TopAlert/MVMCoreUITopAlertMainView.m | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertMainView.m b/MVMCoreUI/TopAlert/MVMCoreUITopAlertMainView.m index b7e3a80a..e51ffc83 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertMainView.m +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertMainView.m @@ -173,16 +173,7 @@ if (closeButton && !self.closeButton) { self.closeButton = [self addCloseButtonWithAnimationDelegate:animationDelegate]; - //Based on the way the code is ordered now in lines 68-70, contentColor should - //still be nil when setupCloseButton is called, making a nil check superflous. - //Since this ordering could change, however, it would be best to handle a situation - //in which the contentColor is black, for example, and the closeButton - //would need to be black as well. - if (self.contentColor == nil) { - [self.closeButton setTintColor:[UIColor whiteColor]]; - } else { - [self.closeButton setTintColor:self.contentColor]; - } + [self.closeButton setTintColor:self.contentColor ?:[UIColor whiteColor]]; } else if (!closeButton && self.closeButton) { [self.closeButton removeFromSuperview]; self.closeButton = nil;