update app to match lib

This commit is contained in:
Benjamin Reis 2017-12-27 15:56:03 +01:00
parent 7eab68ae23
commit 3421e0e54c
6 changed files with 4 additions and 45 deletions

View file

@ -273,8 +273,7 @@ static UICompositeViewDescription *compositeDescription = nil;
}
// we must ref & unref message because in case of error, it will be destroy otherwise
linphone_chat_room_send_chat_message(_chatRoom, linphone_chat_message_ref(msg));
linphone_chat_message_unref(msg);
linphone_chat_room_send_chat_message(_chatRoom, msg);
if (linphone_core_lime_enabled(LC) == LinphoneLimeMandatory && !linphone_chat_room_lime_available(_chatRoom)) {
[LinphoneManager.instance alertLIME:_chatRoom];

View file

@ -40,12 +40,6 @@
return self;
}
- (void)dealloc {
if (data != nil) {
bctbx_list_free_with_data(data, chatTable_free_chatrooms);
}
}
#pragma mark - ViewController Functions
- (void)viewWillAppear:(BOOL)animated {
@ -98,26 +92,13 @@ static int sorted_history_comparison(LinphoneChatRoom *to_insert, LinphoneChatRo
LinphoneChatRoom *chat_room = iter->data;
LinphoneChatMessage *last_msg = linphone_chat_room_get_last_message_in_history(chat_room);
linphone_chat_room_set_user_data(chat_room, last_msg);
sorted = bctbx_list_insert_sorted(sorted, linphone_chat_room_ref(chat_room),
(bctbx_compare_func)sorted_history_comparison);
sorted = bctbx_list_insert_sorted(sorted, chat_room, (bctbx_compare_func)sorted_history_comparison);
iter = iter->next;
}
return sorted;
}
static void chatTable_free_chatrooms(void *data) {
LinphoneChatMessage *last_msg = linphone_chat_room_get_user_data(data);
if (last_msg) {
linphone_chat_message_unref(last_msg);
linphone_chat_room_set_user_data(data, NULL);
}
linphone_chat_room_unref(data);
}
- (void)loadData {
if (data != NULL) {
bctbx_list_free_with_data(data, chatTable_free_chatrooms);
}
data = [self sortChatRooms];
[super loadData];
@ -190,12 +171,6 @@ static void chatTable_free_chatrooms(void *data) {
[tableView beginUpdates];
LinphoneChatRoom *chatRoom = (LinphoneChatRoom *)bctbx_list_nth_data(data, (int)[indexPath row]);
LinphoneChatMessage *last_msg = linphone_chat_room_get_user_data(chatRoom);
if (last_msg) {
linphone_chat_message_unref(last_msg);
linphone_chat_room_set_user_data(chatRoom, NULL);
}
FileTransferDelegate *ftdToDelete = nil;
for (FileTransferDelegate *ftd in [LinphoneManager.instance fileTransferDelegates]) {
if (linphone_chat_message_get_chat_room(ftd.message) == chatRoom) {
@ -220,12 +195,6 @@ static void chatTable_free_chatrooms(void *data) {
- (void)removeSelectionUsing:(void (^)(NSIndexPath *))remover {
[super removeSelectionUsing:^(NSIndexPath *indexPath) {
LinphoneChatRoom *chatRoom = (LinphoneChatRoom *)bctbx_list_nth_data(data, (int)[indexPath row]);
LinphoneChatMessage *last_msg = linphone_chat_room_get_user_data(chatRoom);
if (last_msg) {
linphone_chat_message_unref(last_msg);
linphone_chat_room_set_user_data(chatRoom, NULL);
}
FileTransferDelegate *ftdToDelete = nil;
for (FileTransferDelegate *ftd in [LinphoneManager.instance fileTransferDelegates]) {
if (linphone_chat_message_get_chat_room(ftd.message) == chatRoom) {

View file

@ -1277,7 +1277,7 @@ static void linphone_iphone_message_received(LinphoneCore *lc, LinphoneChatRoom
static void linphone_iphone_message_received_unable_decrypt(LinphoneCore *lc, LinphoneChatRoom *room,
LinphoneChatMessage *message) {
NSString *msgId = [NSString stringWithUTF8String:linphone_chat_message_get_custom_header(message, "Call-ID")];
NSString *msgId = [NSString stringWithUTF8String:linphone_chat_message_get_message_id(message)];
int index = [(NSNumber *)[LinphoneManager.instance.pushDict objectForKey:msgId] intValue] - 1;
LOGI(@"Decrementing index of long running task for call id : %@ with index : %d", msgId, index);

View file

@ -84,16 +84,8 @@
return;
}
if (_message) {
CFBridgingRelease(linphone_chat_message_get_user_data(_message));
linphone_chat_message_set_user_data(_message, NULL);
linphone_chat_message_cbs_set_msg_state_changed(linphone_chat_message_get_callbacks(_message), NULL);
linphone_chat_message_unref(_message);
}
_message = amessage;
if (amessage) {
linphone_chat_message_ref(_message);
linphone_chat_message_set_user_data(_message, (void *)CFBridgingRetain(self));
LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(_message);
linphone_chat_message_cbs_set_msg_state_changed(cbs, message_status);

View file

@ -91,7 +91,6 @@
_chatLatestTimeLabel.text =
[LinphoneUtils timeToString:linphone_chat_message_get_time(last_msg) withFormat:LinphoneDateChatList];
_chatLatestTimeLabel.hidden = NO;
linphone_chat_message_unref(last_msg);
linphone_chat_room_set_user_data(chatRoom, NULL);
} else {
_chatContentLabel.text = nil;

@ -1 +1 @@
Subproject commit 41a4a345704322e3ab67a4c96a0b111e21d4d97a
Subproject commit 88e381ffb2430d5b42d26e2380467edada352079