Skip to content

Commit

Permalink
Merge pull request #4 from fga-eps-mds/fix_notificacoes
Browse files Browse the repository at this point in the history
#105 [FIX]  Notificações não aparecerem para o usuário
  • Loading branch information
viniciused26 authored Jan 10, 2025
2 parents c3f6c3a + 6ab56d3 commit 77218ac
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
16 changes: 15 additions & 1 deletion src/app/private/pages/cadastrarEvento.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,20 @@ import { Try } from "expo-router/build/views/Try";

try {
setShowLoading(true);
await salvarNoBancoLocal();
await salvarNoBancoLocal().then(() => {
// A notificação tem um delay minimo mas que pode afetar maracações de horario muito instantaneas. Tentar correção futura (Possivelmente fuso horario)
Notifications.scheduleNotificationAsync({
content: {
title: "Lembrete de evento",
body: titulo,
},
trigger: {
date: new Date(data.split("/").reverse().join("-") + "T" + hora + ":00"),
},
});
}
);

Toast.show({
type: "success",
text1: "Sucesso!",
Expand Down Expand Up @@ -279,6 +292,7 @@ import { Try } from "expo-router/build/views/Try";
callbackFn={salvar}
showLoading={showLoading}
/>

</View>
</View>
</ScrollView>
Expand Down
14 changes: 13 additions & 1 deletion src/app/private/pages/cadastrarRotina.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,19 @@ export default function CadastrarRotina() {

try {
setShowLoading(true);
await salvarNoBancoLocal();
await salvarNoBancoLocal().then(()=>{
// A notificação tem um delay minimo mas que pode afetar maracações de horario muito instantaneas. Tentar correção futura (Possivelmente fuso horario)
Notifications.scheduleNotificationAsync({
content: {
title: titulo,
body: "Hora de realizar a rotina!",
},
trigger: {
date: new Date(data.split("/").reverse().join("-") + "T" + hora + ":00"),
},
});
});

Toast.show({
type: "success",
text1: "Sucesso!",
Expand Down

0 comments on commit 77218ac

Please sign in to comment.