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:
parent
06df1ee8da
commit
776af0e187
1 changed files with 15 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue