mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-23 14:18:07 +00:00
Fix unread chat message count.
This commit is contained in:
parent
babbd33142
commit
15b38e3a8b
3 changed files with 13 additions and 1 deletions
|
|
@ -416,7 +416,11 @@ int ChatRoom::getChatMessageCount () const {
|
|||
}
|
||||
|
||||
int ChatRoom::getUnreadChatMessageCount () const {
|
||||
return getCore()->getPrivate()->mainDb->getUnreadChatMessageCount(getChatRoomId());
|
||||
L_D();
|
||||
int dbUnreadCount = getCore()->getPrivate()->mainDb->getUnreadChatMessageCount(getChatRoomId());
|
||||
int notifiedCount = d->imdnHandler->getDisplayNotificationCount();
|
||||
L_ASSERT(dbUnreadCount >= notifiedCount);
|
||||
return dbUnreadCount - notifiedCount;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -48,6 +48,12 @@ Imdn::~Imdn () {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
int Imdn::getDisplayNotificationCount () const {
|
||||
return static_cast<int>(displayedMessages.size());
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void Imdn::notifyDelivery (const shared_ptr<ChatMessage> &message) {
|
||||
if (find(deliveredMessages.begin(), deliveredMessages.end(), message) == deliveredMessages.end()) {
|
||||
deliveredMessages.push_back(message);
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ public:
|
|||
Imdn (ChatRoom *chatRoom);
|
||||
~Imdn ();
|
||||
|
||||
int getDisplayNotificationCount () const;
|
||||
|
||||
void notifyDelivery (const std::shared_ptr<ChatMessage> &message);
|
||||
void notifyDeliveryError (const std::shared_ptr<ChatMessage> &message, LinphoneReason reason);
|
||||
void notifyDisplay (const std::shared_ptr<ChatMessage> &message);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue