feat: enhance call and point registration features with sensor data integration

- Updated the CallWindow component to include connection quality states and reconnection attempts, improving user experience during calls.
- Enhanced the ChatWindow to allow starting audio and video calls in a new window, providing users with more flexibility.
- Integrated accelerometer and gyroscope data collection in the RegistroPonto component, enabling validation of point registration authenticity.
- Improved error handling and user feedback for sensor permissions and data validation, ensuring a smoother registration process.
- Updated backend logic to validate sensor data and adjust confidence scores for point registration, enhancing security against spoofing.
This commit is contained in:
2025-11-22 20:49:52 -03:00
parent fc4b5c5ba5
commit f818756efc
15 changed files with 2100 additions and 275 deletions

View File

@@ -0,0 +1,90 @@
<script lang="ts">
import { onMount } from 'svelte';
import { browser } from '$app/environment';
import CallWindow from '$lib/components/call/CallWindow.svelte';
import { obterDadosChamadaDaUrl, notificarJanelaPai } from '$lib/utils/callWindowManager';
import type { Id } from '@sgse-app/backend/convex/_generated/dataModel';
let dadosChamada = $state<{
chamadaId: Id<'chamadas'>;
conversaId: Id<'conversas'>;
tipo: 'audio' | 'video';
roomName: string;
ehAnfitriao: boolean;
} | null>(null);
let erro = $state<string | null>(null);
onMount(() => {
if (!browser) return;
// Obter dados da URL
const dados = obterDadosChamadaDaUrl();
if (!dados) {
erro = 'Dados da chamada não encontrados na URL.';
return;
}
dadosChamada = {
chamadaId: dados.chamadaId as Id<'chamadas'>,
conversaId: dados.conversaId as Id<'conversas'>,
tipo: dados.tipo,
roomName: dados.roomName,
ehAnfitriao: dados.ehAnfitriao
};
// Notificar janela pai que está pronto
notificarJanelaPai('ready');
// Detectar fechamento da janela
window.addEventListener('beforeunload', () => {
notificarJanelaPai('closed');
});
});
function handleClose(): void {
notificarJanelaPai('closed');
window.close();
}
</script>
<div class="h-screen w-screen bg-base-100">
{#if erro}
<div class="flex h-full w-full items-center justify-center">
<div class="text-center">
<div class="alert alert-error max-w-md">
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6 shrink-0 stroke-current"
fill="none"
viewBox="0 0 24 24"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"
/>
</svg>
<span>{erro}</span>
</div>
<button class="btn btn-primary mt-4" onclick={handleClose}>Fechar</button>
</div>
</div>
{:else if dadosChamada}
<CallWindow
chamadaId={dadosChamada.chamadaId}
conversaId={dadosChamada.conversaId}
tipo={dadosChamada.tipo}
roomName={dadosChamada.roomName}
ehAnfitriao={dadosChamada.ehAnfitriao}
onClose={handleClose}
/>
{:else}
<div class="flex h-full w-full items-center justify-center">
<span class="loading loading-spinner loading-lg"></span>
</div>
{/if}
</div>