diff --git a/example/src/tests/groupTests.ts b/example/src/tests/groupTests.ts index 97f6e1223..09bafb78b 100644 --- a/example/src/tests/groupTests.ts +++ b/example/src/tests/groupTests.ts @@ -555,7 +555,7 @@ test('unpublished messages handling', async () => { } // Publish the prepared message - await alixGroup.publishPreparedMessage(preparedMessageId) + await alixGroup.publishPreparedMessages() // Sync the group after publishing the message await alixGroup.sync() diff --git a/ios/Wrappers/GroupWrapper.swift b/ios/Wrappers/GroupWrapper.swift index 47d49f547..80144dcc0 100644 --- a/ios/Wrappers/GroupWrapper.swift +++ b/ios/Wrappers/GroupWrapper.swift @@ -13,7 +13,7 @@ struct GroupWrapper { static func encodeToObj(_ group: XMTP.Group, client: XMTP.Client) throws -> [String: Any] { return [ "clientAddress": client.address, - "id": group.id.toHex, + "id": group.id, "createdAt": UInt64(group.createdAt.timeIntervalSince1970 * 1000), "peerInboxIds": try group.peerInboxIds, "version": "GROUP", diff --git a/ios/XMTPModule.swift b/ios/XMTPModule.swift index ea1401ffa..2b8a7a266 100644 --- a/ios/XMTPModule.swift +++ b/ios/XMTPModule.swift @@ -492,7 +492,7 @@ public class XMTPModule: Module { guard let client = await clientsManager.getClient(key: inboxId) else { throw Error.noClient } - if let message = try client.findMessage(messageId: Data(hex: messageId) ?? Data()) { + if let message = try client.findMessage(messageId: messageId) { return try DecodedMessageWrapper.encode(message.decrypt(), client: client) } else { return nil @@ -503,7 +503,7 @@ public class XMTPModule: Module { guard let client = await clientsManager.getClient(key: inboxId) else { throw Error.noClient } - if let group = try client.findGroup(groupId: Data(hex: groupId) ?? Data()) { + if let group = try client.findGroup(groupId: groupId) { return try GroupWrapper.encode(group, client: client) } else { return nil @@ -1368,16 +1368,14 @@ public class XMTPModule: Module { guard let client = await clientsManager.getClient(key: inboxId) else { throw Error.noClient } - let groupDataIds = groupIds.compactMap { $0.hexToData } - try await client.contacts.allowGroups(groupIds: groupDataIds) + try await client.contacts.allowGroups(groupIds: groupIds) } AsyncFunction("denyGroups") { (inboxId: String, groupIds: [String]) in guard let client = await clientsManager.getClient(key: inboxId) else { throw Error.noClient } - let groupDataIds = groupIds.compactMap { $0.hexToData } - try await client.contacts.denyGroups(groupIds: groupDataIds) + try await client.contacts.denyGroups(groupIds: groupIds) } AsyncFunction("isGroupAllowed") { (inboxId: String, groupId: String) -> Bool in @@ -1468,7 +1466,7 @@ public class XMTPModule: Module { let cacheKey = XMTP.Group.cacheKeyForId(inboxId: client.inboxID, id: id) if let group = await groupsManager.get(cacheKey) { return group - } else if let group = try await client.conversations.groups().first(where: { $0.id.toHex == id }) { + } else if let group = try client.findGroup(groupId: id) { await groupsManager.set(cacheKey, group) return group }