From d088a7c1540e93014bdb60d976b769e94c904701 Mon Sep 17 00:00:00 2001 From: Krille Date: Thu, 24 Oct 2024 08:03:36 +0200 Subject: [PATCH] chore: Change same enivornment to one hour --- lib/utils/date_time_extension.dart | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/utils/date_time_extension.dart b/lib/utils/date_time_extension.dart index 8043805f0..0ed561af0 100644 --- a/lib/utils/date_time_extension.dart +++ b/lib/utils/date_time_extension.dart @@ -21,17 +21,10 @@ extension DateTimeExtension on DateTime { return millisecondsSinceEpoch <= other.millisecondsSinceEpoch; } - /// Two message events can belong to the same environment. That means that they - /// don't need to display the time they were sent because they are close - /// enaugh. - static const minutesBetweenEnvironments = 10; - /// Checks if two DateTimes are close enough to belong to the same /// environment. - bool sameEnvironment(DateTime prevTime) { - return millisecondsSinceEpoch - prevTime.millisecondsSinceEpoch < - 1000 * 60 * minutesBetweenEnvironments; - } + bool sameEnvironment(DateTime prevTime) => + prevTime.difference(this) < const Duration(hours: 1); /// Returns a simple time String. String localizedTimeOfDay(BuildContext context) =>