feat(inbox): automatically mark inbox items read when reading or viewing conversation
This commit is contained in:
parent
dcccc67d3e
commit
0de9c40337
6 changed files with 145 additions and 4 deletions
|
|
@ -477,6 +477,29 @@ public class ClientState
|
|||
}
|
||||
}
|
||||
|
||||
public int MarkChannelInboxItemsReadLocally(string channelId)
|
||||
{
|
||||
if (string.IsNullOrEmpty(channelId)) return 0;
|
||||
lock (_lock)
|
||||
{
|
||||
int changed = 0;
|
||||
foreach (var item in InboxItems)
|
||||
{
|
||||
if (string.Equals(item.ChannelId, channelId, StringComparison.OrdinalIgnoreCase) && !item.IsRead)
|
||||
{
|
||||
item.IsRead = true;
|
||||
changed++;
|
||||
}
|
||||
}
|
||||
if (changed > 0)
|
||||
{
|
||||
UnreadInboxCount = Math.Max(0, UnreadInboxCount - changed);
|
||||
NeedsRedraw = true;
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
}
|
||||
|
||||
public List<InboxItem> GetInboxItems()
|
||||
{
|
||||
lock (_lock)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue