feat: implementa Notificações Push end-to-end (Fase 1 - Broadcast)#115
Open
DuAlmeida995 wants to merge 19 commits into
Open
feat: implementa Notificações Push end-to-end (Fase 1 - Broadcast)#115DuAlmeida995 wants to merge 19 commits into
DuAlmeida995 wants to merge 19 commits into
Conversation
Add call to the new backend route in users.ts and create a useEffect in AuthContext to send the Expo token as soon as the user logs in via the mobile app.
✅ Deploy Preview for portalhermes canceled.
|
…eContentController
Além disso, adiciona debug com a variável IS_DEBUG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
O que foi feito?
Esta PR implementa o fluxo completo de Notificações Push, desde a captura no hardware do celular até o disparo em massa pelo servidor.
Mobile:
Configuração da biblioteca expo-notifications.
Implementação da solicitação de permissão nativa para o usuário.
Geração do Expo Push Token do dispositivo.
Injeção segura do token para dentro da WebView através da variável global window.expoPushToken.
Frontend:
Criação da requisição updatePushToken no arquivo src/api/users.ts.
Adição de um useEffect no AuthContext.tsx que intercepta o token injetado pelo app mobile e o envia silenciosamente para o backend assim que o usuário é autenticado.
Backend:
Adição da coluna push_token na tabela tb_user (refletido no init.sql).
Criação da rota PATCH /users/me/push-token e método no UserModel para salvar o token.
Integração do expo-server-sdk.
Implementação do gatilho no BaseContentController (método create) para disparar uma notificação em broadcast para todos os usuários com tokens válidos sempre que um novo conteúdo (Aviso/Evento) for publicado.