diff --git a/Classes/LinphoneUI/UIChatBubblePhotoCell.m b/Classes/LinphoneUI/UIChatBubblePhotoCell.m
index 831277919..a8b53e714 100644
--- a/Classes/LinphoneUI/UIChatBubblePhotoCell.m
+++ b/Classes/LinphoneUI/UIChatBubblePhotoCell.m
@@ -136,6 +136,14 @@
_messageImageView.hidden = _cancelButton.hidden = (ftd.message == nil);
_downloadButton.hidden = !_cancelButton.hidden;
_fileTransferProgress.hidden = NO;
+
+#if DEBUG
+ const LinphoneContent *c = linphone_chat_message_get_file_transfer_information(self.message);
+ if (c) {
+ const char *name = linphone_content_get_name(c);
+ [_downloadButton setTitle:[NSString stringWithUTF8String:name ?: "NULL"] forState:UIControlStateNormal];
+ }
+#endif
}
// resize image so that it take the full bubble space available
@@ -234,14 +242,12 @@
}
- (CGSize)viewSizeWithWidth:(int)width {
- static const CGFloat MARGIN_WIDTH = 60;
- static const CGFloat MARGIN_HEIGHT = 19 + 16 /*this 16 is because textview add some top&bottom padding*/;
static const CGFloat IMAGE_HEIGHT = 100.0f;
static const CGFloat IMAGE_WIDTH = 100.0f;
NSString *localImage = [LinphoneManager getMessageAppDataForKey:@"localimage" inMessage:self.message];
-
CGSize messageSize = (localImage != nil) ? CGSizeMake(IMAGE_WIDTH, IMAGE_HEIGHT) : CGSizeMake(50, 50);
+
CGSize dateSize = [self computeBoundingBox:self.contactDateLabel.text
size:self.contactDateLabel.frame.size
font:self.contactDateLabel.font];
diff --git a/Classes/LinphoneUI/UIChatBubblePhotoCell.xib b/Classes/LinphoneUI/UIChatBubblePhotoCell.xib
index 333dbe37c..567b1088d 100644
--- a/Classes/LinphoneUI/UIChatBubblePhotoCell.xib
+++ b/Classes/LinphoneUI/UIChatBubblePhotoCell.xib
@@ -59,7 +59,7 @@
-
+
@@ -157,6 +157,6 @@
-
+
diff --git a/Classes/LinphoneUI/UIChatBubbleTextCell.h b/Classes/LinphoneUI/UIChatBubbleTextCell.h
index 22c415c7e..dfeb87e88 100644
--- a/Classes/LinphoneUI/UIChatBubbleTextCell.h
+++ b/Classes/LinphoneUI/UIChatBubbleTextCell.h
@@ -23,6 +23,12 @@
#import "ChatConversationTableView.h"
#import "UIRoundedImageView.h"
+static const CGFloat TEXT_MIN_HEIGHT = 0.;
+static const CGFloat TEXT_MIN_WIDTH = 150.0f;
+static const CGFloat MARGIN_WIDTH = 60;
+static const CGFloat MARGIN_HEIGHT = 19 + 16 /*this 16 is because textview add some top&bottom padding*/;
+static const CGFloat CHECK_BOX_WIDTH = 40;
+
@interface UIChatBubbleTextCell : UITableViewCell
@property(readonly, nonatomic) LinphoneChatMessage *message;
diff --git a/Classes/LinphoneUI/UIChatBubbleTextCell.m b/Classes/LinphoneUI/UIChatBubbleTextCell.m
index d19f3e76b..7e126ea57 100644
--- a/Classes/LinphoneUI/UIChatBubbleTextCell.m
+++ b/Classes/LinphoneUI/UIChatBubbleTextCell.m
@@ -205,6 +205,9 @@ static void message_status(LinphoneChatMessage *msg, LinphoneChatMessageState st
#pragma mark - Bubble size computing
- (CGSize)computeBoundingBox:(NSString *)text size:(CGSize)size font:(UIFont *)font {
+ if (!text || text.length == 0)
+ return CGSizeMake(0, 0);
+
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
if ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 7) {
return [text boundingRectWithSize:size
@@ -220,28 +223,15 @@ static void message_status(LinphoneChatMessage *msg, LinphoneChatMessageState st
}
- (CGSize)viewSizeWithWidth:(int)width {
- static const CGFloat TEXT_MIN_HEIGHT = 0.;
- static const CGFloat TEXT_MIN_WIDTH = 150.0f;
- static const CGFloat MARGIN_WIDTH = 60;
- static const CGFloat MARGIN_HEIGHT = 19 + 16 /*this 16 is because textview add some top&bottom padding*/;
- static const CGFloat IMAGE_HEIGHT = 100.0f;
- static const CGFloat IMAGE_WIDTH = 100.0f;
- static const CGFloat CHECK_BOX_WIDTH = 40;
-
int messageAvailableWidth = width - MARGIN_WIDTH - CHECK_BOX_WIDTH;
- const char *url = linphone_chat_message_get_external_body_url(_message);
NSString *text = [UIChatBubbleTextCell TextMessageForChat:_message];
- CGSize messageSize;
- if (url != nil || linphone_chat_message_get_file_transfer_information(_message) != NULL) {
- messageSize = CGSizeMake(IMAGE_WIDTH, IMAGE_HEIGHT);
- } else {
- messageSize =
- [self computeBoundingBox:text size:CGSizeMake(messageAvailableWidth, CGFLOAT_MAX) font:_messageText.font];
- messageSize.width = MAX(TEXT_MIN_WIDTH, ceil(messageSize.width));
- messageSize.height = MAX(TEXT_MIN_HEIGHT, ceil(messageSize.height));
- }
+ CGSize messageSize =
+ [self computeBoundingBox:text size:CGSizeMake(messageAvailableWidth, CGFLOAT_MAX) font:_messageText.font];
+ messageSize.width = MAX(TEXT_MIN_WIDTH, ceil(messageSize.width));
+ messageSize.height = MAX(TEXT_MIN_HEIGHT, ceil(messageSize.height));
+
CGSize dateSize =
[self computeBoundingBox:_contactDateLabel.text size:_contactDateLabel.frame.size font:_contactDateLabel.font];