Skip to content

Commit

Permalink
deprecate CompositeCodec class (#163)
Browse files Browse the repository at this point in the history
Co-authored-by: Naomi Plasterer <[email protected]>
  • Loading branch information
Babak-gh and nplasterer authored Feb 1, 2024
1 parent e6876ca commit c6fe0ea
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package org.xmtp.android.library.codecs

import org.xmtp.proto.message.contents.CompositeKt.part
import org.xmtp.proto.message.contents.CompositeOuterClass
import org.xmtp.proto.message.contents.CompositeOuterClass.Composite.Part
import org.xmtp.proto.message.contents.composite
import org.xmtp.proto.message.contents.encodedContent

typealias Composite = org.xmtp.proto.message.contents.CompositeOuterClass.Composite

Expand All @@ -31,6 +28,9 @@ class CompositePartBuilder {
}
}

@Deprecated(
message = "This content type will be removed in future versions (see here for more info -> https://community.xmtp.org/t/xip-19-deprecate-the-composite-codec/525). Consider using a custom content type (https://github.com/xmtp/xmtp-android?tab=readme-ov-file#handle-custom-content-types) instead"
)
class CompositeCodec : ContentCodec<DecodedComposite> {
override val contentType: ContentTypeId
get() = ContentTypeComposite
Expand Down Expand Up @@ -86,9 +86,11 @@ class CompositeCodec : ContentCodec<DecodedComposite> {
Part.ElementCase.PART -> {
DecodedComposite(emptyList(), part.part)
}

Part.ElementCase.COMPOSITE -> {
DecodedComposite(part.composite.partsList.map { fromCompositePart(it) })
}

else -> DecodedComposite()
}
}
Expand Down

0 comments on commit c6fe0ea

Please sign in to comment.