diff --git a/lib/src/screens/chat.dart b/lib/src/screens/chat.dart index 0d35d48..358fcab 100644 --- a/lib/src/screens/chat.dart +++ b/lib/src/screens/chat.dart @@ -54,9 +54,6 @@ class _ChatScreenState extends State { }, ), ); - - print(token); - print(response); response; } catch (e) { print('error al enviar notificacion $e'); @@ -201,25 +198,29 @@ class _ChatScreenState extends State { }); 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!); - } + 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(); } },