Skip to content

Commit b4077be

Browse files
committed
Update ChatSDKUI
1 parent e90dd89 commit b4077be

File tree

5 files changed

+26
-15
lines changed

5 files changed

+26
-15
lines changed

ChatSDKUI/Classes/Components/Message Cells/BMessageCell.m

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,17 @@ -(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSStr
4646

4747
[self.contentView addSubview:_profilePicture];
4848

49-
_timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(bTimeLabelPadding, 0, 0, 0)];
49+
_timeLabel = [[UILabel alloc] initWithFrame:CGRectZero];
5050

5151
_timeLabel.font = [UIFont italicSystemFontOfSize:12];
5252
if([BChatSDK config].messageTimeFont) {
5353
_timeLabel.font = [BChatSDK config].messageTimeFont;
5454
}
5555

56-
_timeLabel.textColor = [UIColor lightGrayColor];
56+
_timeLabel.textColor = [UIColor grayColor];
5757
_timeLabel.userInteractionEnabled = NO;
5858

59-
[self.contentView addSubview:_timeLabel];
59+
[bubbleImageView addSubview:_timeLabel];
6060

6161
_nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(bTimeLabelPadding, 0, 0, 0)];
6262
_nameLabel.userInteractionEnabled = NO;
@@ -252,13 +252,11 @@ -(void) layoutSubviews {
252252
// TODO: Fix this
253253
float xMargin = _profilePicture.image ? 0 : 0;
254254

255-
// Layout the date label this will be the full size of the cell
256-
// This will automatically center the text in the y direction
257-
// we'll set the side using text alignment
258-
[_timeLabel setViewFrameWidth:self.fw - bTimeLabelPadding * 2.0];
255+
[_timeLabel setViewFrameWidth:l.bubbleWidth - l.bubblePadding * 2.0];
256+
[_timeLabel.keepBottomInset setEqual:l.bubblePadding - 4];
259257

260258
// We don't want the label getting in the way of the read receipt
261-
[_timeLabel setViewFrameHeight:l.cellHeight * 0.8];
259+
[_timeLabel setViewFrameHeight:bTimeLabelHeight];
262260

263261
[_readMessageImageView setViewFrameWidth:bReadReceiptWidth];
264262
[_readMessageImageView setViewFrameHeight:bReadReceiptHeight];
@@ -273,18 +271,20 @@ -(void) layoutSubviews {
273271
if (!isMine) {
274272
[_profilePicture setViewFrameX:_profilePicture.hidden ? 0 : l.profilePicturePadding];
275273
[bubbleImageView setViewFrameX:l.bubbleMargin + _profilePicture.fx + _profilePicture.fw + xMargin];
276-
[_nameLabel setViewFrameX:bTimeLabelPadding];
274+
// [_nameLabel setViewFrameX:bTimeLabelPadding];
275+
[_timeLabel.keepRightInset setEqual:l.bubblePadding];
277276

278-
_timeLabel.textAlignment = NSTextAlignmentRight;
279-
_nameLabel.textAlignment = NSTextAlignmentLeft;
277+
_timeLabel.textAlignment = NSTextAlignmentLeft;
278+
// _nameLabel.textAlignment = NSTextAlignmentLeft;
280279
}
281280
else {
282281
[_profilePicture setViewFrameX:_profilePicture.hidden ? self.contentView.fw : self.contentView.fw - _profilePicture.fw - l.profilePicturePadding];
283282
[bubbleImageView setViewFrameX:_profilePicture.fx - l.bubbleWidth - l.bubbleMargin - xMargin];
284283
//[_nameLabel setViewFrameX: bTimeLabelPadding];
284+
[_timeLabel.keepRightInset setEqual:l.bubblePadding + bTailSize];
285285

286-
_timeLabel.textAlignment = NSTextAlignmentLeft;
287-
_nameLabel.textAlignment = NSTextAlignmentRight;
286+
_timeLabel.textAlignment = NSTextAlignmentRight;
287+
// _nameLabel.textAlignment = NSTextAlignmentRight;
288288

289289
// // We need to make sure the time label isn't in the way if there is a users name
290290
// if (self.fh < 50) {

ChatSDKUI/Classes/Components/Message Cells/BMessageLayout.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#import <ChatSDK/PMessageLayout.h>
1212

1313
#define bTimeLabelPadding 10
14+
#define bTimeLabelHeight 12
15+
#define bTimeLabelWidth 30
1416
#define bMaxMessageWidth 200
1517
#define bMaxMessageHeight 300
1618
#define bMinMessageHeight 50

ChatSDKUI/Classes/Components/Message Cells/BMessageLayout.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ -(float) messageWidth {
5555
switch ((bMessageType)_message.type.intValue) {
5656
case bMessageTypeText:
5757
case bMessageTypeSystem:
58-
return MIN([self textWidth:_message.textString], bMaxMessageWidth);
58+
return MAX(MIN([self textWidth:_message.textString], bMaxMessageWidth), bTimeLabelWidth);
5959
case bMessageTypeImage:
6060
case bMessageTypeVideo:
6161
case bMessageTypeLocation:
@@ -83,7 +83,13 @@ -(float) textWidth: (NSString *) text {
8383
}
8484

8585
-(float) bubbleHeight {
86-
return self.messageHeight + /*[self cellMargin] + */self.bubblePadding * 2;
86+
// return self.messageHeight + bTimeLabelHeight + /*[self cellMargin] + */self.bubblePadding * 2;
87+
switch ((bMessageType)_message.type.intValue) {
88+
case bMessageTypeText:
89+
return self.messageHeight + bTimeLabelHeight + self.bubblePadding * 2;
90+
default:
91+
return self.messageHeight + self.bubblePadding * 2;
92+
}
8793
}
8894

8995
-(float) cellHeight {

ChatSDKUI/Classes/Components/Threads/BPrivateThreadsViewController.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@
1313
@interface BPrivateThreadsViewController : BThreadsViewController {
1414
}
1515

16+
-(void) createThread;
17+
1618
@end

ChatSDKUI/Classes/Components/Threads/BPublicThreadsViewController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616
}
1717

1818
-(instancetype) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil;
19+
-(void) createThread;
1920

2021
@end

0 commit comments

Comments
 (0)