mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
add screenOrientation configuration
This commit is contained in:
@@ -52,6 +52,7 @@ import { fas } from '@fortawesome/free-solid-svg-icons'
|
||||
import { far } from '@fortawesome/free-regular-svg-icons'
|
||||
import { fab } from '@fortawesome/free-brands-svg-icons'
|
||||
|
||||
import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';
|
||||
@NgModule({
|
||||
declarations: [AppComponent],
|
||||
entryComponents: [],
|
||||
@@ -98,6 +99,7 @@ import { fab } from '@fortawesome/free-brands-svg-icons'
|
||||
//FCM,
|
||||
WebsocketService,
|
||||
ChatService,
|
||||
ScreenOrientation,
|
||||
],
|
||||
bootstrap: [AppComponent],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
</button>
|
||||
</div>
|
||||
<div class="content">
|
||||
|
||||
|
||||
<!-- {{ toDayEventStorage.eventsList | json}} -->
|
||||
|
||||
<ion-list>
|
||||
|
||||
@@ -7,7 +7,7 @@ import { ActivatedRoute, NavigationEnd } from '@angular/router';
|
||||
import { AlertService } from 'src/app/services/alert.service';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { StorageService } from 'src/app/services/storage.service';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
import { ModalController, Platform } from '@ionic/angular';
|
||||
import { EventDetailPage } from './event-detail/event-detail.page';
|
||||
import { EventDetailModalPage } from './event-detail-modal/event-detail-modal.page';
|
||||
import { ProcessesService } from '../../services/processes.service';
|
||||
@@ -19,7 +19,10 @@ import { EditEventPage as EventEditPage } from './edit-event/edit-event.page';
|
||||
import { GabineteDigitalPage } from '../gabinete-digital/gabinete-digital.page';
|
||||
import { User } from 'src/app/models/user.model';
|
||||
import { ToDayEventStorage } from 'src/app/store/to-day-event-storage.service';
|
||||
import { ExpedienteStorage } from 'src/app/store/expediente-storage-service.service'
|
||||
import { ExpedienteStorage } from 'src/app/store/expediente-storage-service.service';
|
||||
|
||||
import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';
|
||||
|
||||
@Component({
|
||||
selector: 'app-events',
|
||||
templateUrl: './events.page.html',
|
||||
@@ -72,6 +75,8 @@ export class EventsPage implements OnInit {
|
||||
|
||||
loggeduser: User;
|
||||
|
||||
existingScreenOrientation: string;
|
||||
|
||||
constructor(
|
||||
private eventService: EventsService,
|
||||
private router: Router,
|
||||
@@ -82,15 +87,32 @@ export class EventsPage implements OnInit {
|
||||
private processes:ProcessesService,
|
||||
/* private gabineteService: GabineteDigitalPage, */
|
||||
private modalController:ModalController,
|
||||
private screenOrientation: ScreenOrientation,
|
||||
public platform: Platform,
|
||||
) {
|
||||
this.existingScreenOrientation = this.screenOrientation.type;
|
||||
console.log(this.existingScreenOrientation);
|
||||
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
|
||||
this.prEventList = null;
|
||||
|
||||
// list
|
||||
this.LoadList();
|
||||
|
||||
/* this.screenOrientation.onChange().subscribe(
|
||||
() => {
|
||||
alert("Orientation updated" + this.screenOrientation.type);
|
||||
this.existingScreenOrientation = this.screenOrientation.type;
|
||||
}
|
||||
); */
|
||||
|
||||
this.platform.resize.subscribe(async () => {
|
||||
//alert('Resize event detected');
|
||||
console.log('Resize event detected');
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -111,6 +133,8 @@ export class EventsPage implements OnInit {
|
||||
}
|
||||
});
|
||||
this.hideSearch();
|
||||
|
||||
//this.checkScreenOrientation();
|
||||
}
|
||||
|
||||
hideSearch(){
|
||||
@@ -129,6 +153,33 @@ export class EventsPage implements OnInit {
|
||||
this.RefreshEvents();
|
||||
}
|
||||
|
||||
// Lock to portrait
|
||||
lockToPortrait(){
|
||||
this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.PORTRAIT);
|
||||
console.log('set');
|
||||
}
|
||||
|
||||
// Lock to landscape
|
||||
lockToLandscape(){
|
||||
this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.LANDSCAPE);
|
||||
}
|
||||
|
||||
// Unlock screen orientation
|
||||
unlockScreenOrientation(){
|
||||
this.screenOrientation.unlock();
|
||||
}
|
||||
|
||||
checkScreenOrientation(){
|
||||
if( window.innerWidth < 701) {
|
||||
this.lockToPortrait();
|
||||
console.log('was here');
|
||||
|
||||
}
|
||||
else{
|
||||
this.unlockScreenOrientation();
|
||||
}
|
||||
}
|
||||
|
||||
async RefreshEvents() {
|
||||
this.currentEvent = "";
|
||||
this.showLoader = true;
|
||||
|
||||
Reference in New Issue
Block a user