forked from mirrors/linphone-iphone
chat: improve notification text
This commit is contained in:
parent
d63ddbc7f0
commit
94e1d2212d
6 changed files with 24 additions and 41 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -13,3 +13,5 @@
|
|||
#import "UIToggleButton.h"
|
||||
#import "UISpeakerButton.h"
|
||||
#import "UIBluetoothButton.h"
|
||||
|
||||
#import "UIChatBubbleTextCell.h"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue