Skip to content

Commit

Permalink
Merge pull request #291 from matrix-org/fix_wrong_missed_conversations
Browse files Browse the repository at this point in the history
Bug Fix: Wrong missed conversations.
  • Loading branch information
giomfo committed May 9, 2017
2 parents 19c4dd6 + 3680b38 commit a36f36e
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions MatrixSDK/Data/MXRoomSummary.m
Original file line number Diff line number Diff line change
Expand Up @@ -386,13 +386,27 @@ - (void)handleJoinedRoomSync:(MXRoomSync*)roomSync
}

// Store notification counts from unreadNotifications field in /sync response
if (roomSync.unreadNotifications &&
(_notificationCount != roomSync.unreadNotifications.notificationCount
|| _highlightCount != roomSync.unreadNotifications.highlightCount))
if (roomSync.unreadNotifications)
{
_notificationCount = roomSync.unreadNotifications.notificationCount;
_highlightCount = roomSync.unreadNotifications.highlightCount;
updated = YES;
// Caution: the server may provide a not null count whereas we know locally the user has read all room messages
// (see for example this issue https://github.com/matrix-org/synapse/issues/2193).
// Patch: Ignore the server information when the user has read all messages.
if (roomSync.unreadNotifications.notificationCount && self.localUnreadEventCount == 0)
{
if (_notificationCount != 0)
{
_notificationCount = 0;
_highlightCount = 0;
updated = YES;
}
}
else if (_notificationCount != roomSync.unreadNotifications.notificationCount
|| _highlightCount != roomSync.unreadNotifications.highlightCount)
{
_notificationCount = roomSync.unreadNotifications.notificationCount;
_highlightCount = roomSync.unreadNotifications.highlightCount;
updated = YES;
}
}

if (updated || lastMessageUpdated)
Expand Down

0 comments on commit a36f36e

Please sign in to comment.