mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Adding live location summary data into MessageInformationData
This commit is contained in:
parent
0b00f97879
commit
90aad44edf
@ -21,6 +21,7 @@ import im.vector.app.core.date.VectorDateFormatter
|
||||
import im.vector.app.core.extensions.localDateTime
|
||||
import im.vector.app.features.home.room.detail.timeline.factory.TimelineItemFactoryParams
|
||||
import im.vector.app.features.home.room.detail.timeline.item.E2EDecoration
|
||||
import im.vector.app.features.home.room.detail.timeline.item.LiveLocationShareSummaryData
|
||||
import im.vector.app.features.home.room.detail.timeline.item.MessageInformationData
|
||||
import im.vector.app.features.home.room.detail.timeline.item.PollResponseData
|
||||
import im.vector.app.features.home.room.detail.timeline.item.PollVoteSummaryData
|
||||
@ -44,8 +45,7 @@ import org.matrix.android.sdk.api.session.room.timeline.hasBeenEdited
|
||||
import javax.inject.Inject
|
||||
|
||||
/**
|
||||
* TODO Update this comment
|
||||
* This class compute if data of an event (such has avatar, display name, ...) should be displayed, depending on the previous event in the timeline
|
||||
* This class is responsible of building extra information data associated to a given event.
|
||||
*/
|
||||
class MessageInformationDataFactory @Inject constructor(private val session: Session,
|
||||
private val dateFormatter: VectorDateFormatter,
|
||||
@ -119,7 +119,8 @@ class MessageInformationDataFactory @Inject constructor(private val session: Ses
|
||||
isFirstFromThisSender = isFirstFromThisSender,
|
||||
isLastFromThisSender = isLastFromThisSender,
|
||||
e2eDecoration = e2eDecoration,
|
||||
sendStateDecoration = sendStateDecoration
|
||||
sendStateDecoration = sendStateDecoration,
|
||||
liveLocationShareSummaryData = getLiveLocationShareSummaryData(event)
|
||||
)
|
||||
}
|
||||
|
||||
@ -188,6 +189,16 @@ class MessageInformationDataFactory @Inject constructor(private val session: Ses
|
||||
}
|
||||
}
|
||||
|
||||
private fun getLiveLocationShareSummaryData(event: TimelineEvent): LiveLocationShareSummaryData? {
|
||||
return event.annotations?.liveLocationShareAggregatedSummary?.let { summary ->
|
||||
LiveLocationShareSummaryData(
|
||||
isActive = summary.isActive,
|
||||
endOfLiveTimestampAsMilliseconds = summary.endOfLiveTimestampAsMilliseconds,
|
||||
lastGeoUri = summary.lastLocationDataContent?.getBestLocationInfo()?.geoUri
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tiles type message never show the sender information (like verification request), so we should repeat it for next message
|
||||
* even if same sender
|
||||
|
@ -20,6 +20,8 @@ import android.os.Parcelable
|
||||
import im.vector.app.features.home.room.detail.timeline.style.TimelineMessageLayout
|
||||
import kotlinx.parcelize.Parcelize
|
||||
import org.matrix.android.sdk.api.session.crypto.verification.VerificationState
|
||||
import org.matrix.android.sdk.api.session.room.model.message.LocationInfo
|
||||
import org.matrix.android.sdk.api.session.room.model.message.MessageBeaconLocationDataContent
|
||||
import org.matrix.android.sdk.api.session.room.send.SendState
|
||||
import org.matrix.android.sdk.api.util.MatrixItem
|
||||
|
||||
@ -42,7 +44,8 @@ data class MessageInformationData(
|
||||
val e2eDecoration: E2EDecoration = E2EDecoration.NONE,
|
||||
val sendStateDecoration: SendStateDecoration = SendStateDecoration.NONE,
|
||||
val isFirstFromThisSender: Boolean = false,
|
||||
val isLastFromThisSender: Boolean = false
|
||||
val isLastFromThisSender: Boolean = false,
|
||||
val liveLocationShareSummaryData: LiveLocationShareSummaryData? = null,
|
||||
) : Parcelable {
|
||||
|
||||
val matrixItem: MatrixItem
|
||||
@ -98,6 +101,13 @@ data class PollVoteSummaryData(
|
||||
val percentage: Double = 0.0
|
||||
) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class LiveLocationShareSummaryData(
|
||||
val isActive: Boolean?,
|
||||
val endOfLiveTimestampAsMilliseconds: Long?,
|
||||
val lastGeoUri: String?,
|
||||
) : Parcelable
|
||||
|
||||
enum class E2EDecoration {
|
||||
NONE,
|
||||
WARN_IN_CLEAR,
|
||||
|
Loading…
Reference in New Issue
Block a user