4.1 : new ChatConversationView

This commit is contained in:
Danmei Chen 2018-10-30 15:46:43 +01:00
parent 5e6cd81d5d
commit 416b271460
7 changed files with 181 additions and 114 deletions

View file

@ -93,6 +93,7 @@
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:pos inSection:0];
[self.tableView beginUpdates];
[self.tableView insertRowsAtIndexPaths:@[ indexPath ] withRowAnimation:UITableViewRowAnimationFade];
[self.tableView reloadData];
[self.tableView endUpdates];
}
@ -165,6 +166,51 @@
[self reloadData];
}
- (BOOL)isFirstIndexInTableView:(NSIndexPath *)indexPath chat:(LinphoneChatMessage *)chat {
if (indexPath.row == 0)
return TRUE;
LinphoneEventLog *previousEvent = nil;
NSInteger indexOfPreviousEvent = indexPath.row - 1;
while (!previousEvent && indexOfPreviousEvent > -1) {
LinphoneEventLog *tmp = [[eventList objectAtIndex:indexOfPreviousEvent] pointerValue];
if (linphone_event_log_get_type(tmp) == LinphoneEventLogTypeConferenceChatMessage) {
previousEvent = tmp;
}
--indexOfPreviousEvent;
}
if (previousEvent) {
LinphoneChatMessage *previousChat = linphone_event_log_get_chat_message(previousEvent);
if (!linphone_address_equal(linphone_chat_message_get_from_address(previousChat), linphone_chat_message_get_from_address(chat))) {
return TRUE;
}
}
return FALSE;
}
- (BOOL)isLastIndexInTableView:(NSIndexPath *)indexPath chat:(LinphoneChatMessage *)chat {
LinphoneEventLog *nextEvent = nil;
NSInteger indexOfNextEvent = indexPath.row + 1;
while (!nextEvent && indexOfNextEvent < [eventList count]) {
LinphoneEventLog *tmp = [[eventList objectAtIndex:indexOfNextEvent] pointerValue];
if (linphone_event_log_get_type(tmp) == LinphoneEventLogTypeConferenceChatMessage) {
nextEvent = tmp;
}
++indexOfNextEvent;
}
if (!nextEvent)
return TRUE;
LinphoneChatMessage *nextChat = linphone_event_log_get_chat_message(nextEvent);
if (!linphone_address_equal(linphone_chat_message_get_from_address(nextChat), linphone_chat_message_get_from_address(chat))) {
return TRUE;
}
return FALSE;
}
#pragma mark - UITableViewDataSource Functions
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
@ -190,8 +236,11 @@
cell = [[NSClassFromString(kCellId) alloc] initWithIdentifier:kCellId];
}
[cell setEvent:event];
if (chat)
[cell update];
if (chat) {
cell.isFirst = [self isFirstIndexInTableView:indexPath chat:chat];
cell.isLast = [self isLastIndexInTableView:indexPath chat:chat];
[cell update];
}
[cell setChatRoomDelegate:_chatRoomDelegate];
[super accessoryForCell:cell atPath:indexPath];
@ -216,7 +265,7 @@
[_chatRoomDelegate tableViewIsScrolling];
}
static const CGFloat MESSAGE_SPACING_PERCENTAGE = 0.f;
static const CGFloat MESSAGE_SPACING_PERCENTAGE = 1.f;
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
LinphoneEventLog *event = [[eventList objectAtIndex:indexPath.row] pointerValue];
@ -225,21 +274,11 @@ static const CGFloat MESSAGE_SPACING_PERCENTAGE = 0.f;
//If the message is followed by another one that is not from the same address, we add a little space under it
CGFloat height = 0;
LinphoneEventLog *nextEvent = nil;
NSInteger indexOfNextEvent = indexPath.row + 1;
while (!nextEvent && indexOfNextEvent < [eventList count]) {
LinphoneEventLog *tmp = [[eventList objectAtIndex:indexOfNextEvent] pointerValue];
if (linphone_event_log_get_type(tmp) == LinphoneEventLogTypeConferenceChatMessage) {
nextEvent = tmp;
}
++indexOfNextEvent;
}
if (nextEvent) {
LinphoneChatMessage *nextChat = linphone_event_log_get_chat_message(nextEvent);
if (!linphone_address_equal(linphone_chat_message_get_from_address(nextChat), linphone_chat_message_get_from_address(chat))) {
height += tableView.frame.size.height * MESSAGE_SPACING_PERCENTAGE / 100;
}
}
if ([self isLastIndexInTableView:indexPath chat:chat])
height += tableView.frame.size.height * MESSAGE_SPACING_PERCENTAGE / 100;
if (![self isFirstIndexInTableView:indexPath chat:chat])
height -= 20;
return [UIChatBubbleTextCell ViewHeightForMessage:chat withWidth:self.view.frame.size.width].height + height;
}
return [UIChatNotifiedEventCell height];

