From 44ef6c25bab2e7845404f2b9f31ec2ef8049d79e Mon Sep 17 00:00:00 2001 From: fmodf Date: Fri, 9 Aug 2024 16:33:22 +0200 Subject: [PATCH] wip --- .../AppCore/Middlewares/ArchivedMessagesMiddleware.swift | 2 +- ConversationsClassic/Helpers/Const.swift | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ConversationsClassic/AppCore/Middlewares/ArchivedMessagesMiddleware.swift b/ConversationsClassic/AppCore/Middlewares/ArchivedMessagesMiddleware.swift index b55686f..bf0aa08 100644 --- a/ConversationsClassic/AppCore/Middlewares/ArchivedMessagesMiddleware.swift +++ b/ConversationsClassic/AppCore/Middlewares/ArchivedMessagesMiddleware.swift @@ -43,7 +43,7 @@ private extension ArchivedMessagesMiddleware { if let lastDate = messages.first?.date { return lastDate } else { - return Calendar.current.date(byAdding: .day, value: -Const.mamRequestLength, to: Date()) ?? Date() + return Calendar.current.date(byAdding: .day, value: -Const.mamRequestDaysLength, to: Date()) ?? Date() } } } diff --git a/ConversationsClassic/Helpers/Const.swift b/ConversationsClassic/Helpers/Const.swift index 2f1e35c..c96edfd 100644 --- a/ConversationsClassic/Helpers/Const.swift +++ b/ConversationsClassic/Helpers/Const.swift @@ -45,5 +45,9 @@ enum Const { static let attachmentPreviewSize = UIScreen.main.bounds.width * 0.5 // Lenght in days for MAM request - static let mamRequestLength = 30 + static let mamRequestDaysLength = 30 + + // Limits for messages pagination + static let messagesPageMin = 20 + static let messagesPageMax = 100 }