mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
clear storage and add group
This commit is contained in:
@@ -18,7 +18,7 @@ export class NotificationHolderService {
|
||||
|
||||
try {
|
||||
this.restore()
|
||||
} catch(error) {}
|
||||
} catch (error) { }
|
||||
|
||||
}
|
||||
|
||||
@@ -29,11 +29,11 @@ export class NotificationHolderService {
|
||||
|
||||
restore() {
|
||||
this.storageService.get("Notifications").then((store) => {
|
||||
if(Array.isArray(store)) {
|
||||
if (Array.isArray(store)) {
|
||||
this._notificationList = store
|
||||
this.reverse()
|
||||
}
|
||||
}).catch((error) => {})
|
||||
}).catch((error) => { })
|
||||
}
|
||||
|
||||
save() {
|
||||
@@ -107,10 +107,10 @@ export class NotificationHolderService {
|
||||
}
|
||||
}
|
||||
|
||||
if(!this.notificationExist(notificationObject)) {
|
||||
if (!this.notificationExist(notificationObject)) {
|
||||
this._notificationList.push(notificationObject)
|
||||
|
||||
this.zone.run(()=>{
|
||||
this.zone.run(() => {
|
||||
this.reverse()
|
||||
this.save()
|
||||
})
|
||||
@@ -124,11 +124,11 @@ export class NotificationHolderService {
|
||||
|
||||
|
||||
notificationExist(notificationObject) {
|
||||
const notification = this._notificationList.find(item => {
|
||||
const notification = this._notificationList.find(item => {
|
||||
return item.id === notificationObject.id;
|
||||
});
|
||||
|
||||
if(notification?.id) {
|
||||
if (notification?.id) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
@@ -146,12 +146,21 @@ export class NotificationHolderService {
|
||||
}
|
||||
|
||||
removeNotification(notification) {
|
||||
this._notificationList = this._notificationList.filter( (e) => {
|
||||
this._notificationList = this._notificationList.filter((e) => {
|
||||
return e.index != notification.index
|
||||
})
|
||||
|
||||
|
||||
this.zone.run(()=>{
|
||||
this.zone.run(() => {
|
||||
this.save()
|
||||
this.reverse()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
clear() {
|
||||
this._notificationList = []
|
||||
this.zone.run(() => {
|
||||
this.save()
|
||||
this.reverse()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user