View file

@ -11,85 +11,54 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="UIChatBubbleTextCell">
<connections>
<outlet property="LIMEKO" destination="PqI-MR-8GC" id="tHK-Bp-80H"/>
<outlet property="avatarImage" destination="P1c-sD-eOv" id="h5P-hl-jbX"/>
<outlet property="avatarImage" destination="hBI-Xz-aEV" id="dta-af-tMe"/>
<outlet property="backgroundColorImage" destination="ZIO-Cb-28G" id="asA-a1-Rko"/>
<outlet property="bottomBarColor" destination="mlr-pl-B6T" id="4Lk-Vn-E8h"/>
<outlet property="bubbleView" destination="ucH-2r-rar" id="XWU-yi-1z8"/>
<outlet property="contactDateLabel" destination="GRe-ur-aSb" id="DQA-v4-IjX"/>
<outlet property="imdmIcon" destination="WlS-fU-Aut" id="bYC-jb-Amo"/>
<outlet property="imdmLabel" destination="yKD-pC-Nhu" id="ge9-Yl-qsr"/>
<outlet property="contactDateLabel" destination="OwE-p1-L0T" id="0lh-E9-7wp"/>
<outlet property="imdmIcon" destination="Nod-GX-0kg" id="Pa7-l6-pGh"/>
<outlet property="innerView" destination="vdk-RV-QRU" id="wQs-CR-Pm3"/>
<outlet property="messageText" destination="CYa-If-oB4" id="7xm-UF-1qB"/>
<outlet property="statusInProgressSpinner" destination="4Z8-PE-uPe" id="T9k-9x-DeB"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" misplaced="YES" id="ucH-2r-rar">
<rect key="frame" x="0.0" y="0.0" width="334" height="74"/>
<rect key="frame" x="0.0" y="0.0" width="189" height="64"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<subviews>
<imageView hidden="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" misplaced="YES" image="avatar.png" id="hBI-Xz-aEV" userLabel="avatarImage" customClass="UIRoundedImageView">
<rect key="frame" x="6" y="20" width="27" height="27"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" misplaced="YES" text="11:35 John Doe" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="OwE-p1-L0T" userLabel="contactDateLabel">
<rect key="frame" x="39" y="0.0" width="126" height="18"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Contact name"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" red="0.63529411764705879" green="0.63529411764705879" blue="0.63529411764705879" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<view clipsSubviews="YES" contentMode="scaleToFill" misplaced="YES" id="vdk-RV-QRU" userLabel="innerView">
<rect key="frame" x="6" y="9" width="322" height="56"/>
<rect key="frame" x="39" y="20" width="143" height="40"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" alpha="0.20000000000000001" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="color_A.png" id="ZIO-Cb-28G" userLabel="backgroundColorImage">
<rect key="frame" x="0.0" y="0.0" width="322" height="56"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES" flexibleMaxY="YES"/>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" image="avatar.png" id="P1c-sD-eOv" userLabel="avatarImage" customClass="UIRoundedImageView">
<rect key="frame" x="7" y="7" width="40" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Contact avatar">
<accessibilityTraits key="traits" image="YES" notEnabled="YES"/>
<bool key="isElement" value="YES"/>
</accessibility>
</imageView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="11:35 John Doe" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="GRe-ur-aSb" userLabel="contactDateLabel">
<rect key="frame" x="55" y="8" width="246" height="14"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Contact name"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.98766469955444336" green="0.27512490749359131" blue="0.029739789664745331" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" animating="YES" style="gray" id="4Z8-PE-uPe" userLabel="statusInprogressSpinner">
<rect key="frame" x="302" y="0.0" width="20" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
</activityIndicatorView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="color_A.png" id="mlr-pl-B6T" userLabel="bottomBarColor">
<rect key="frame" x="0.0" y="55" width="322" height="1"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<imageView userInteractionEnabled="NO" alpha="0.20000000000000001" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" image="color_A.png" id="ZIO-Cb-28G" userLabel="backgroundColorImage">
<rect key="frame" x="0.0" y="0.0" width="126" height="40"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" flexibleMaxY="YES"/>
</imageView>
<textView clipsSubviews="YES" contentMode="scaleToFill" misplaced="YES" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" editable="NO" text="Lore ipsum..." id="CYa-If-oB4" userLabel="messageText" customClass="UITextViewNoDefine">
<rect key="frame" x="50" y="15" width="279" height="49"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES" flexibleMaxY="YES"/>
<rect key="frame" x="0.0" y="0.0" width="126" height="40"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
<dataDetectorType key="dataDetectorTypes" link="YES"/>
</textView>
<imageView hidden="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" image="chat_unsecure.png" id="PqI-MR-8GC" userLabel="LIMEKO">
<rect key="frame" x="308" y="4" width="8" height="12"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Delivery failed"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="Read" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="yKD-pC-Nhu" userLabel="imdmLabel">
<rect key="frame" x="238" y="39" width="64" height="20"/>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" image="chat_read.png" id="Nod-GX-0kg" userLabel="imdmIcon">
<rect key="frame" x="133" y="30" width="10" height="10"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
<fontDescription key="fontDescription" name=".AppleSystemUIFont" family=".AppleSystemUIFont" pointSize="11"/>
<color key="textColor" red="1" green="0.36862745099999999" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" image="chat_read.png" id="WlS-fU-Aut" userLabel="imdmIcon">
<rect key="frame" x="306" y="41" width="13" height="13"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
<accessibility key="accessibilityConfiguration" label="Delivery failed">
<accessibilityTraits key="traits" button="YES" image="YES"/>
</accessibility>
</imageView>
</subviews>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="16" y="110"/>
@ -97,8 +66,7 @@
</objects>
<resources>
<image name="avatar.png" width="259" height="259"/>
<image name="chat_read.png" width="24" height="24"/>
<image name="chat_unsecure.png" width="18" height="27"/>
<image name="chat_read.png" width="25" height="25"/>
<image name="color_A.png" width="2" height="2"/>
</resources>
</document>

