diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemLocationView.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemLocationView.kt index 592b95a337..576f7bd2d5 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemLocationView.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemLocationView.kt @@ -33,7 +33,7 @@ fun TimelineItemLocationView( lat = content.location.lat, lon = content.location.lon, zoom = 15.0, - contentDescription = content.body + contentDescription = content.description ) } diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/factories/event/TimelineItemContentFactory.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/factories/event/TimelineItemContentFactory.kt index 2b5c0fa98a..85fa8a0dc1 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/factories/event/TimelineItemContentFactory.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/factories/event/TimelineItemContentFactory.kt @@ -105,7 +105,6 @@ class TimelineItemContentFactory( }.lastOrNull() if (lastKnownLocation != null) { TimelineItemLocationContent( - body = itemContent.body.trimEnd(), description = itemContent.description?.trimEnd(), assetType = itemContent.assetType, senderId = sender, diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/factories/event/TimelineItemContentMessageFactory.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/factories/event/TimelineItemContentMessageFactory.kt index 723ab6feac..a5e2f922ad 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/factories/event/TimelineItemContentMessageFactory.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/factories/event/TimelineItemContentMessageFactory.kt @@ -150,7 +150,6 @@ class TimelineItemContentMessageFactory( ) } else { TimelineItemLocationContent( - body = body, location = location, description = messageType.description, senderId = senderId, diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/model/event/TimelineItemLocationContent.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/model/event/TimelineItemLocationContent.kt index aa9fb6b71e..f90dcbef03 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/model/event/TimelineItemLocationContent.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/model/event/TimelineItemLocationContent.kt @@ -19,7 +19,6 @@ import io.element.android.libraries.matrix.api.timeline.item.event.getAvatarUrl import io.element.android.libraries.matrix.api.timeline.item.event.getDisplayName data class TimelineItemLocationContent( - val body: String, val senderId: UserId, val senderProfile: ProfileDetails, val location: Location, diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/model/event/TimelineItemLocationContentProvider.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/model/event/TimelineItemLocationContentProvider.kt index 362e9b4cda..5c87c5c538 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/model/event/TimelineItemLocationContentProvider.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/model/event/TimelineItemLocationContentProvider.kt @@ -24,12 +24,11 @@ open class TimelineItemLocationContentProvider : PreviewParameterProvider { - // Live location messages are a special kind of message that we want to treat as unknown content for now - UnknownContent + LiveLocationContent( + isLive = kind.content.isLive, + description = kind.content.description, + timeout = kind.content.timeoutMs.toLong(), + assetType = kind.content.assetType.into(), + locations = kind.content.locations.map { location -> location.map() } + ) } is MsgLikeKind.Other -> UnknownContent } @@ -260,3 +269,11 @@ private fun RustEncryptedMessage.map(): UnableToDecryptContent.Data { RustEncryptedMessage.Unknown -> UnableToDecryptContent.Data.Unknown } } + +private fun BeaconInfo.map(): LiveLocationInfo { + return LiveLocationInfo( + description = description, + geoUri = geoUri, + timestamp = ts.toLong(), + ) +}