diff --git a/ios/Wrappers/ConversationWrapper.swift b/ios/Wrappers/ConversationWrapper.swift index c4e3af3e5..0900c1cf8 100644 --- a/ios/Wrappers/ConversationWrapper.swift +++ b/ios/Wrappers/ConversationWrapper.swift @@ -3,17 +3,16 @@ import XMTP // Wrapper around XMTP.Conversation to allow passing these objects back into react native. struct ConversationWrapper { - static func encodeToObj(_ conversation: XMTP.Conversation, client: XMTP.Client) async throws -> [String: Any] { + static func encodeToObj(_ conversation: XMTP.Conversation, client: XMTP.Client, conversationParams: ConversationParamsWrapper = ConversationParamsWrapper()) async throws -> [String: Any] { switch conversation { case .group(let group): - return try await GroupWrapper.encodeToObj(group, client: client) + return try await GroupWrapper.encodeToObj(group, client: client, conversationParams: conversationParams) case .dm(let dm): - return try await DmWrapper.encodeToObj(dm, client: client) + return try await DmWrapper.encodeToObj(dm, client: client, conversationParams: conversationParams) } } - - static func encode(_ conversation: XMTP.Conversation, client: XMTP.Client) async throws -> String { - let obj = try await encodeToObj(conversation, client: client) + static func encode(_ conversation: XMTP.Conversation, client: XMTP.Client, conversationParams: ConversationParamsWrapper = ConversationParamsWrapper()) async throws -> String { + let obj = try await encodeToObj(conversation, client: client, conversationParams: conversationParams) let data = try JSONSerialization.data(withJSONObject: obj) guard let result = String(data: data, encoding: .utf8) else { throw WrapperError.encodeError("could not encode conversation") diff --git a/ios/XMTPModule.swift b/ios/XMTPModule.swift index 8d2dfa2c0..1aca4bc6d 100644 --- a/ios/XMTPModule.swift +++ b/ios/XMTPModule.swift @@ -480,7 +480,7 @@ public class XMTPModule: Module { for conversation in conversations { let encodedConversationContainer = try await ConversationWrapper.encode( - conversation, client: client) + conversation, client: client, conversationParams: params) results.append(encodedConversationContainer) } return results