View file

@ -30,17 +30,20 @@
@property(nonatomic, weak) IBOutlet UIImageView *backgroundColorImage;
@property(nonatomic, weak) IBOutlet UIRoundedImageView *avatarImage;
@property(nonatomic, weak) IBOutlet UILabel *contactDateLabel;
@property(weak, nonatomic) IBOutlet UIActivityIndicatorView *statusInProgressSpinner;
//@property(weak, nonatomic) IBOutlet UIActivityIndicatorView *statusInProgressSpinner;
@property(nonatomic, weak) IBOutlet UITextViewNoDefine *messageText;
@property(weak, nonatomic) IBOutlet UIImageView *bottomBarColor;
//@property(weak, nonatomic) IBOutlet UIImageView *bottomBarColor;
@property(nonatomic, strong) id<ChatConversationDelegate> chatRoomDelegate;
@property(strong, nonatomic) IBOutlet UIView *bubbleView;
@property(strong, nonatomic) IBOutlet UITapGestureRecognizer *resendRecognizer;
@property(weak, nonatomic) IBOutlet UIImageView *LIMEKO;
//@property(weak, nonatomic) IBOutlet UIImageView *LIMEKO;
@property(weak, nonatomic) IBOutlet UIImageView *imdmIcon;
@property(weak, nonatomic) IBOutlet UILabel *imdmLabel;
//@property(weak, nonatomic) IBOutlet UILabel *imdmLabel;
@property (nonatomic, strong) UIDocumentPickerViewController *documentPicker;
@property (weak, nonatomic) IBOutlet UIView *innerView;
@property(nonatomic) Boolean isFirst;
@property(nonatomic) Boolean isLast;
+ (CGSize)ViewSizeForMessage:(LinphoneChatMessage *)chat withWidth:(int)width;
+ (CGSize)ViewHeightForMessageText:(LinphoneChatMessage *)chat withWidth:(int)width textForImdn:(NSString *)imdnText;

