Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate CompositeCodec class #163

Merged
merged 2 commits into from
Feb 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading