Adding isReply extension method for RelationDefaultContent

This commit is contained in:
Maxime NATUREL 2022-11-09 17:30:46 +01:00
parent def74926d7
commit ab90da0e51
2 changed files with 4 additions and 1 deletions

View File

@ -33,6 +33,7 @@ import org.matrix.android.sdk.api.session.room.model.message.MessageStickerConte
import org.matrix.android.sdk.api.session.room.model.message.MessageType
import org.matrix.android.sdk.api.session.room.model.message.asMessageAudioEvent
import org.matrix.android.sdk.api.session.room.model.relation.RelationDefaultContent
import org.matrix.android.sdk.api.session.room.model.relation.isReply
import org.matrix.android.sdk.api.session.room.model.relation.shouldRenderInThread
import org.matrix.android.sdk.api.session.room.send.SendState
import org.matrix.android.sdk.api.session.threads.ThreadDetails
@ -420,7 +421,7 @@ fun Event.getRelationContentForType(type: String): RelationDefaultContent? =
getRelationContent()?.takeIf { it.type == type }
fun Event.isReply(): Boolean {
return getRelationContent()?.inReplyTo?.eventId != null
return getRelationContent().isReply()
}
fun Event.isReplyRenderedInThread(): Boolean {

View File

@ -28,3 +28,5 @@ data class RelationDefaultContent(
) : RelationContent
fun RelationDefaultContent.shouldRenderInThread(): Boolean = isFallingBack == false
fun RelationDefaultContent?.isReply(): Boolean = this?.inReplyTo?.eventId != null