import { PlatformName } from '../commands/forceLightningLwcPreview' ; import { WorkspaceUtils } from '../util/workspaceUtils' ; export class PreviewService { private rememberDeviceKey = 'preview.rememberDevice' ; private logLevelKey = 'preview.logLevel' ; private defaultLogLevel = 'warn' ; private static _instance : PreviewService ; public static get instance ( ) { if ( PreviewService . _instance === undefined ) { PreviewService . _instance = new PreviewService ( ) ; } return PreviewService . _instance ; } public getRememberedDevice ( platform ) { const store = WorkspaceUtils . instance . getGlobalStore ( ) ; if ( store === undefined ) { return '' ; } return store . get ( `last${ platform }Device` ) || '' ; } public updateRememberedDevice ( platform , deviceName ) { const store = WorkspaceUtils . instance . getGlobalStore ( ) ; if ( store !== undefined ) { store . update ( `last${ platform }Device` , deviceName ) ; } } public isRememberedDeviceEnabled ( ) { return WorkspaceUtils . instance . getWorkspaceSettings ( ) . get ( this . rememberDeviceKey , false ) ; } public getLogLevel ( ) { return ( WorkspaceUtils . instance . getWorkspaceSettings ( ) . get ( this . logLevelKey ) || this . defaultLogLevel ) ; } }