diff --git a/Classes/ChatConversationTableView.m b/Classes/ChatConversationTableView.m index b6b78a726..b494b8379 100644 --- a/Classes/ChatConversationTableView.m +++ b/Classes/ChatConversationTableView.m @@ -103,20 +103,6 @@ } } -- (void)debugMessages { - if (!messageList) { - LOGE(@"No data to debug"); - return; - } - MSList *item = messageList; - int count = 0; - while (item) { - LinphoneChatMessage *msg = (LinphoneChatMessage *)item->data; - LOGI(@"Message %d: %s", count++, linphone_chat_message_get_text(msg)); - item = item->next; - } -} - - (void)scrollToLastUnread:(BOOL)animated { if (messageList == nil || chatRoom == nil) { return; diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 4c29ad7b9..ea7343d3c 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -933,9 +933,6 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char NSString *from = [FastAddressBook displayNameForAddress:remoteAddress]; char *c_address = linphone_address_as_string_uri_only(remoteAddress); NSString *remote_uri = [NSString stringWithUTF8String:c_address]; - const char *chat = linphone_chat_message_get_text(msg); - if (chat == NULL) - chat = ""; ms_free(c_address); @@ -943,12 +940,13 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char // Create a new notification UILocalNotification *notif = [[UILocalNotification alloc] init]; if (notif) { + NSString *chat = [UIChatBubbleTextCell TextMessageForChat:msg]; notif.repeatInterval = 0; if ([[UIDevice currentDevice].systemVersion floatValue] >= 8) { notif.category = @"incoming_msg"; } if ([[LinphoneManager instance] lpConfigBoolForKey:@"show_msg_in_notif" withDefault:YES]) { - notif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"IM_FULLMSG", nil), from, @(chat)]; + notif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"IM_FULLMSG", nil), from, chat]; } else { notif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"IM_MSG", nil), from]; } @@ -1727,11 +1725,10 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { linphone_core_start_dtmf_stream(theLinphoneCore); /*start the video preview in case we are in the main view*/ - if (IPAD && linphone_core_video_display_enabled(theLinphoneCore) && - [self lpConfigBoolForKey:@"preview_preference"]) { + // if (linphone_core_video_display_enabled(theLinphoneCore) && [self lpConfigBoolForKey:@"preview_preference"]) { linphone_core_enable_video_preview(theLinphoneCore, TRUE); - } - /*check last keepalive handler date*/ + // } + /*check last keepalive handler date*/ if (mLastKeepAliveDate != Nil) { NSDate *current = [NSDate date]; if ([current timeIntervalSinceDate:mLastKeepAliveDate] > 700) { diff --git a/Classes/LinphoneUI/UIChatBubbleTextCell.m b/Classes/LinphoneUI/UIChatBubbleTextCell.m index 362c503d9..e65ddad83 100644 --- a/Classes/LinphoneUI/UIChatBubbleTextCell.m +++ b/Classes/LinphoneUI/UIChatBubbleTextCell.m @@ -70,9 +70,16 @@ } + (NSString *)TextMessageForChat:(LinphoneChatMessage *)message { - const char *text = linphone_chat_message_get_text(message) ?: ""; - return [NSString stringWithUTF8String:text] ?: [NSString stringWithCString:text encoding:NSASCIIStringEncoding] - ?: NSLocalizedString(@"(invalid string)", nil); + const char *url = linphone_chat_message_get_external_body_url(message); + const LinphoneContent *last_content = linphone_chat_message_get_file_transfer_information(message); + // Last message was a file transfer (image) so display a picture... + if (url || last_content) { + return @"🗻"; + } else { + const char *text = linphone_chat_message_get_text(message) ?: ""; + return [NSString stringWithUTF8String:text] ?: [NSString stringWithCString:text encoding:NSASCIIStringEncoding] + ?: NSLocalizedString(@"(invalid string)", nil); + } } + (NSString *)ContactDateForChat:(LinphoneChatMessage *)message { diff --git a/Classes/LinphoneUI/UIChatCell.m b/Classes/LinphoneUI/UIChatCell.m index 22caf1a17..770b28736 100644 --- a/Classes/LinphoneUI/UIChatCell.m +++ b/Classes/LinphoneUI/UIChatCell.m @@ -69,22 +69,12 @@ LinphoneChatMessage *last_message = linphone_chat_room_get_user_data(chatRoom); if (last_message) { - const char *text = linphone_chat_message_get_text(last_message); - const char *url = linphone_chat_message_get_external_body_url(last_message); - const LinphoneContent *last_content = linphone_chat_message_get_file_transfer_information(last_message); - // Last message was a file transfer (image) so display a picture... - if (url || last_content) { - _chatContentLabel.text = @"🗻"; - // otherwise show beginning of the text message - } else if (text) { - NSString *message = [NSString stringWithUTF8String:text]; - // shorten long messages - if ([message length] > 50) - message = [[message substringToIndex:50] stringByAppendingString:@"[...]"]; - - _chatContentLabel.text = message; + NSString *message = [UIChatBubbleTextCell TextMessageForChat:last_message]; + // shorten long messages + if ([message length] > 50) { + message = [[message substringToIndex:50] stringByAppendingString:@"[...]"]; } - + _chatContentLabel.text = message; _chatLatestTimeLabel.text = [LinphoneUtils timeToString:linphone_chat_message_get_time(last_message) withFormat:LinphoneDateChatList]; _chatLatestTimeLabel.hidden = NO; diff --git a/Classes/LinphoneUI/UIRoundedImageView.m b/Classes/LinphoneUI/UIRoundedImageView.m index 90847d109..aab2dfe69 100644 --- a/Classes/LinphoneUI/UIRoundedImageView.m +++ b/Classes/LinphoneUI/UIRoundedImageView.m @@ -51,7 +51,8 @@ INIT_WITH_COMMON_CF { } - (void)setBordered:(BOOL)bordered { - borderView.hidden = !bordered; + // bugged on rotation yet + borderView.hidden = TRUE; //! bordered; } - (CGRect)computeBox { CGFloat min = MIN(self.frame.size.width, self.frame.size.height); diff --git a/linphone_Prefix.pch b/linphone_Prefix.pch index c562b2c3a..eebc8998b 100644 --- a/linphone_Prefix.pch +++ b/linphone_Prefix.pch @@ -13,3 +13,5 @@ #import "UIToggleButton.h" #import "UISpeakerButton.h" #import "UIBluetoothButton.h" + +#import "UIChatBubbleTextCell.h"