feat: Add 'atas' (minutes/records) management feature, and implement various improvements across UI, backend logic, and authentication.
This commit is contained in:
@@ -16,4 +16,3 @@ O arquivo deve ser um som curto e agradável (1-2 segundos) que será tocado qua
|
||||
- Duração: 1-2 segundos
|
||||
- Tamanho: < 50KB
|
||||
- Volume: Moderado
|
||||
|
||||
|
||||
@@ -1,70 +1,67 @@
|
||||
// Service Worker para Push Notifications
|
||||
self.addEventListener("install", (event) => {
|
||||
console.log("Service Worker instalado");
|
||||
self.skipWaiting();
|
||||
self.addEventListener('install', (event) => {
|
||||
console.log('Service Worker instalado');
|
||||
self.skipWaiting();
|
||||
});
|
||||
|
||||
self.addEventListener("activate", (event) => {
|
||||
console.log("Service Worker ativado");
|
||||
event.waitUntil(self.clients.claim());
|
||||
self.addEventListener('activate', (event) => {
|
||||
console.log('Service Worker ativado');
|
||||
event.waitUntil(self.clients.claim());
|
||||
});
|
||||
|
||||
// Escutar push notifications
|
||||
self.addEventListener("push", (event) => {
|
||||
console.log("Push notification recebida:", event);
|
||||
self.addEventListener('push', (event) => {
|
||||
console.log('Push notification recebida:', event);
|
||||
|
||||
let data = {};
|
||||
if (event.data) {
|
||||
try {
|
||||
data = event.data.json();
|
||||
} catch (e) {
|
||||
data = { title: "Nova notificação", body: event.data.text() };
|
||||
}
|
||||
}
|
||||
let data = {};
|
||||
if (event.data) {
|
||||
try {
|
||||
data = event.data.json();
|
||||
} catch (e) {
|
||||
data = { title: 'Nova notificação', body: event.data.text() };
|
||||
}
|
||||
}
|
||||
|
||||
const title = data.title || "SGSE";
|
||||
const options = {
|
||||
body: data.body || "Você tem uma nova notificação",
|
||||
icon: data.icon || "/favicon.png",
|
||||
badge: data.badge || "/favicon.png",
|
||||
tag: data.tag || "default",
|
||||
requireInteraction: data.requireInteraction || false,
|
||||
data: data.data || {},
|
||||
};
|
||||
const title = data.title || 'SGSE';
|
||||
const options = {
|
||||
body: data.body || 'Você tem uma nova notificação',
|
||||
icon: data.icon || '/favicon.png',
|
||||
badge: data.badge || '/favicon.png',
|
||||
tag: data.tag || 'default',
|
||||
requireInteraction: data.requireInteraction || false,
|
||||
data: data.data || {}
|
||||
};
|
||||
|
||||
event.waitUntil(self.registration.showNotification(title, options));
|
||||
event.waitUntil(self.registration.showNotification(title, options));
|
||||
});
|
||||
|
||||
// Escutar cliques em notificações
|
||||
self.addEventListener("notificationclick", (event) => {
|
||||
console.log("Notificação clicada:", event);
|
||||
self.addEventListener('notificationclick', (event) => {
|
||||
console.log('Notificação clicada:', event);
|
||||
|
||||
event.notification.close();
|
||||
event.notification.close();
|
||||
|
||||
// Abrir/focar na aplicação
|
||||
event.waitUntil(
|
||||
self.clients
|
||||
.matchAll({ type: "window", includeUncontrolled: true })
|
||||
.then((clientList) => {
|
||||
// Se há um cliente aberto, focar nele
|
||||
for (const client of clientList) {
|
||||
if (client.url && "focus" in client) {
|
||||
return client.focus();
|
||||
}
|
||||
}
|
||||
// Abrir/focar na aplicação
|
||||
event.waitUntil(
|
||||
self.clients.matchAll({ type: 'window', includeUncontrolled: true }).then((clientList) => {
|
||||
// Se há um cliente aberto, focar nele
|
||||
for (const client of clientList) {
|
||||
if (client.url && 'focus' in client) {
|
||||
return client.focus();
|
||||
}
|
||||
}
|
||||
|
||||
// Se não há cliente aberto, abrir nova janela
|
||||
if (self.clients.openWindow) {
|
||||
const data = event.notification.data;
|
||||
let url = "/";
|
||||
|
||||
if (data?.conversaId) {
|
||||
url = `/chat?conversa=${data.conversaId}`;
|
||||
}
|
||||
|
||||
return self.clients.openWindow(url);
|
||||
}
|
||||
})
|
||||
);
|
||||
// Se não há cliente aberto, abrir nova janela
|
||||
if (self.clients.openWindow) {
|
||||
const data = event.notification.data;
|
||||
let url = '/';
|
||||
|
||||
if (data?.conversaId) {
|
||||
url = `/chat?conversa=${data.conversaId}`;
|
||||
}
|
||||
|
||||
return self.clients.openWindow(url);
|
||||
}
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user