Skip to content

Commit ebe041e

Browse files
BuildToolsTrolldemorted
authored andcommitted
fix message read log message, only attempt to mark a message read once per view
1 parent 55f5b6e commit ebe041e

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Signal-Windows.Lib/SignalLibHandle.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ public void SetMessageRead(long index, SignalConversation conversation)
344344
finally
345345
{
346346
SemaphoreSlim.Release();
347-
Logger.LogTrace("SendMessage() released");
347+
Logger.LogTrace("SetMessageRead() released");
348348
}
349349
}
350350

Signal-Windows/Controls/Conversation.xaml.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public sealed partial class Conversation : UserControl, INotifyPropertyChanged
3434
private Dictionary<long, SignalAttachmentContainer> UnfinishedAttachmentsCache = new Dictionary<long, SignalAttachmentContainer>();
3535
private SignalConversation SignalConversation;
3636
public VirtualizedCollection Collection;
37+
private int LastMarkReadRequest;
3738

3839
private string _ThreadDisplayName;
3940

@@ -135,6 +136,7 @@ private void UpdateHeader(SignalConversation thread)
135136
public void Load(SignalConversation conversation)
136137
{
137138
SignalConversation = conversation;
139+
LastMarkReadRequest = -1;
138140
InputTextBox.IsEnabled = false;
139141
DisposeCurrentThread();
140142
UpdateHeader(conversation);
@@ -319,9 +321,11 @@ private void ConversationSettingsButton_Click(object sender, RoutedEventArgs e)
319321
private void ScrollViewer_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e)
320322
{
321323
int bottomIndex = GetBottommostIndex();
322-
if (Window.Current.CoreWindow.ActivationMode == CoreWindowActivationMode.ActivatedInForeground
323-
&& SignalConversation.LastSeenMessageIndex < bottomIndex)
324+
if (Window.Current.CoreWindow.ActivationMode == CoreWindowActivationMode.ActivatedInForeground &&
325+
SignalConversation.LastSeenMessageIndex < bottomIndex &&
326+
LastMarkReadRequest < bottomIndex)
324327
{
328+
LastMarkReadRequest = bottomIndex;
325329
Task.Run(() =>
326330
{
327331
App.Handle.SetMessageRead(bottomIndex, SignalConversation);

0 commit comments

Comments
 (0)