This commit is contained in:
fmodf 2024-08-07 13:45:04 +02:00
parent 82a05e9b6d
commit 794c50fed0
3 changed files with 3 additions and 3 deletions

View file

@ -12,7 +12,7 @@ final class MessagesMiddleware {
let features = state.accountsState.discoFeatures[currentClient.bareJid] ?? []
if features.map({ $0.xep }).contains("XEP-0313") {
let oldestMessageDate = state.conversationsState.currentMessages.first?.date ?? Date()
let archivesRequestDate = Calendar.current.date(byAdding: .day, value: -7, to: oldestMessageDate) ?? Date()
let archivesRequestDate = Calendar.current.date(byAdding: .day, value: -Const.mamRequestLength, to: oldestMessageDate) ?? Date()
promise(.success(.xmppAction(.xmppLoadArchivedMessages(jid: currentClient.bareJid, to: roster?.bareJid, fromDate: archivesRequestDate))))
} else {
promise(.success(.info("MessageMiddleware: XEP-0313 not supported for client \(currentClient.bareJid)")))

View file

@ -45,5 +45,5 @@ enum Const {
static let attachmentPreviewSize = UIScreen.main.bounds.width * 0.5
// Lenght in days for MAM request
static let mamRequestLength = 7
static let mamRequestLength = 30
}

View file

@ -29,7 +29,7 @@ struct AddContactOrChannelScreen: View {
// Header
SharedNavigationBar(
leftButton: .init(
image: Image(systemName: "chevron.left"),
image: Image(systemName: "xmark"),
action: {
isPresented = false
}