diff --git a/ChatSDKCore/Classes/Session/BConfiguration.h b/ChatSDKCore/Classes/Session/BConfiguration.h index 53d399ac..0d2f9451 100755 --- a/ChatSDKCore/Classes/Session/BConfiguration.h +++ b/ChatSDKCore/Classes/Session/BConfiguration.h @@ -127,6 +127,8 @@ typedef enum { @property(nonatomic, readwrite) NSString * messageBubbleMaskLast; @property(nonatomic, readwrite) NSString * messageBubbleMaskSingle; +/// Hide the name label for each message bubble. +@property(nonatomic, readwrite) BOOL hideNameLabel; @property(nonatomic, readwrite) bNameLabelPosition nameLabelPosition; @property(nonatomic, readwrite) BOOL combineTimeWithNameLabel; diff --git a/ChatSDKCore/Classes/Session/BConfiguration.m b/ChatSDKCore/Classes/Session/BConfiguration.m index 939a5922..f62dfd99 100755 --- a/ChatSDKCore/Classes/Session/BConfiguration.m +++ b/ChatSDKCore/Classes/Session/BConfiguration.m @@ -63,6 +63,7 @@ @implementation BConfiguration @synthesize messageBubbleMaskMiddle; @synthesize messageBubbleMaskLast; @synthesize messageBubbleMaskSingle; +@synthesize hideNameLabel; @synthesize nameLabelPosition; @synthesize combineTimeWithNameLabel; diff --git a/ChatSDKUI/Classes/Components/Message Cells/BMessageCell.m b/ChatSDKUI/Classes/Components/Message Cells/BMessageCell.m index 96b7aa76..cfc1ee21 100755 --- a/ChatSDKUI/Classes/Components/Message Cells/BMessageCell.m +++ b/ChatSDKUI/Classes/Components/Message Cells/BMessageCell.m @@ -61,7 +61,7 @@ -(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSStr _timeLabel.userInteractionEnabled = NO; [self.contentView addSubview:_timeLabel]; - + _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(bTimeLabelPadding, 0, 0, 0)]; _nameLabel.userInteractionEnabled = NO; @@ -70,7 +70,7 @@ -(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSStr _nameLabel.font = BChatSDK.config.messageNameFont; } [self.contentView addSubview:_nameLabel]; - + _readMessageImageView = [[UIImageView alloc] initWithFrame:CGRectMake(bTimeLabelPadding, 0, 0, 0)]; [self setReadStatus:bMessageReadStatusNone]; [self.contentView addSubview:_readMessageImageView]; @@ -213,12 +213,15 @@ -(void) setMessage: (id) message isSelected: (BOOL) selected { _nameLabel.text = _message.userModel.name; -// // // We only want to show the name label if the previous message was posted by someone else and if this is enabled in the thread // // Or if the message is mine... _nameLabel.hidden = ![BMessageCell showUserNameLabelForMessage:message atPosition:@(position)]; + if(BChatSDK.config.hideNameLabel) { + _nameLabel.hidden = BChatSDK.config.hideNameLabel; + } + // Hide the read receipt view if this is a public thread or if read receipts are disabled _readMessageImageView.hidden = _message.thread.type.intValue & bThreadFilterPublic || !BChatSDK.readReceipt;