Create app level category for MXSession to count missed notifications count

This commit is contained in:
Denis Morozov
2017-08-22 10:46:53 +03:00
parent bade25727e
commit da7aa8d04e
4 changed files with 87 additions and 20 deletions
+2 -20
View File
@@ -23,6 +23,7 @@
#import "AppDelegate.h"
#import "MXRoom+Riot.h"
#import "MXSession+Riot.h"
@interface MasterTabBarController ()
{
@@ -424,26 +425,7 @@
// Considering all the current sessions.
for (MXSession *session in mxSessionArray)
{
// Sum all the rooms with missed notifications.
for (MXRoomSummary *roomSummary in session.roomsSummaries)
{
NSUInteger notificationCount = roomSummary.notificationCount;
// Ignore the regular notification count if the room is in 'mentions only" mode at the Riot level.
if (roomSummary.room.isMentionsOnly)
{
// Only the highlighted missed messages must be considered here.
notificationCount = roomSummary.highlightCount;
}
if (notificationCount)
{
roomCount ++;
}
}
// Add the invites count
roomCount += [session invitedRooms].count;
roomCount += [session riot_missedDiscussionsCount];
}
return roomCount;