Revert "notificacion chat"

This reverts commit 96edb73a88.
This commit is contained in:
lizandrogd
2023-08-22 16:00:57 -05:00
parent e29af3493f
commit 1d36026cb7
+21 -22
View File
@@ -54,6 +54,9 @@ class _ChatScreenState extends State<ChatScreen> {
},
),
);
print(token);
print(response);
response;
} catch (e) {
print('error al enviar notificacion $e');
@@ -198,29 +201,25 @@ class _ChatScreenState extends State<ChatScreen> {
});
if (user?.token != '') {
sendPushNotification(user!.token!);
final mensajesQuerySnapshot =
await FirebaseFirestore.instance
.collection('chats')
.doc(widget.eventoId)
.get();
final mensajes =
mensajesQuerySnapshot.data()?['message'];
if (mensajes != null && mensajes.isNotEmpty) {
final ultimoMensaje = mensajes.last;
final ultimoMensajeUser = ultimoMensaje['user'];
if (ultimoMensajeUser == uid) {
// El último mensaje fue enviado por ti, no se envía la notificación
} else {
sendPushNotification(user!.token!);
}
} else {
sendPushNotification(user!.token!);
}
}
// if (user?.token != '') {
// final mensajesQuerySnapshot =
// await FirebaseFirestore.instance
// .collection('chats')
// .doc(widget.eventoId)
// .get();
// final mensajes =
// mensajesQuerySnapshot.data()?['message'];
// if (mensajes != null && mensajes.isNotEmpty) {
// final ultimoMensaje = mensajes.last;
// final ultimoMensajeUser = ultimoMensaje['user'];
// if (ultimoMensajeUser == uid) {
// // El último mensaje fue enviado por ti, no se envía la notificación
// } else {
// sendPushNotification(user!.token!);
// }
// } else {
// sendPushNotification(user!.token!);
// }
// }
_textController.clear();
}
},