Fixed IE issue and integrated Banner
[portal.git] / portal-FE-os / src / app / app.component.ts
index dbfb568..389153b 100644 (file)
  *
  * 
  */
-import { Component } from '@angular/core';
+import { Component, OnInit } from '@angular/core';
+import { environment } from 'src/environments/environment';
 
 @Component({
   selector: 'app-root',
   templateUrl: './app.component.html',
   styleUrls: ['./app.component.scss']
 })
-export class AppComponent {
-  
-}
+export class AppComponent implements OnInit {
+  diaplayBanner : boolean  = false;
+  api = environment.api;
+  browserCompatibilityMsg: string;
+
+  ngOnInit() {
+    this.diaplayBanner = false;
+    this.browserCompatibilityMsg = this.api.browserCompatibilityMsg;
+    this.getBrowserName();
+  }
+
+  /**
+   * Identify Browser
+  */
+  getBrowserName() {
+    const agent = window.navigator.userAgent.toLowerCase();
+    switch (true) {
+      case agent.indexOf('edge') > -1:
+        return 'edge';
+      case agent.indexOf('opr') > -1 && !!(<any>window).opr:
+        this.diaplayBanner = true;
+        return 'opera';
+      case agent.indexOf('chrome') > -1 && !!(<any>window).chrome:
+        return 'chrome';
+      case agent.indexOf('trident') > -1:
+        this.diaplayBanner = true;
+        return 'ie';
+      case agent.indexOf('firefox') > -1:
+        return 'firefox';
+      case agent.indexOf('safari') > -1:
+        this.diaplayBanner = true;
+        return 'safari';
+      default:
+        this.diaplayBanner = true;
+        return 'other';
+    }
+  }
+}
\ No newline at end of file