import { Injectable } from '@angular/core'; import { Platform } from '@ionic/angular'; // import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx'; import { ScreenOrientation, OrientationType } from '@capawesome/capacitor-screen-orientation'; @Injectable({ providedIn: 'root' }) export class DeviceService { currentOrientation: 'portrait' | 'landscape'; constructor( private platform: Platform) { } ngOnInit() { this.detectOrientation(); } isTableDivice() { return this.platform.is("tablet"); } isDesktop() { return this.platform.is('desktop'); } private detectOrientation() { this.currentOrientation = this.platform.isPortrait() ? 'portrait' : 'landscape'; } isTableLandscape() { this.detectOrientation() return this.isTableDivice() && this.currentOrientation == 'landscape' ; } get visionDesktop () { return this.isDesktop() || this.isTableLandscape(); } }