diff --git a/ConversationsClassic/AppCore/XMPP/XMPPService.swift b/ConversationsClassic/AppCore/XMPP/XMPPService.swift index 911a132..52a4e04 100644 --- a/ConversationsClassic/AppCore/XMPP/XMPPService.swift +++ b/ConversationsClassic/AppCore/XMPP/XMPPService.swift @@ -79,6 +79,23 @@ final class XMPPService: ObservableObject { }).store(in: &clientMessagesCancellables) client.login() + + client.module(.mam).$availableVersions.sink(receiveValue: { [weak client] versions in + guard !versions.isEmpty, let client = client else { + return + } + print("MAM available versions: \(versions)") + // MessageEventHandler.syncMessagesScheduled(for: client) + }).store(in: &clientMessagesCancellables) + + client.module(.mam).archivedMessagesPublisher.sink(receiveValue: { archived in + print("MAM archived message: \(archived.message)") + + // guard let conversation = MessageEventHandler.conversationKey(for: archived.message, on: account) else { + // return + // } + // DBChatHistoryStore.instance.append(for: conversation, message: archived.message, source: .archive(source: archived.source, version: archived.query.version, messageId: archived.messageId, timestamp: archived.timestamp)) + }).store(in: &clientMessagesCancellables) } // remove clients diff --git a/project.yml b/project.yml index 71294d6..80b9ac5 100644 --- a/project.yml +++ b/project.yml @@ -53,7 +53,7 @@ targets: # UIUserInterfaceStyle: Light CFBundleDisplayName: Conversations CFBundleShortVersionString: "1.0.0" - CFBundleVersion: "1" + CFBundleVersion: "2" sources: - path: ConversationsClassic excludes: