Fix scrollBadge and markAsRead in chat conversation

This commit is contained in:
Benoit Martins 2022-11-21 16:52:15 +01:00 committed by QuentinArguillere
parent 54fb56d93c
commit 6cb4ea55f6
2 changed files with 8 additions and 0 deletions

View file

@ -380,6 +380,13 @@ static const int BASIC_EVENT_LIST=15;
[_chatRoomDelegate tableViewIsScrolling];
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (scrollView.contentOffset.y >= (scrollView.contentSize.height - scrollView.frame.size.height)) {
if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive)
[ChatConversationView markAsRead:_chatRoom];
}
}
static const CGFloat MESSAGE_SPACING_PERCENTAGE = 1.f;
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {

View file

@ -1451,6 +1451,7 @@ void on_chat_room_chat_message_received(LinphoneChatRoom *cr, const LinphoneEven
if (isDisplayingBottomOfTable) {
[view.tableController scrollToBottom:TRUE];
} else {
[[view.tableController scrollBadge] setHidden:FALSE];
int unread_msg = linphone_chat_room_get_unread_messages_count(cr);
[[view.tableController scrollBadge] setText:[NSString stringWithFormat:@"%d", unread_msg]];
}