From 31b5ecf973a7c076e7b6a25c8c7e48bf06143c4b Mon Sep 17 00:00:00 2001 From: Alex Risch Date: Tue, 2 Jan 2024 17:19:26 -0700 Subject: [PATCH] Custom Content Codecs when preparing messages (#212) * Custom Content Codecs when preparing messages Adds support for prepareMessage to handled encoded content * bump pod and fix spacing --------- Co-authored-by: Alex Risch Co-authored-by: Naomi Plasterer --- Sources/XMTP/Conversation.swift | 9 +++++++++ XMTP.podspec | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Sources/XMTP/Conversation.swift b/Sources/XMTP/Conversation.swift index 16e1956f..eacbc143 100644 --- a/Sources/XMTP/Conversation.swift +++ b/Sources/XMTP/Conversation.swift @@ -135,6 +135,15 @@ public enum Conversation: Sendable { return try await conversationV2.encode(codec: codec, content: content) } } + + public func prepareMessage(encodedContent: EncodedContent, options: SendOptions? = nil) async throws -> PreparedMessage { + switch self { + case let .v1(conversationV1): + return try await conversationV1.prepareMessage(encodedContent: encodedContent, options: options) + case let .v2(conversationV2): + return try await conversationV2.prepareMessage(encodedContent: encodedContent, options: options) + } + } public func prepareMessage(content: T, options: SendOptions? = nil) async throws -> PreparedMessage { switch self { diff --git a/XMTP.podspec b/XMTP.podspec index 2bd5d041..350e48f6 100644 --- a/XMTP.podspec +++ b/XMTP.podspec @@ -16,7 +16,7 @@ Pod::Spec.new do |spec| # spec.name = "XMTP" - spec.version = "0.7.3-alpha0" + spec.version = "0.7.4-alpha0" spec.summary = "XMTP SDK Cocoapod" # This description is used to generate tags and improve search results.