Merge branch 'dev_group_chat' into dev_imdn_view

This commit is contained in:
Benjamin Reis 2018-04-30 10:00:45 +02:00
commit 53493a4e99
14 changed files with 33 additions and 32 deletions

View file

@ -163,6 +163,7 @@ static UICompositeViewDescription *compositeDescription = nil;
linphone_chat_room_cbs_set_chat_message_received(_chatRoomCbs, on_chat_room_chat_message_received);
linphone_chat_room_cbs_set_chat_message_sent(_chatRoomCbs, on_chat_room_chat_message_sent);
linphone_chat_room_cbs_set_is_composing_received(_chatRoomCbs, on_chat_room_is_composing_received);
linphone_chat_room_cbs_set_all_information_received(_chatRoomCbs, on_chat_room_all_information_received);
linphone_chat_room_cbs_set_user_data(_chatRoomCbs, (__bridge void*)self);
linphone_chat_room_add_callbacks(_chatRoom, _chatRoomCbs);
}
@ -777,4 +778,9 @@ void on_chat_room_is_composing_received(LinphoneChatRoom *cr, const LinphoneAddr
[view setComposingVisible:composing withDelay:0.3];
}
void on_chat_room_all_information_received(LinphoneChatRoom *cr) {
ChatConversationView *view = (__bridge ChatConversationView *)linphone_chat_room_cbs_get_user_data(linphone_chat_room_get_current_callbacks(cr));
[view configureForRoom:false];
}
@end

View file

