mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
viewer rotation
This commit is contained in:
@@ -121,31 +121,35 @@ export class ChatSystemService {
|
||||
}
|
||||
});
|
||||
|
||||
if (!this.platform.is('desktop')) {
|
||||
App.addListener('appStateChange', ({ isActive }) => {
|
||||
if (isActive) {
|
||||
// The app is in the foreground.
|
||||
console.log('App is in the foreground');
|
||||
try {
|
||||
if (!this.platform.is('desktop')) {
|
||||
App.addListener('appStateChange', ({ isActive }) => {
|
||||
if (isActive) {
|
||||
// The app is in the foreground.
|
||||
console.log('App is in the foreground');
|
||||
|
||||
if (SessionStore.user?.ChatData?.data) {
|
||||
this.currentRoom?.loadHistory({ forceUpdate: true })
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
if (SessionStore.user?.ChatData?.data) {
|
||||
this.subscribeToRoom()
|
||||
this.RochetChatConnectorService.setStatus('online')
|
||||
this.currentRoom?.loadHistory({ forceUpdate: true })
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
/* this.reloadComponent(true) */
|
||||
} else {
|
||||
// The app is in the background.
|
||||
console.log('App is in the background');
|
||||
// You can perform actions specific to the background state here.
|
||||
}
|
||||
});
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (SessionStore.user?.ChatData?.data) {
|
||||
this.subscribeToRoom()
|
||||
this.RochetChatConnectorService.setStatus('online')
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
/* this.reloadComponent(true) */
|
||||
} else {
|
||||
// The app is in the background.
|
||||
console.log('App is in the background');
|
||||
// You can perform actions specific to the background state here.
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch(error) {}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +1,44 @@
|
||||
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 {
|
||||
|
||||
constructor( private platform: Platform,) { }
|
||||
currentOrientation: 'portrait' | 'landscape';
|
||||
|
||||
constructor( private platform: Platform) {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.detectOrientation();
|
||||
}
|
||||
|
||||
isTableDivice() {
|
||||
return false;
|
||||
return this.platform.is("tablet");
|
||||
}
|
||||
|
||||
isDesktop() {
|
||||
|
||||
return true;
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user