Fix live location share item description

This commit is contained in:
ganfra 2026-04-13 11:51:48 +02:00
parent 537063d899
commit 580e85d232
4 changed files with 15 additions and 11 deletions

View file

@ -91,9 +91,9 @@ fun LocationShareRow(
)
}
Text(
text = item.description,
text = if (item.isLive) "Sharing live location" else item.formattedTimestamp,
style = ElementTheme.typography.fontBodySmRegular,
color = ElementTheme.colors.textSecondary,
color = if(item.isLive) ElementTheme.colors.textPrimary else ElementTheme.colors.textSecondary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
@ -123,7 +123,7 @@ internal fun LocationShareRowPreview() = ElementPreview {
url = null,
size = AvatarSize.UserListItem,
),
description = "Shared 1 min ago",
formattedTimestamp = "Shared 1 min ago",
isLive = true,
assetType = AssetType.SENDER,
location = Location(0.0, 0.0)
@ -142,7 +142,7 @@ internal fun LocationShareRowPreview() = ElementPreview {
),
isLive = false,
assetType = AssetType.PIN,
description = "Shared 5 hours ago",
formattedTimestamp = "Shared 5 hours ago",
location = Location(0.0, 0.0)
),
onShareClick = {},

View file

@ -123,7 +123,7 @@ class ShowLocationPresenter(
url = mode.senderAvatarUrl,
size = AvatarSize.UserListItem,
),
description = formattedTimestamp,
formattedTimestamp = formattedTimestamp,
location = mode.location,
isLive = false,
assetType = mode.assetType,
@ -142,6 +142,11 @@ class ShowLocationPresenter(
val member = members.find { it.userId == share.userId }
val displayName = member?.getBestName() ?: share.userId.value
val avatarUrl = member?.avatarUrl
val relativeTime = dateFormatter.format(timestamp = share.lastLocation?.timestamp, mode = DateFormatterMode.Full, useRelative = true)
val formattedTimestamp = stringProvider.getString(
CommonStrings.screen_static_location_sheet_timestamp_description,
relativeTime
)
LocationShareItem(
userId = share.userId,
displayName = displayName,
@ -151,7 +156,7 @@ class ShowLocationPresenter(
url = avatarUrl,
size = AvatarSize.UserListItem,
),
description = "Sharing live location",
formattedTimestamp = formattedTimestamp,
location = location,
isLive = true,
assetType = lastLocation.assetType,

View file

@ -34,7 +34,7 @@ data class LocationShareItem(
val userId: UserId,
val displayName: String,
val avatarData: AvatarData,
val description: String,
val formattedTimestamp: String,
val location: Location,
val isLive: Boolean,
val assetType: AssetType?,

View file

@ -10,7 +10,6 @@ package io.element.android.features.location.impl.show
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import io.element.android.features.location.api.Location
import io.element.android.features.location.api.ShowLocationMode
import io.element.android.features.location.impl.common.ui.LocationConstraintsDialogState
import io.element.android.libraries.designsystem.components.avatar.AvatarData
import io.element.android.libraries.designsystem.components.avatar.AvatarSize
@ -77,15 +76,15 @@ fun aLocationShareItem(
url = null,
size = AvatarSize.UserListItem,
),
formattedTimestamp: String = "Shared 1 min ago",
location: Location = Location(1.23, 2.34, 4f),
isLive: Boolean = false,
assetType: AssetType? = null,
formattedTimestamp: String = "Shared 1 min ago",
location: Location = Location(1.23, 2.34, 4f),
) = LocationShareItem(
userId = userId,
displayName = displayName,
avatarData = avatarData,
description = formattedTimestamp,
formattedTimestamp = formattedTimestamp,
location = location,
isLive = isLive,
assetType = assetType,