import { Component } from '@angular/core' ; import { openyolo } from '../../../../ts/api/api' ; import { RenderMode } from '../../../../ts/protocol/data' ; import { SettingsService } from '../app/settings.service' ; @ Component ( { selector : 'app-settings' , templateUrl : './settings.component.html' , styleUrls : [ './settings.component.css' ] } ) export class SettingsComponent { providerUrl : string ; renderMode : string ; renderModes : string [ ] ; constructor ( private settingsService ) { this . providerUrl = settingsService . getProviderBaseUrl ( ) ; this . renderModes = [ ] ; this . renderModes . push ( 'default' ) ; this . renderModes . push ( RenderMode . bottomSheet ) ; this . renderModes . push ( RenderMode . navPopout ) ; this . renderModes . push ( RenderMode . fullScreen ) ; this . renderMode = settingsService . getRenderMode ( ) || 'default' ; } confirm ( ) { this . settingsService . setProviderBaseUrl ( this . providerUrl ) ; this . settingsService . setRenderMode ( this . renderMode ) ; openyolo . setProviderUrlBase ( this . providerUrl ) ; openyolo . setRenderMode ( this . getRenderMode ( ) ) ; openyolo . reset ( ) ; } private getRenderMode ( ) { return this . renderMode as RenderMode ; } }