mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
change tab activation code to app component
This commit is contained in:
@@ -9,6 +9,7 @@ import { Storage } from '@ionic/storage';
|
||||
import { register } from 'swiper/element/bundle';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import { ScreenOrientation } from "@ionic-native/screen-orientation/ngx";
|
||||
import { SessionStore } from './store/session.service';
|
||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||
parse: {
|
||||
dateInput: "YYYY-MMMM-DD HH:mm"
|
||||
@@ -31,6 +32,8 @@ register();
|
||||
]
|
||||
})
|
||||
export class AppComponent {
|
||||
tabIsActive = true
|
||||
|
||||
constructor(
|
||||
private platform: Platform,
|
||||
private statusBar: StatusBar,
|
||||
@@ -67,6 +70,27 @@ export class AppComponent {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
window.addEventListener('focus', (event) => {
|
||||
if (!this.tabIsActive) {
|
||||
this.tabIsActive = true
|
||||
const data = SessionStore.getDataFromLocalStorage();
|
||||
|
||||
if (!data?.user?.Authorization && SessionStore?.user?.Authorization) {
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
if (window['all-process-gabinete']) {
|
||||
window['all-process-gabinete']()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener('blur', (event) => {
|
||||
this.tabIsActive = false
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* requestPermission() {
|
||||
|
||||
@@ -43,26 +43,6 @@ export class AuthService {
|
||||
private errorHandler: ErrorHandler,
|
||||
private platform: Platform,) {
|
||||
|
||||
|
||||
window.addEventListener('focus', (event) => {
|
||||
if (!this.tabIsActive) {
|
||||
this.tabIsActive = true
|
||||
const data = SessionStore.getDataFromLocalStorage();
|
||||
|
||||
if (!data?.user?.Authorization && SessionStore?.user?.Authorization) {
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
if (window['all-process-gabinete']) {
|
||||
window['all-process-gabinete']()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener('blur', (event) => {
|
||||
this.tabIsActive = false
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
async login(user: UserForm, { saveSession = true }): Promise<UserSession> {
|
||||
|
||||
Reference in New Issue
Block a user