mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 02:58:07 +00:00
factorize and improve how to go to a chat room
This commit is contained in:
parent
9201fe28da
commit
3e2eed4ee7
4 changed files with 13 additions and 18 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -110,6 +110,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;
|
||||
|
|
|
|||
|
|
@ -871,9 +871,8 @@ 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 {
|
||||
|
|
@ -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];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue