mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
reconnect rocketchat socket
This commit is contained in:
+48
-18
@@ -21,6 +21,10 @@ import { NetworkServiceService, ConnectionStatus } from 'src/app/services/networ
|
||||
import { UserSession } from '../models/user.model';
|
||||
import { PermissionList } from '../models/permission/permissionList';
|
||||
|
||||
import { Plugins } from '@capacitor/core';
|
||||
|
||||
const { App } = Plugins;
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
@@ -89,10 +93,10 @@ export class HomePage implements OnInit {
|
||||
public eventService: EventsService,
|
||||
public ActiveTabService: ActiveTabService,
|
||||
private RoleIdService: RoleIdService
|
||||
) {
|
||||
if (SessionStore.exist) {
|
||||
this.user = SessionStore.user;
|
||||
}
|
||||
) {
|
||||
if (SessionStore.exist) {
|
||||
this.user = SessionStore.user;
|
||||
}
|
||||
|
||||
this.router.events.subscribe((val) => {
|
||||
document.querySelectorAll('ion-modal').forEach((e: any) => e.remove())
|
||||
@@ -124,14 +128,12 @@ export class HomePage implements OnInit {
|
||||
}
|
||||
|
||||
|
||||
/* navigator.serviceWorker.ready.then((registration) => {
|
||||
console.log('yes please')
|
||||
registration.active.postMessage(
|
||||
"Test message sent immediately after creation",
|
||||
);
|
||||
}); */
|
||||
|
||||
|
||||
/* navigator.serviceWorker.ready.then((registration) => {
|
||||
console.log('yes please')
|
||||
registration.active.postMessage(
|
||||
"Test message sent immediately after creation",
|
||||
);
|
||||
}); */
|
||||
|
||||
}
|
||||
|
||||
@@ -149,7 +151,7 @@ export class HomePage implements OnInit {
|
||||
notification: event.data
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Implemente a lógica para lidar com a mensagem recebida do Service Worker
|
||||
if (event.data.notificationClicked) {
|
||||
console.log('Notificação push do Firebase clicada em segundo plano!');
|
||||
@@ -220,18 +222,34 @@ export class HomePage implements OnInit {
|
||||
|
||||
|
||||
|
||||
(()=>{
|
||||
(() => {
|
||||
document.addEventListener('click', (e: any) => {
|
||||
const closest = e.target.closest(".mat-datepicker-content");
|
||||
if(closest) {
|
||||
if (closest) {
|
||||
e.preventDefault()
|
||||
document.activeElement['blur']();
|
||||
document.activeElement['blur']();
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
})()
|
||||
}, 1000)
|
||||
|
||||
|
||||
/* if (!this.platform.is('desktop')) {
|
||||
App.addListener('appStateChange', ({ isActive }) => {
|
||||
if (isActive) {
|
||||
// The app is in the foreground.
|
||||
console.log('App is in the foreground');
|
||||
this.RochetChatConnectorService.connect()
|
||||
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.
|
||||
}
|
||||
});
|
||||
} */
|
||||
|
||||
}
|
||||
|
||||
clearTabButtonSelection() {
|
||||
@@ -322,4 +340,16 @@ export class HomePage implements OnInit {
|
||||
// this.sqliteservice.deleteAllTables();
|
||||
}
|
||||
|
||||
|
||||
reloadComponent(self:boolean,urlToNavigateTo ?:string){
|
||||
//skipLocationChange:true means dont update the url to / when navigating
|
||||
console.log("Current route I am on:",this.router.url);
|
||||
const url=self ? this.router.url :urlToNavigateTo;
|
||||
this.router.navigateByUrl('/',{skipLocationChange:true}).then(()=>{
|
||||
this.router.navigate([`/${url}`]).then(()=>{
|
||||
console.log(`After navigation I am on:${this.router.url}`)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user