mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 13:26:08 +00:00
fix message
This commit is contained in:
@@ -44,6 +44,29 @@ export class AppComponent {
|
||||
this.initializeApp();
|
||||
this.storage.set('version', environment.version).then(() => {})
|
||||
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('/firebase-messaging-sw.js')
|
||||
.then(registration => {
|
||||
console.log('Service Worker registrado com sucesso:', registration);
|
||||
|
||||
|
||||
// Send data to the service worker
|
||||
if (registration.active) {
|
||||
registration.active.postMessage({ type: 'INIT_WEBSOCKET', url: 'wss://example.com/socket' });
|
||||
} else {
|
||||
navigator.serviceWorker.ready.then(registration => {
|
||||
registration.active.postMessage({ type: 'INIT_WEBSOCKET', url: 'wss://example.com/socket' });
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Erro ao registrar o Service Worker:', error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* requestPermission() {
|
||||
|
||||
Reference in New Issue
Block a user