Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add customization for time label's color #425

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ChatSDKCore/Classes/Defines/BCoreDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#define bDefaultMessageColorMe @"abcff4"
#define bDefaultMessageColorReply @"d7d4d3"
#define bDefaultMessageColorTime @"aaaaaa"

#define bDefaultProfileImage @"icn_100_anonymous.png"
#define bDefaultPublicGroupImage @"icn_100_anonymous_group.png"
Expand Down
3 changes: 3 additions & 0 deletions ChatSDKCore/Classes/Session/BConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ typedef enum {
@property (nonatomic, readwrite) UIFont * messageTimeFont;
@property (nonatomic, readwrite) UIFont * messageNameFont;

/// Set the custom color of the time label. If not set, it will use the default color of time label.
@property (nonatomic, readwrite) NSString * messageTimeColor;

@property (nonatomic, readwrite) UIFont * threadTitleFont;
@property (nonatomic, readwrite) UIFont * threadTimeFont;
@property (nonatomic, readwrite) UIFont * threadSubtitleFont;
Expand Down
1 change: 1 addition & 0 deletions ChatSDKCore/Classes/Session/BConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ @implementation BConfiguration

@synthesize messageColorMe;
@synthesize messageColorReply;
@synthesize messageTimeColor;
@synthesize rootPath;
@synthesize appBadgeEnabled;
@synthesize defaultUserNamePrefix;
Expand Down
6 changes: 5 additions & 1 deletion ChatSDKUI/Classes/Components/Message Cells/BMessageCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ -(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSStr
_timeLabel.font = BChatSDK.config.messageTimeFont;
}

_timeLabel.textColor = [UIColor lightGrayColor];
_timeLabel.textColor = [BCoreUtilities colorWithHexString:bDefaultMessageColorTime];
if(BChatSDK.config.messageTimeColor) {
_timeLabel.textColor = [BCoreUtilities colorWithHexString:BChatSDK.config.messageTimeColor];
}

_timeLabel.userInteractionEnabled = NO;

[self.contentView addSubview:_timeLabel];
Expand Down