View file

@ -44,8 +44,8 @@
UITapGestureRecognizer *limeRecognizer =
[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onLime)];
limeRecognizer.numberOfTapsRequired = 1;
[_LIMEKO addGestureRecognizer:limeRecognizer];
_LIMEKO.userInteractionEnabled = YES;
//[_LIMEKO addGestureRecognizer:limeRecognizer];
//_LIMEKO.userInteractionEnabled = YES;
UITapGestureRecognizer *resendRecognizer =
[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onResend)];
resendRecognizer.numberOfTapsRequired = 1;
@ -54,8 +54,8 @@
UITapGestureRecognizer *resendRecognizer2 =
[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onResend)];
resendRecognizer2.numberOfTapsRequired = 1;
[_imdmLabel addGestureRecognizer:resendRecognizer2];
_imdmLabel.userInteractionEnabled = YES;
//[_imdmLabel addGestureRecognizer:resendRecognizer2];
//_imdmLabel.userInteractionEnabled = YES;
return self;
}
@ -126,7 +126,7 @@
return;
}
_statusInProgressSpinner.accessibilityLabel = @"Delivery in progress";
//_statusInProgressSpinner.accessibilityLabel = @"Delivery in progress";
if (_messageText && ![LinphoneManager getMessageAppDataForKey:@"localvideo" inMessage:_message]) {
LOGD(_messageText.text);
@ -145,27 +145,83 @@
LinphoneChatMessageState state = linphone_chat_message_get_state(_message);
BOOL outgoing = linphone_chat_message_is_outgoing(_message);
_contactDateLabel.hidden = !_isFirst;
if (outgoing) {
_contactDateLabel.text = [LinphoneUtils timeToString:linphone_chat_message_get_time(_message)
withFormat:LinphoneDateChatBubble];
_contactDateLabel.textAlignment = NSTextAlignmentRight;
_avatarImage.hidden = TRUE;
} else {
[_avatarImage setImage:[FastAddressBook imageForAddress:linphone_chat_message_get_from_address(_message)]
bordered:NO
withRoundedRadius:YES];
_contactDateLabel.text = [self.class ContactDateForChat:_message];
_contactDateLabel.textAlignment = NSTextAlignmentLeft;
_avatarImage.hidden = !_isFirst;
}
if (outgoing) {
_avatarImage.image = [LinphoneUtils selfAvatar];
} else {
[_avatarImage setImage:[FastAddressBook imageForAddress:linphone_chat_message_get_from_address(_message)]
bordered:NO
withRoundedRadius:YES];
}
_contactDateLabel.text = [self.class ContactDateForChat:_message];
_backgroundColorImage.image = _bottomBarColor.image =
_backgroundColorImage.image =
[UIImage imageNamed:(outgoing ? @"color_A.png" : @"color_D.png")];
_contactDateLabel.textColor = [UIColor colorWithPatternImage:_backgroundColorImage.image];
// set maskedCorners
if (@available(iOS 11.0, *)) {
_backgroundColorImage.layer.cornerRadius = 10;
if (outgoing) {
_backgroundColorImage.layer.maskedCorners = kCALayerMinXMaxYCorner | kCALayerMinXMinYCorner;
if (_isFirst)
_backgroundColorImage.layer.maskedCorners = _backgroundColorImage.layer.maskedCorners | kCALayerMaxXMinYCorner;
if (_isLast)
_backgroundColorImage.layer.maskedCorners = _backgroundColorImage.layer.maskedCorners | kCALayerMaxXMaxYCorner;
} else {
_backgroundColorImage.layer.maskedCorners = kCALayerMaxXMinYCorner | kCALayerMaxXMaxYCorner;
if (_isFirst)
_backgroundColorImage.layer.maskedCorners = _backgroundColorImage.layer.maskedCorners | kCALayerMinXMinYCorner;
if (_isLast)
_backgroundColorImage.layer.maskedCorners = _backgroundColorImage.layer.maskedCorners | kCALayerMinXMaxYCorner;
}
_backgroundColorImage.layer.masksToBounds = YES;
} else {
// TODO it doesn't work for ios < 11.0
UIRectCorner corner;
if (outgoing) {
corner = UIRectCornerTopLeft | UIRectCornerBottomLeft;
if (_isFirst)
corner = corner | UIRectCornerTopRight;
if (_isLast)
corner = corner | UIRectCornerBottomRight;
} else {
corner = UIRectCornerTopRight | UIRectCornerBottomRight;
if (_isFirst)
corner = corner | UIRectCornerTopLeft;
if (_isLast)
corner = corner | UIRectCornerBottomLeft;
}
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:_backgroundColorImage.frame byRoundingCorners:corner cornerRadii:CGSizeMake(10,10)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = _backgroundColorImage.frame;
maskLayer.path = maskPath.CGPath;
_backgroundColorImage.layer.mask = maskLayer;
}
// need space for dateLabel
CGRect frame = _innerView.frame;
frame.origin.y = _isFirst ? 20 : 0;
_innerView.frame = frame;
//_contactDateLabel.textColor = [UIColor colorWithPatternImage:_backgroundColorImage.image];
if (outgoing && state == LinphoneChatMessageStateInProgress) {
/*if (outgoing && state == LinphoneChatMessageStateInProgress) {
[_statusInProgressSpinner startAnimating];
} else if (!outgoing && state == LinphoneChatMessageStateFileTransferError) {
[_statusInProgressSpinner stopAnimating];
} else {
[_statusInProgressSpinner stopAnimating];
}
}*/
[_messageText setAccessibilityLabel:outgoing ? @"Outgoing message" : @"Incoming message"];
if (outgoing &&
@ -175,12 +231,12 @@
} else
[self displayImdmStatus:LinphoneChatMessageStateInProgress];
if (!outgoing && !linphone_chat_message_is_secured(_message) &&
/*if (!outgoing && !linphone_chat_message_is_secured(_message) &&
linphone_core_lime_enabled(LC) == LinphoneLimeMandatory) {
_LIMEKO.hidden = FALSE;
} else {
_LIMEKO.hidden = TRUE;
}
}*/
}
- (void)setEditing:(BOOL)editing {
@ -250,8 +306,8 @@
}
- (void)onLime {
if (!_LIMEKO.hidden)
[self displayLIMEWarning];
/*if (!_LIMEKO.hidden)
[self displayLIMEWarning];*/
}
- (void)onResend {
@ -349,25 +405,25 @@ static void message_status(LinphoneChatMessage *msg, LinphoneChatMessageState st
- (void)displayImdmStatus:(LinphoneChatMessageState)state {
if (state == LinphoneChatMessageStateDeliveredToUser) {
[_imdmIcon setImage:[UIImage imageNamed:@"chat_delivered"]];
[_imdmLabel setText:NSLocalizedString(@"Delivered", nil)];
[_imdmLabel setTextColor:[UIColor grayColor]];
//[_imdmLabel setText:NSLocalizedString(@"Delivered", nil)];
//[_imdmLabel setTextColor:[UIColor grayColor]];
[_imdmIcon setHidden:FALSE];
[_imdmLabel setHidden:FALSE];
//[_imdmLabel setHidden:FALSE];
} else if (state == LinphoneChatMessageStateDisplayed) {
[_imdmIcon setImage:[UIImage imageNamed:@"chat_read"]];
[_imdmLabel setText:NSLocalizedString(@"Read", nil)];
[_imdmLabel setTextColor:([UIColor colorWithRed:(24 / 255.0) green:(167 / 255.0) blue:(175 / 255.0) alpha:1.0])];
//[_imdmLabel setText:NSLocalizedString(@"Read", nil)];
//[_imdmLabel setTextColor:([UIColor colorWithRed:(24 / 255.0) green:(167 / 255.0) blue:(175 / 255.0) alpha:1.0])];
[_imdmIcon setHidden:FALSE];
[_imdmLabel setHidden:FALSE];
//[_imdmLabel setHidden:FALSE];
} else if (state == LinphoneChatMessageStateNotDelivered || state == LinphoneChatMessageStateFileTransferError) {
[_imdmIcon setImage:[UIImage imageNamed:@"chat_error"]];
[_imdmLabel setText:NSLocalizedString(@"Resend", nil)];
[_imdmLabel setTextColor:[UIColor redColor]];
//[_imdmLabel setText:NSLocalizedString(@"Resend", nil)];
//[_imdmLabel setTextColor:[UIColor redColor]];
[_imdmIcon setHidden:FALSE];
[_imdmLabel setHidden:FALSE];
//[_imdmLabel setHidden:FALSE];
} else {
[_imdmIcon setHidden:TRUE];
[_imdmLabel setHidden:TRUE];
//[_imdmLabel setHidden:TRUE];
}
}
@ -389,7 +445,7 @@ static void message_status(LinphoneChatMessage *msg, LinphoneChatMessageState st
static const CGFloat CELL_MIN_HEIGHT = 60.0f;
static const CGFloat CELL_MIN_WIDTH = 190.0f;
static const CGFloat CELL_MESSAGE_X_MARGIN = 78 + 10.0f;
static const CGFloat CELL_MESSAGE_Y_MARGIN = 52; // 44;
static const CGFloat CELL_MESSAGE_Y_MARGIN = 44; // 44;
+ (CGSize)ViewHeightForMessage:(LinphoneChatMessage *)chat withWidth:(int)width {
return [self ViewHeightForMessageText:chat withWidth:width textForImdn:nil];
@ -480,6 +536,7 @@ static const CGFloat CELL_MESSAGE_Y_MARGIN = 52; // 44;
CGSize messageSize = [self ViewHeightForMessage:chat withWidth:width];
CGSize dateSize = [self computeBoundingBox:[self ContactDateForChat:chat] size:dateViewSize font:dateFont];
messageSize.width = MAX(MAX(messageSize.width, MIN(dateSize.width + CELL_MESSAGE_X_MARGIN, width)), CELL_MIN_WIDTH);
messageSize.width = MAX(MAX(messageSize.width, MIN(CELL_MESSAGE_X_MARGIN, width)), CELL_MIN_WIDTH);
return messageSize;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 799 B

After

Width:  |  Height:  |  Size: 925 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 494 B

After

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 867 B

After

Width:  |  Height:  |  Size: 963 B