Check app updates

This commit is contained in:
2023-06-23 16:23:18 +02:00
parent e83f7b6311
commit 985ba7dccc
4 changed files with 52 additions and 17 deletions

View File

@@ -37,8 +37,14 @@ export class NotificationsService {
}
return message.id;
}
private remove(id: string|undefined) {
this.messages = this.messages.filter(x => x.id!==id);
private remove(id: string | undefined, checkDismiss: boolean = true) {
if (checkDismiss) {
const message = this.messages.find(x => x.id === id);
if (message && message.dismiss) {
message.dismiss();
}
}
this.messages = this.messages.filter(x => x.id !== id);
this.sortMessages();
if (this.messages.length === 0 && this.handler) {
this.handler.dismiss();
@@ -51,7 +57,7 @@ export class NotificationsService {
}
doAction(message: Message) {
if (message.action) { message.action(); }
this.remove(message.id);
this.remove(message.id, false);
}
}
@@ -62,6 +68,8 @@ interface Message {
btn?: string;
// eslint-disable-next-line @typescript-eslint/ban-types
action?: Function;
// eslint-disable-next-line @typescript-eslint/ban-types
dismiss?: Function;
createdAt?: Moment,
parentId?: string;
}