Skip to content

Commit f903174

Browse files
Status colors can be disabled in branding plist
1 parent 8526213 commit f903174

File tree

5 files changed

+18
-3
lines changed

5 files changed

+18
-3
lines changed

ChatSecure/Classes/Utilities/OTRColors.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#import "OTRThreadOwner.h"
1212

13+
NS_ASSUME_NONNULL_BEGIN
1314
@interface OTRColors : NSObject
1415

1516
+(UIColor *)colorWithStatus:(OTRThreadStatus)status;
@@ -24,5 +25,5 @@
2425
+ (UIColor *)warnColor;
2526

2627
+ (UIColor *)defaultBlueColor;
27-
2828
@end
29+
NS_ASSUME_NONNULL_END

ChatSecure/Classes/Utilities/OTRColors.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,22 @@
77
//
88

99
#import "OTRColors.h"
10+
@import OTRAssets;
1011

1112
@implementation OTRColors
1213

1314
+(UIColor *)colorWithStatus:(OTRThreadStatus)status
1415
{
15-
UIColor *color = nil;
16+
if (!OTRBranding.showsColorForStatus) {
17+
return [UIColor clearColor];
18+
}
19+
UIColor *color = [UIColor clearColor];
1620
switch(status)
1721
{
1822
case OTRThreadStatusUnknown:
1923
case OTRThreadStatusOffline:
2024
//color = [UIColor colorWithRed: 0.763 green: 0.763 blue: 0.763 alpha: 1];
21-
return nil;
25+
return [UIColor clearColor];
2226
break;
2327
case OTRThreadStatusAway:
2428
color = [UIColor colorWithRed: 0.901 green: 0.527 blue: 0.23 alpha: 1];

OTRAssets/OTRBranding.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,8 @@ FOUNDATION_EXPORT NSString *const kOTRSettingKeyLanguage;
8383
/** If enabled, the server selection cell will be shown when creating new accounts. Otherwise it will be hidden in the 'advanced' section. */
8484
+ (BOOL) shouldShowServerCell;
8585

86+
/** If enabled, will show colors for status indicators. */
87+
@property (class, readonly) BOOL showsColorForStatus;
88+
8689
@end
8790
NS_ASSUME_NONNULL_END

OTRAssets/OTRBranding.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ + (BOOL) shouldShowServerCell {
144144
return result;
145145
}
146146

147+
+ (BOOL) showsColorForStatus {
148+
BOOL result = [[[self defaultPlist] objectForKey:@"ShowsColorForStatus"] boolValue];
149+
return result;
150+
}
151+
147152
+ (NSDictionary*) defaultPlist {
148153
// Normally this won't be nil, but they WILL be nil during tests.
149154
NSBundle *bundle = [OTRAssets resourcesBundle];

OTRResources/Branding.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,7 @@
3636
<true/>
3737
<key>ShouldShowServerCell</key>
3838
<true/>
39+
<key>ShowsColorForStatus</key>
40+
<true/>
3941
</dict>
4042
</plist>

0 commit comments

Comments
 (0)