Skip to content

Commit

Permalink
Fix--notification-setting-update-and-clearing-of-MOB (#389)
Browse files Browse the repository at this point in the history
* Fix service restart on config changes

* Fix audio method removal
  • Loading branch information
godind authored Apr 22, 2024
1 parent 64602bc commit 7a2972b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/app/core/services/notifications.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,11 @@ export class NotificationsService implements OnDestroy {
* Reset the notifications array and send empty notifications array to observers
*/
private reset() {
this._notifications = [];
if (this._notificationConfig.disableNotifications) {
this._notifications = [];
this._notifications$.next([]);
}
this.updateNotificationsState();
this._notifications$.next([]);
}

/**
Expand Down Expand Up @@ -166,7 +168,6 @@ export class NotificationsService implements OnDestroy {
private deleteValue(path: string): void {
const notification = this._notifications.find(notification => notification.path == path);
if (notification) {
// this._notifications.splice(index, 1);
delete notification.value;
this.updateNotificationsState();
this._notifications$.next(this._notifications);
Expand Down Expand Up @@ -250,7 +251,6 @@ export class NotificationsService implements OnDestroy {
const existingNotification: INotification = this._notifications.find(item => item.path == metaDelta.path);
if (existingNotification) {
existingNotification.meta = metaDelta.meta;

} else {
this._notifications.push({path: metaDelta.path, meta: metaDelta.meta});
}
Expand All @@ -277,7 +277,7 @@ export class NotificationsService implements OnDestroy {
let aSev = severity.sound;
let vSev = severity.visual;

if (message.value['method'].includes(Methods.Sound) && this._notificationConfig.sound[`mute${state.charAt(0).toUpperCase() + state.slice(1)}`]) {
if (!message.value['method'].includes(Methods.Sound) || this._notificationConfig.sound[`mute${state.charAt(0).toUpperCase() + state.slice(1)}`]) {
aSev = 0;
}
if (!message.value['method'].includes(Methods.Visual)) {
Expand Down

0 comments on commit 7a2972b

Please sign in to comment.