From 6a593a45700178e8da46a124007499895fc411b8 Mon Sep 17 00:00:00 2001 From: Alex Risch Date: Tue, 2 Jan 2024 15:16:21 -0700 Subject: [PATCH 1/2] Custom Content Codecs when preparing messages Adds support for prepareMessage to handled encoded content --- Sources/XMTP/Conversation.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Sources/XMTP/Conversation.swift b/Sources/XMTP/Conversation.swift index 16e1956f..0f34e207 100644 --- a/Sources/XMTP/Conversation.swift +++ b/Sources/XMTP/Conversation.swift @@ -136,6 +136,15 @@ public enum Conversation: Sendable { } } + @discardableResult 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 { case let .v1(conversationV1): From e83c46f4d8226293fd9862290afabc701fea19b3 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Tue, 2 Jan 2024 16:17:05 -0800 Subject: [PATCH 2/2] bump pod and fix spacing --- Sources/XMTP/Conversation.swift | 16 ++++++++-------- XMTP.podspec | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Sources/XMTP/Conversation.swift b/Sources/XMTP/Conversation.swift index 0f34e207..eacbc143 100644 --- a/Sources/XMTP/Conversation.swift +++ b/Sources/XMTP/Conversation.swift @@ -135,15 +135,15 @@ public enum Conversation: Sendable { return try await conversationV2.encode(codec: codec, content: content) } } - - @discardableResult 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(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.