diff --git a/Classes/ChatConversationTableView.m b/Classes/ChatConversationTableView.m index 03f181b68..b6b78a726 100644 --- a/Classes/ChatConversationTableView.m +++ b/Classes/ChatConversationTableView.m @@ -36,8 +36,6 @@ - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; self.tableView.accessibilityIdentifier = @"ChatRoom list"; - // this should not be needed, we should only load messages when setting the chat room - // [self reloadData]; } #pragma mark - diff --git a/Classes/ChatsListTableView.m b/Classes/ChatsListTableView.m index 028e52477..ddb4ed335 100644 --- a/Classes/ChatsListTableView.m +++ b/Classes/ChatsListTableView.m @@ -54,6 +54,15 @@ [self loadData]; } +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + // we cannot do that in viewWillAppear because we will change view while previous transition + // was not finished, leading to "[CALayer retain]: message sent to deallocated instance" error msg + if (IPAD && [self totalNumberOfItems] == 0) { + [PhoneMainView.instance changeCurrentView:ChatConversationCreateView.compositeViewDescription]; + } +} + #pragma mark - static int sorted_history_comparison(LinphoneChatRoom *to_insert, LinphoneChatRoom *elem) { @@ -115,9 +124,6 @@ static void chatTable_free_chatrooms(void *data) { if ([self totalNumberOfItems] > 0) { ChatConversationView *view = VIEW(ChatConversationView); [view setChatRoom:(LinphoneChatRoom *)ms_list_nth_data(data, 0)]; - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; - } else { - [PhoneMainView.instance changeCurrentView:ChatConversationCreateView.compositeViewDescription]; } } } diff --git a/Classes/ChatsListView.m b/Classes/ChatsListView.m index 3660a62e0..6fe1e2c28 100644 --- a/Classes/ChatsListView.m +++ b/Classes/ChatsListView.m @@ -59,7 +59,7 @@ static UICompositeViewDescription *compositeDescription = nil; sideMenu:SideMenuView.class fullscreen:false isLeftFragment:YES - fragmentWith:ChatConversationCreateView.class]; + fragmentWith:ChatConversationView.class]; } return compositeDescription; }