From 2dc41c20136f70983b4bc51697e3caec0cea294e Mon Sep 17 00:00:00 2001 From: fmodf Date: Mon, 22 Jul 2024 19:09:08 +0200 Subject: [PATCH] wip --- .../AppCore/XMPP/XMPPService.swift | 17 +++++++++++++++++ project.yml | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) 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: