#1 Fixed chat timestamps not always working correctly

This commit is contained in:
2024-01-01 01:36:14 +01:00
parent 4e127f6ea7
commit d033042e0b
2 changed files with 7 additions and 3 deletions

View File

@ -38,7 +38,11 @@ class _ChatViewState extends State<ChatView> {
void _query({bool renew = false}) {
Provider.of<ChatProps>(context, listen: false).setQueryToken(widget.room.token);
}
bool isSameDay(DateTime date1, DateTime date2) {
return date1.year == date2.year && date1.month == date2.month && date1.day == date2.day;
}
@override
Widget build(BuildContext context) {
return Consumer<ChatProps>(
@ -53,7 +57,7 @@ class _ChatViewState extends State<ChatView> {
if(element.systemMessage.contains("reaction")) return;
if(elementDate.weekday != lastDate.weekday) {
if(!isSameDay(elementDate, lastDate)) {
lastDate = elementDate;
messages.add(ChatBubble(
context: context,