11import { Component , HostListener , OnInit , Renderer2 } from '@angular/core' ;
22import { Router } from '@angular/router' ;
33import { TranslateService } from '@ngx-translate/core' ;
4- import { filter } from 'rxjs/operators' ;
4+ import { delay , filter , tap } from 'rxjs/operators' ;
55import { ApiServiceCheckerService } from './core/auth/api-checker-service' ;
66import { MenuBehavior } from './shared/behaviors/menu.behavior' ;
77import { ThemeChangeBehavior } from './shared/behaviors/theme-change.behavior' ;
@@ -20,9 +20,11 @@ export class AppComponent implements OnInit {
2020 roles = [ ADMIN_ROLE , USER_ROLE ] ;
2121 menu = false ;
2222 private height : string ;
23- offline = null ;
23+ offline = false ;
24+ online = false ;
2425 iframeView = false ;
2526 favIcon : HTMLLinkElement ;
27+ hideStatus = false ;
2628
2729 constructor (
2830 private translate : TranslateService ,
@@ -53,6 +55,9 @@ export class AppComponent implements OnInit {
5355 if ( this . router . url . includes ( 'iframe' ) ) {
5456 this . iframeView = true ;
5557 }
58+ if ( this . router . url . includes ( 'url' ) ) {
59+ this . hideStatus = true ;
60+ }
5661 } ) ;
5762 }
5863
@@ -68,12 +73,18 @@ export class AppComponent implements OnInit {
6873
6974 this . apiServiceCheckerService . isOnlineApi$
7075 . pipe (
71- filter ( isOnline => isOnline ) )
72- . subscribe ( isOnline => {
73- if ( this . offline ) {
74- this . init ( ) ;
75- }
76- setTimeout ( ( ) => this . offline = null , 3000 ) ;
76+ filter ( isOnline => isOnline ) ,
77+ tap ( ( ) => {
78+ if ( this . offline ) {
79+ this . init ( ) ;
80+ }
81+ this . online = true ;
82+ } ) ,
83+ delay ( 1000 )
84+ )
85+ . subscribe ( ( ) => {
86+ this . offline = false ;
87+ this . online = false ;
7788 } ) ;
7889 }
7990
0 commit comments