diff --git a/src/app/components/shared/footer/footer.component.ts b/src/app/components/shared/footer/footer.component.ts index a6606a90b2c30c9894e85b8f1f5790233c4cfbf8..d354ac0f353794452bc80f374c2de3779b8cd87b 100644 --- a/src/app/components/shared/footer/footer.component.ts +++ b/src/app/components/shared/footer/footer.component.ts @@ -23,16 +23,34 @@ export class FooterComponent implements OnInit { } navToBlog() { - this.notificationService.show('Der Blog wird in einem neuen Fenster geöffnet', 'Okay!' , { - duration: 3000 + this.notificationService.show('Der Blog wird in einem neuen Fenster geöffnet..', 'Öffnen' , { + duration: 5000 + }); + this.notificationService.snackRef.afterDismissed().subscribe(info => { + if (info.dismissedByAction === true) { + window.open(this.blogUrl, '_blank'); + } }); - window.open(this.blogUrl, '_blank'); } navToDSGVO() { - window.open(this.dsgvoUrl, '_blank'); + this.notificationService.show('Die Datenschutzverordnung wird in einem neuen Fenster geöffnet..', 'Öffnen' , { + duration: 5000 + }); + this.notificationService.snackRef.afterDismissed().subscribe(info => { + if (info.dismissedByAction === true) { + window.open(this.dsgvoUrl, '_blank'); + } + }); } navToImprint() { - window.open(this.imprUrl, '_blank'); + this.notificationService.show('Das Impressum wird in einem neuen Fenster geöffnet..', 'Öffnen' , { + duration: 5000 + }); + this.notificationService.snackRef.afterDismissed().subscribe(info => { + if (info.dismissedByAction === true) { + window.open(this.imprUrl, '_blank'); + } + }); } } diff --git a/src/app/services/util/notification.service.ts b/src/app/services/util/notification.service.ts index e1f5adbebe0b50f10089ba5f8372b98537e321ea..81978198950edb0d650f8720f3ed918379af3183 100644 --- a/src/app/services/util/notification.service.ts +++ b/src/app/services/util/notification.service.ts @@ -6,12 +6,13 @@ export class NotificationService { private defaultConfig = { duration: 2000 }; + public snackRef: any; - constructor(private snackBar: MatSnackBar) { + constructor(public snackBar: MatSnackBar) { } show(message: string, action?: string, config?: MatSnackBarConfig) { // Delegate the message and merge the (optionally) passed config with the default config - this.snackBar.open(message, action, Object.assign({}, this.defaultConfig, config)); + this.snackRef = this.snackBar.open(message, action, Object.assign({}, this.defaultConfig, config)); } }