@ -162,24 +162,13 @@ static int sorted_history_comparison(LinphoneChatRoom *to_insert, LinphoneChatRo
return;
LinphoneChatRoom *chatRoom = (LinphoneChatRoom *)bctbx_list_nth_data(_data, (int)[indexPath row]);
ChatConversationView *view = VIEW(ChatConversationView);
LinphoneChatRoom *oldRoom = view.chatRoom;
if (oldRoom) {
LinphoneChatRoomCbs *oldCbs = linphone_chat_room_get_current_callbacks(oldRoom);
if (oldCbs && view.chatRoomCbs && oldCbs == view.chatRoomCbs) {
linphone_chat_room_remove_callbacks(oldRoom, view.chatRoomCbs);
view.chatRoomCbs = NULL;
}
}
[PhoneMainView.instance goToChatRoom:chatRoom];
view.chatRoom = chatRoom;
// on iPad, force unread bubble to disappear by reloading the cell
if (IPAD) {
UIChatCell *cell = (UIChatCell *)[tableView cellForRowAtIndexPath:indexPath];
[cell updateUnreadBadge];
[view configureForRoom:false];
}
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
}
void deletion_chat_room_state_changed(LinphoneChatRoom *cr, LinphoneChatRoomState newState) {

View file

@ -667,9 +667,7 @@ didInvalidatePushTokenForType:(NSString *)type {
LinphoneAddress *local = linphone_address_new(local_address.UTF8String);
LinphoneChatRoom *room = linphone_core_find_chat_room(LC, peer, local);
if (room) {
ChatConversationView *view = VIEW(ChatConversationView);
view.chatRoom = room;
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
[PhoneMainView.instance goToChatRoom:room];
return;
}
[PhoneMainView.instance changeCurrentView:ChatsListView.compositeViewDescription];

View file

@ -137,7 +137,7 @@
(linphone_content_get_buffer(content) == NULL)) {
return;
}
uint8_t *bodyTmp = linphone_content_get_buffer(content);
const uint8_t *bodyTmp = linphone_content_get_buffer(content);
const char *body = (const char *)bodyTmp;
if ((body = strstr(body, "voice-message: ")) == NULL) {
LOGW(@"Received new NOTIFY from voice mail but could not find 'voice-message' in BODY. Ignoring it.");

View file

@ -111,6 +111,7 @@
- (void)updateApplicationBadgeNumber;
- (void)getOrCreateOneToOneChatRoom:(const LinphoneAddress *)remoteAddress waitView:(UIView *)waitView;
- (void)createChatRoomWithSubject:(const char *)subject addresses:(bctbx_list_t *)addresses andWaitView:(UIView *)waitView;
- (void)goToChatRoom:(LinphoneChatRoom *)cr;
+ (PhoneMainView*) instance;
- (BOOL)isIphoneXDevice;

View file

@ -871,14 +871,13 @@ static RootViewManager *rootViewManagerInstance = nil;
bctbx_list_free(addresses);
return;
}
ChatConversationView *view = VIEW(ChatConversationView);
view.chatRoom = room;
[self changeCurrentView:view.compositeViewDescription];
[self goToChatRoom:room];
}
- (void)createChatRoomWithSubject:(const char *)subject addresses:(bctbx_list_t *)addresses andWaitView:(UIView *)waitView {
if (!linphone_proxy_config_get_conference_factory_uri(linphone_core_get_default_proxy_config(LC))
|| ([[LinphoneManager instance] lpConfigBoolForKey:@"prefer_basic_chat_room" withDefault:FALSE] && bctbx_list_size(addresses) == 1)) {
|| ([[LinphoneManager instance] lpConfigBoolForKey:@"prefer_basic_chat_room" inSection:@"misc"] && bctbx_list_size(addresses) == 1)) {
// If there's no factory uri, create a basic chat room
if (bctbx_list_size(addresses) != 1) {
// Display Error: unsuported group chat
@ -918,7 +917,15 @@ static RootViewManager *rootViewManagerInstance = nil;
_waitView.hidden = YES;
_waitView = NULL;
ChatConversationView *view = VIEW(ChatConversationView);
if (view.chatRoom && view.chatRoomCbs)
linphone_chat_room_remove_callbacks(view.chatRoom, view.chatRoomCbs);
if (PhoneMainView.instance.currentView == view.compositeViewDescription)
[PhoneMainView.instance popCurrentView];
view.chatRoomCbs = NULL;
view.chatRoom = cr;
self.currentRoom = view.chatRoom;
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
}

View file

@ -38,12 +38,12 @@ static void linphone_iphone_file_transfer_recv(LinphoneChatMessage *message, con
size_t size = linphone_buffer_get_size(buffer);
if (!thiz.data) {
thiz.data = [[NSMutableData alloc] initWithCapacity:linphone_content_get_size(content)];
thiz.data = [[NSMutableData alloc] initWithCapacity:linphone_content_get_file_size(content)];
}
if (size == 0) {
LOGI(@"Transfer of %s (%d bytes): download finished", linphone_content_get_name(content), size);
assert([thiz.data length] == linphone_content_get_size(content));
assert([thiz.data length] == linphone_content_get_file_size(content));
// we're finished, save the image and update the message
UIImage *image = [UIImage imageWithData:thiz.data];
@ -63,6 +63,7 @@ static void linphone_iphone_file_transfer_recv(LinphoneChatMessage *message, con
[errView addAction:defaultAction];
[PhoneMainView.instance presentViewController:errView animated:YES completion:nil];
[thiz stopAndDestroy];
return;
}
@ -97,7 +98,6 @@ static void linphone_iphone_file_transfer_recv(LinphoneChatMessage *message, con
forKey:@"localimage"
inMessage:message];
}
thiz.message = NULL;
[NSNotificationCenter.defaultCenter
postNotificationName:kLinphoneFileTransferRecvUpdate
object:thiz
@ -114,14 +114,14 @@ static void linphone_iphone_file_transfer_recv(LinphoneChatMessage *message, con
}];
} else {
LOGD(@"Transfer of %s (%d bytes): already %ld sent, adding %ld", linphone_content_get_name(content),
linphone_content_get_size(content), [thiz.data length], size);
linphone_content_get_file_size(content), [thiz.data length], size);
[thiz.data appendBytes:linphone_buffer_get_string_content(buffer) length:size];
[NSNotificationCenter.defaultCenter
postNotificationName:kLinphoneFileTransferRecvUpdate
object:thiz
userInfo:@{
@"state" : @(linphone_chat_message_get_state(message)),
@"progress" : @([thiz.data length] * 1.f / linphone_content_get_size(content)),
@"progress" : @([thiz.data length] * 1.f / linphone_content_get_file_size(content)),
}];
}
}

View file

@ -24,7 +24,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.99.3</string>
<string>3.99.4</string>
<key>CFBundleURLTypes</key>
<array>
<dict>

@ -1 +1 @@
Subproject commit e34db6796ade971615d4b572bda87d9f699ea497
Subproject commit 7df8b5ca085010ec35103414ed9582412aaff97d

@ -1 +1 @@
Subproject commit b9e1951be4575c62e326d761a7f7c79c5cce9cb9
Subproject commit 7376c8ba975617c8b2a7232c3acc428513a4ae8f

@ -1 +1 @@
Subproject commit 2d4085354443598d59d43168e16e47e4d34e0ca3
Subproject commit cbb4ab4c2a58e4fa1954043f6b17266e1685c887

@ -1 +1 @@
Subproject commit 45bbb54eda3d9c9abf9d9029f44ee17e926ed706
Subproject commit 0041defd0085c928e6e9dd659f1eae015254cb04

@ -1 +1 @@
Subproject commit f49b3d5ea3ab56b4b021a760a58f44015b3c5765
Subproject commit ad4cdb240e553654f87438fb4519754e90d1773d

@ -1 +1 @@
Subproject commit 8fff73b5b56f1cbf6fcca10068cc0f401d024420
Subproject commit 1fcd6fd1558f26255ae9dac687191ddf988bfd5b