Skip to content

Commit

Permalink
Merge pull request #35 from Novack/WorkaroundForIssue30
Browse files Browse the repository at this point in the history
Temporary workaround for issue #30
  • Loading branch information
amilich authored Dec 8, 2023
2 parents d98d661 + 7cdb366 commit 1f57076
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion skiffWindowsApp/Skiff Desktop/MessageProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal class MessageProcessor
{
private MainWindow _mainWindow;
private NotificationsController _notificationsController;

private List<string> _consumedMessages = new();

public MessageProcessor(MainWindow mainWindow, NotificationsController notificationsController)
{
Expand Down Expand Up @@ -48,6 +48,10 @@ internal void CoreWebView2_WebMessageReceived(object sender, CoreWebView2WebMess
var notificationsPayload = JsonSerializer.Deserialize<NotificationDataWrapper>(receivedMessage.Data.ToString());
foreach (var notification in notificationsPayload.NotificationData)
{
if (_consumedMessages.Contains(notification.EmailId))
continue;

_consumedMessages.Add(notification.EmailId);
Debug.WriteLine($"Displaying toast with title: {notification.Title} and body: {notification.Body}");
_notificationsController.ShowToastNotification(notification.Title, notification.Body, notification.ThreadId);
}
Expand Down Expand Up @@ -122,6 +126,8 @@ public class NotificationItem
public string Body { get; set; }
[JsonPropertyName("threadID")]
public string ThreadId { get; set; }
[JsonPropertyName("emailID")]
public string EmailId { get; set; }
}

public class UnreadCountDataWrapper
Expand Down

0 comments on commit 1f57076

Please sign in to comment.