From 6c3b99ffa49492c5e2d2b5ea1fcc70bcb4082ba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20M=C3=BCller?= Date: Sun, 10 Mar 2024 18:06:54 +0100 Subject: [PATCH] Added warning when reaching conversation length limit of 200 messages --- .../marianumcloud/talk/chat/getChatResponse.dart | 9 ++++++--- lib/view/pages/talk/chatView.dart | 13 +++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/api/marianumcloud/talk/chat/getChatResponse.dart b/lib/api/marianumcloud/talk/chat/getChatResponse.dart index 04955f7..9b4f55e 100644 --- a/lib/api/marianumcloud/talk/chat/getChatResponse.dart +++ b/lib/api/marianumcloud/talk/chat/getChatResponse.dart @@ -61,19 +61,22 @@ class GetChatResponseObject { static GetChatResponseObject getDateDummy(int timestamp) { DateTime elementDate = DateTime.fromMillisecondsSinceEpoch(timestamp * 1000); + return getTextDummy(Jiffy.parseFromDateTime(elementDate).format(pattern: "dd.MM.yyyy")); + } + static GetChatResponseObject getTextDummy(String text) { return GetChatResponseObject( 0, "", GetRoomResponseObjectMessageActorType.user, "", "", - timestamp, - elementDate.toIso8601String(), + 0, + "", GetRoomResponseObjectMessageType.system, false, "", - Jiffy.parseFromDateTime(elementDate).format(pattern: "dd.MM.yyyy"), + text, null, null, null diff --git a/lib/view/pages/talk/chatView.dart b/lib/view/pages/talk/chatView.dart index 8408d64..1ce1e66 100644 --- a/lib/view/pages/talk/chatView.dart +++ b/lib/view/pages/talk/chatView.dart @@ -74,6 +74,19 @@ class _ChatViewState extends State { ) ); }); + + if(data.getChatResponse.data.length >= 200) { + messages.insert(0, ChatBubble( + context: context, + isSender: false, + bubbleData: GetChatResponseObject.getTextDummy( + "Zurzeit können in dieser App nur die letzten 200 vergangenen Nachrichten angezeigt werden. " + "Um ältere Nachrichten abzurufen verwende die Webversion unter https://cloud.marianum-fulda.de" + ), + chatData: widget.room, + refetch: _query, + )); + } } return Scaffold(