Merge pull request #6342 from element-hq/feature/fga/live_location_sharing_setup
Setup live location sharing feature
This commit is contained in:
commit
92920b862b
197 changed files with 3767 additions and 2803 deletions
|
|
@ -11,7 +11,6 @@ package io.element.android.libraries.matrix.ui.components
|
|||
import android.os.Parcelable
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
|
|
@ -24,7 +23,6 @@ import androidx.compose.ui.layout.ContentScale
|
|||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.compound.tokens.generated.CompoundIcons
|
||||
import io.element.android.libraries.designsystem.components.PinIcon
|
||||
import io.element.android.libraries.designsystem.components.blurhash.BlurHashAsyncImage
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
|
|
@ -97,16 +95,10 @@ fun AttachmentThumbnail(
|
|||
)
|
||||
}
|
||||
AttachmentThumbnailType.Location -> {
|
||||
PinIcon(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
)
|
||||
/*
|
||||
// For coherency across the app, we should us this instead. Waiting for design decision.
|
||||
Icon(
|
||||
resourceId = R.drawable.ic_september_location,
|
||||
imageVector = CompoundIcons.LocationPin(),
|
||||
contentDescription = info.textContent,
|
||||
)
|
||||
*/
|
||||
}
|
||||
AttachmentThumbnailType.Poll -> {
|
||||
Icon(
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ open class InReplyToDetailsProvider : PreviewParameterProvider<InReplyToDetails>
|
|||
),
|
||||
aMessageContent(
|
||||
body = "Location",
|
||||
type = LocationMessageType("Location", "geo:1,2", null),
|
||||
type = LocationMessageType("Location", "geo:1,2", null, assetType = null),
|
||||
),
|
||||
aMessageContent(
|
||||
body = "Notice",
|
||||
|
|
@ -152,13 +152,13 @@ private fun aInReplyToDetails(
|
|||
eventId = EventId("\$event"),
|
||||
eventContent = eventContent,
|
||||
senderId = UserId("@Sender:domain"),
|
||||
senderProfile = aProfileTimelineDetailsReady(
|
||||
senderProfile = aProfileDetailsReady(
|
||||
displayNameAmbiguous = displayNameAmbiguous,
|
||||
),
|
||||
textContent = (eventContent as? MessageContent)?.body.orEmpty(),
|
||||
)
|
||||
|
||||
fun aProfileTimelineDetailsReady(
|
||||
fun aProfileDetailsReady(
|
||||
displayName: String? = "Sender",
|
||||
displayNameAmbiguous: Boolean = false,
|
||||
avatarUrl: String? = null,
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import io.element.android.libraries.matrix.api.timeline.item.event.FailedToParse
|
|||
import io.element.android.libraries.matrix.api.timeline.item.event.FileMessageType
|
||||
import io.element.android.libraries.matrix.api.timeline.item.event.ImageMessageType
|
||||
import io.element.android.libraries.matrix.api.timeline.item.event.LegacyCallInviteContent
|
||||
import io.element.android.libraries.matrix.api.timeline.item.event.LiveLocationContent
|
||||
import io.element.android.libraries.matrix.api.timeline.item.event.LocationMessageType
|
||||
import io.element.android.libraries.matrix.api.timeline.item.event.MessageContent
|
||||
import io.element.android.libraries.matrix.api.timeline.item.event.PollContent
|
||||
|
|
@ -32,6 +33,8 @@ import io.element.android.libraries.matrix.api.timeline.item.event.VideoMessageT
|
|||
import io.element.android.libraries.matrix.api.timeline.item.event.VoiceMessageType
|
||||
import io.element.android.libraries.matrix.ui.components.AttachmentThumbnailInfo
|
||||
import io.element.android.libraries.matrix.ui.components.AttachmentThumbnailType
|
||||
import io.element.android.libraries.matrix.ui.messages.reply.InReplyToMetadata.Text
|
||||
import io.element.android.libraries.matrix.ui.messages.reply.InReplyToMetadata.Thumbnail
|
||||
import io.element.android.libraries.ui.strings.CommonStrings
|
||||
|
||||
@Immutable
|
||||
|
|
@ -60,7 +63,7 @@ internal sealed interface InReplyToMetadata {
|
|||
@Composable
|
||||
internal fun InReplyToDetails.Ready.metadata(hideImage: Boolean): InReplyToMetadata? = when (eventContent) {
|
||||
is MessageContent -> when (val type = eventContent.type) {
|
||||
is ImageMessageType -> InReplyToMetadata.Thumbnail(
|
||||
is ImageMessageType -> Thumbnail(
|
||||
AttachmentThumbnailInfo(
|
||||
thumbnailSource = (type.info?.thumbnailSource ?: type.source).takeUnless { hideImage },
|
||||
textContent = eventContent.body,
|
||||
|
|
@ -68,7 +71,7 @@ internal fun InReplyToDetails.Ready.metadata(hideImage: Boolean): InReplyToMetad
|
|||
blurHash = type.info?.blurhash,
|
||||
)
|
||||
)
|
||||
is VideoMessageType -> InReplyToMetadata.Thumbnail(
|
||||
is VideoMessageType -> Thumbnail(
|
||||
AttachmentThumbnailInfo(
|
||||
thumbnailSource = type.info?.thumbnailSource?.takeUnless { hideImage },
|
||||
textContent = eventContent.body,
|
||||
|
|
@ -76,34 +79,34 @@ internal fun InReplyToDetails.Ready.metadata(hideImage: Boolean): InReplyToMetad
|
|||
blurHash = type.info?.blurhash,
|
||||
)
|
||||
)
|
||||
is FileMessageType -> InReplyToMetadata.Thumbnail(
|
||||
is FileMessageType -> Thumbnail(
|
||||
AttachmentThumbnailInfo(
|
||||
thumbnailSource = type.info?.thumbnailSource?.takeUnless { hideImage },
|
||||
textContent = eventContent.body,
|
||||
type = AttachmentThumbnailType.File,
|
||||
)
|
||||
)
|
||||
is LocationMessageType -> InReplyToMetadata.Thumbnail(
|
||||
is LocationMessageType -> Thumbnail(
|
||||
AttachmentThumbnailInfo(
|
||||
textContent = stringResource(CommonStrings.common_shared_location),
|
||||
type = AttachmentThumbnailType.Location,
|
||||
)
|
||||
)
|
||||
is AudioMessageType -> InReplyToMetadata.Thumbnail(
|
||||
is AudioMessageType -> Thumbnail(
|
||||
AttachmentThumbnailInfo(
|
||||
textContent = eventContent.body,
|
||||
type = AttachmentThumbnailType.Audio,
|
||||
)
|
||||
)
|
||||
is VoiceMessageType -> InReplyToMetadata.Thumbnail(
|
||||
is VoiceMessageType -> Thumbnail(
|
||||
AttachmentThumbnailInfo(
|
||||
textContent = stringResource(CommonStrings.common_voice_message),
|
||||
type = AttachmentThumbnailType.Voice,
|
||||
)
|
||||
)
|
||||
else -> InReplyToMetadata.Text(textContent ?: eventContent.body)
|
||||
else -> Text(textContent ?: eventContent.body)
|
||||
}
|
||||
is StickerContent -> InReplyToMetadata.Thumbnail(
|
||||
is StickerContent -> Thumbnail(
|
||||
AttachmentThumbnailInfo(
|
||||
thumbnailSource = eventContent.source.takeUnless { hideImage },
|
||||
textContent = eventContent.body,
|
||||
|
|
@ -111,7 +114,7 @@ internal fun InReplyToDetails.Ready.metadata(hideImage: Boolean): InReplyToMetad
|
|||
blurHash = eventContent.info.blurhash,
|
||||
)
|
||||
)
|
||||
is PollContent -> InReplyToMetadata.Thumbnail(
|
||||
is PollContent -> Thumbnail(
|
||||
AttachmentThumbnailInfo(
|
||||
textContent = eventContent.question,
|
||||
type = AttachmentThumbnailType.Poll,
|
||||
|
|
@ -127,5 +130,6 @@ internal fun InReplyToDetails.Ready.metadata(hideImage: Boolean): InReplyToMetad
|
|||
UnknownContent,
|
||||
is LegacyCallInviteContent,
|
||||
is CallNotifyContent,
|
||||
is LiveLocationContent,
|
||||
null -> null
|
||||
}
|
||||
|
|
|
|||
|
|
@ -355,6 +355,7 @@ class InReplyToMetadataKtTest {
|
|||
body = "body",
|
||||
geoUri = "geo:3.0,4.0;u=5.0",
|
||||
description = null,
|
||||
assetType = null
|
||||
)
|
||||
)
|
||||
).metadata(hideImage = false)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue