feat: withdraw notifications of session

This commit is contained in:
Evangelos Paterakis 2022-11-21 01:29:23 +02:00
parent 83a6944605
commit 0b71d45ed0
No known key found for this signature in database
GPG key ID: FE5185F095BFC8C9

View file

@ -127,7 +127,8 @@ public class Tooth.InstanceAccount : API.Account, Streamable {
public bool has_unread { get; set; default = false; }
public int last_read_id { get; set; default = 0; }
public int last_received_id { get; set; default = 0; }
public HashMap<int,GLib.Notification> unread_toasts { get; set; default = new HashMap<int,GLib.Notification> (); }
// public HashMap<int,GLib.Notification> unread_toasts { get; set; default = new HashMap<int,GLib.Notification> (); }
public ArrayList<string> sent_notification_ids { get; set; default = new ArrayList<string> (); }
public ArrayList<Object> notification_inhibitors { get; set; default = new ArrayList<Object> (); }
private bool passed_init_notifications = false;
@ -181,6 +182,13 @@ public class Tooth.InstanceAccount : API.Account, Streamable {
unread_count = 0;
has_unread = false;
if (sent_notification_ids.size > 0) {
sent_notification_ids.@foreach (entry => {
app.withdraw_notification (entry);
return true;
});
}
// unread_toasts.@foreach (entry => {
// var id = entry.key;
// read_notification (id);
@ -202,6 +210,7 @@ public class Tooth.InstanceAccount : API.Account, Streamable {
var toast = obj.to_toast (this);
var id = obj.id;
app.send_notification (id, toast);
sent_notification_ids.add(id);
}