From 75c50961c2d99e4fec9f8a43d4ea46feec7a8ee5 Mon Sep 17 00:00:00 2001
From: Philipp Sautner <philipp.sautner@mni.thm.de>
Date: Mon, 25 Oct 2021 13:39:55 +0200
Subject: [PATCH] Adds localStorageService directly into App_init

---
 src/app/app.config.ts                                | 3 +--
 src/app/app.module.ts                                | 3 ++-
 src/app/services/http/local-storage-share.service.ts | 5 ++++-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/app/app.config.ts b/src/app/app.config.ts
index e0edaec89..0821e9838 100644
--- a/src/app/app.config.ts
+++ b/src/app/app.config.ts
@@ -2,12 +2,11 @@ import { Injectable } from '@angular/core';
 import { HttpClient } from '@angular/common/http';
 import { environment } from '../environments/environment';
 import { IAppConfig } from './models/app-config.model';
-import { LocalStorageShareService } from './services/http/local-storage-share.service';
 
 @Injectable()
 export class AppConfig {
     static settings: IAppConfig;
-    constructor(private http: HttpClient, private localStorageShareService: LocalStorageShareService) {
+    constructor(private http: HttpClient) {
     }
     load() {
         const jsonFile = `assets/config/config.${environment.name}.json`;
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index ee0157fe4..5d6a2954f 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -62,6 +62,7 @@ import { SpacyService } from './services/http/spacy.service';
 import { QuizNowComponent } from './components/shared/quiz-now/quiz-now.component';
 import { JoyrideModule } from 'ngx-joyride';
 import { QuillModule } from 'ngx-quill';
+import { LocalStorageShareService } from './services/http/local-storage-share.service';
 
 import 'prismjs';
 import 'prismjs/plugins/line-numbers/prism-line-numbers.js';
@@ -152,7 +153,7 @@ export function initializeApp(appConfig: AppConfig) {
     AppConfig,
     { provide: APP_INITIALIZER,
       useFactory: initializeApp,
-      deps: [AppConfig], multi: true
+      deps: [AppConfig, LocalStorageShareService], multi: true
     },
     {
       provide: HTTP_INTERCEPTORS,
diff --git a/src/app/services/http/local-storage-share.service.ts b/src/app/services/http/local-storage-share.service.ts
index f8e50eb68..0b2cef8b0 100644
--- a/src/app/services/http/local-storage-share.service.ts
+++ b/src/app/services/http/local-storage-share.service.ts
@@ -1,12 +1,15 @@
 import { Injectable } from '@angular/core';
+import { NotificationService } from '../util/notification.service';
 
 @Injectable({
   providedIn: 'root'
 })
 export class LocalStorageShareService {
 
-  constructor() {
+  constructor(private notficiationService: NotificationService) {
     window.addEventListener('message', this.messageHandler, false);
+
+    this.notficiationService.show("hey");
   }
 
   messageHandler(event) {
-- 
GitLab