diff --git a/ios/Wrappers/DecodedMessageWrapper.swift b/ios/Wrappers/DecodedMessageWrapper.swift index 72d6c2368..e9b5ed39f 100644 --- a/ios/Wrappers/DecodedMessageWrapper.swift +++ b/ios/Wrappers/DecodedMessageWrapper.swift @@ -41,8 +41,7 @@ struct ContentJson { ReplyCodec(), RemoteAttachmentCodec(), ReadReceiptCodec(), - // TODO: - // CompositeCodec(), + GroupMembershipChangedCodec(), ] static func initCodecs(client: Client) { @@ -159,6 +158,22 @@ struct ContentJson { ]] case ContentTypeReadReceipt.id where content is XMTP.ReadReceipt: return ["readReceipt": ""] + case ContentTypeGroupMembershipChanged.id where content is XMTP.GroupMembershipChanges: + let groupChange = content as! XMTP.GroupMembershipChanges + return ["groupChange": [ + "membersAdded": groupChange.membersAdded.map { member in + [ + "address": member.accountAddress, + "initiatedByAddress": member.initiatedByAccountAddress + ] + }, + "membersRemoved": groupChange.membersRemoved.map { member in + [ + "address": member.accountAddress, + "initiatedByAddress": member.initiatedByAccountAddress + ] + }, + ]] default: if let encodedContent, let encodedContentJSON = try? encodedContent.jsonString() { return ["encoded": encodedContentJSON] diff --git a/src/lib/NativeCodecs/GroupChangeCodec.ts b/src/lib/NativeCodecs/GroupChangeCodec.ts index 96b153e4d..c5d5b446e 100644 --- a/src/lib/NativeCodecs/GroupChangeCodec.ts +++ b/src/lib/NativeCodecs/GroupChangeCodec.ts @@ -15,7 +15,7 @@ export class GroupChangeCodec versionMajor: 1, versionMinor: 0, } - + // Should never have to encode since only sent from Rust backend encode(): NativeMessageContent { return {} } @@ -25,6 +25,6 @@ export class GroupChangeCodec } fallback(): string | undefined { - return 'The members of this group have changed' + return undefined } }