1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-12 02:30:41 +09:00

disable double notifications

This commit is contained in:
Andrew Simachev 2024-03-29 10:32:16 +01:00
parent 06df1ee8da
commit 776af0e187
No known key found for this signature in database
GPG key ID: 49A163D0D14E6FD8

View file

@ -18,18 +18,31 @@ class NotificationStore {
return this.itemList || [];
};
set (list: I.Notification[]): void {
this.itemList = list.map(it => new M.Notification(it));
this.setBadge();
};
get (id: string): I.Notification {
return this.itemList.find(it => it.id == id);
};
add (item: I.Notification): void {
this.itemList.unshift(item);
const current = this.get(item.id);
if (current) {
set(current, item);
} else {
this.itemList.unshift(item);
};
this.setBadge();
};
update (item: I.Notification): void {
const current = this.itemList.find(it => it.id == item.id);
const current = this.get(item.id);
if (current) {
set(current, item);