#1 Fixed chat timestamps not always working correctly

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

View File

@ -39,6 +39,10 @@ class _ChatViewState extends State<ChatView> {
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,

View File

@ -154,7 +154,7 @@ class _ChatTextfieldState extends State<ChatTextfield> {
),
cursorColor: Colors.white,
onChanged: (String text) {
if(text == "marbot marbot marbot") {
if(text.trim().toLowerCase() == "marbot marbot marbot") {
var newText = "Roboter sind cool und so, aber marbots sind besser!";
_textBoxController.text = newText;
text = newText;