File tree 2 files changed +6
-4
lines changed
library/src/main/java/org/xmtp/android/library/codecs
2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -22,3 +22,6 @@ class ContentTypeIdBuilder {
22
22
23
23
val ContentTypeId .id: String
24
24
get() = " $authorityId :$typeId "
25
+
26
+ val ContentTypeId .description: String
27
+ get() = " $authorityId /$typeId :$versionMajor .$versionMinor "
Original file line number Diff line number Diff line change @@ -24,19 +24,18 @@ data class ReplyCodec(override var contentType: ContentTypeId = ContentTypeReply
24
24
25
25
return EncodedContent .newBuilder().also {
26
26
it.type = ContentTypeReply
27
- it.putParameters(" contentType" , reply.contentType.id)
27
+ // TODO: cut when we're certain no one is looking for "contentType" here.
28
+ it.putParameters(" contentType" , reply.contentType.description)
28
29
it.putParameters(" reference" , reply.reference)
29
30
it.content = encodeReply(replyCodec, reply.content).toByteString()
30
31
}.build()
31
32
}
32
33
33
34
override fun decode (content : EncodedContent ): Reply {
34
- val contentTypeIdString =
35
- content.getParametersOrThrow(" contentType" ) ? : throw XMTPException (" Codec Not Found" )
36
35
val reference =
37
36
content.getParametersOrThrow(" reference" ) ? : throw XMTPException (" Invalid Content" )
38
37
val replyEncodedContent = EncodedContent .parseFrom(content.content)
39
- val replyCodec = Client .codecRegistry.findFromId(contentTypeIdString )
38
+ val replyCodec = Client .codecRegistry.find(replyEncodedContent.type )
40
39
val replyContent = replyCodec.decode(content = replyEncodedContent)
41
40
? : throw XMTPException (" Invalid Content" )
42
41
return Reply (
You can’t perform that action at this time.
0 commit comments