import { ChangeDetectionStrategy , ViewChild , ViewContainerRef , ElementRef , AfterViewInit , ChangeDetectorRef , Inject , OnInit } from '@angular/core' ; import { Router , NavigationEnd } from '@angular/router' ; import { BaseComponent , Config , LogService , ActionBarUtil , DrawerService } from '../../shared/core/index' ; import { AuthService , PlayerService , IPlayerState , FirebaseService , PlaylistService , TrackControlService } from '../../shared/shoutoutplay/index' ; import { PlayerFullComponent } from '../player/player-full.component' ; import { ModalDialogService , ModalDialogOptions } from "nativescript-angular" ; import { RadSideDrawerComponent } from 'nativescript-telerik-ui-pro/sidedrawer/angular' ; import { PushTransition , DrawerTransitionBase , SlideInOnTopTransition } from 'nativescript-telerik-ui-pro/sidedrawer' ; import { Page } from "ui/page" ; import { screen } from 'platform' ; import { BehaviorSubject } from 'rxjs/BehaviorSubject' ; import { Subscription } from 'rxjs/Subscription' ; @ BaseComponent ( { selector : 'home' , templateUrl : './components/home/home.component.html' , changeDetection : ChangeDetectionStrategy . Default } ) export class HomeComponent implements AfterViewInit , OnInit { @ ViewChild ( RadSideDrawerComponent ) public drawerComponent : RadSideDrawerComponent ; private _sideDrawerTransition : DrawerTransitionBase ; private _playerControls : any ; constructor ( private logger , private firebaseService , private playlistService , @ Inject ( Page ) private _page , private vcRef , private _changeDetectionRef , private router , public player , public authService , public drawerService , public trackControl , private modal ) { ActionBarUtil . STATUSBAR_STYLE ( 1 ) ; this . _page . on ( "loaded" , this . onLoaded , this ) ; } public get sideDrawerTransition ( ) : DrawerTransitionBase { return this . _sideDrawerTransition ; } public onLoaded ( args ) { this . _sideDrawerTransition = new SlideInOnTopTransition ( ) ; } public openFullPlayer ( ) { let options = { context : { } , viewContainerRef : this . vcRef , fullscreen : true } ; this . modal . showModal ( PlayerFullComponent , options ) . then ( ( ) => { } ) ; } ngOnInit ( ) { this . logger . debug ( `HomeComponent ngOnInit` ) ; this . router . events . subscribe ( ( e ) => { if ( e instanceof NavigationEnd ) { this . drawerService . toggle ( false ) ; } } ) ; } ngAfterViewInit ( ) { this . logger . debug ( `HomeComponent ngAfterViewInit` ) ; this . _changeDetectionRef . detectChanges ( ) ; this . drawerService . drawer = this . drawerComponent . sideDrawer ; } }