feat: show better icons for dm and gdm, presence
Signed-off-by: Infi <infi@infi.sh>
This commit is contained in:
parent
6d50571ab4
commit
9db45a4513
|
|
@ -109,7 +109,11 @@ import chat.revolt.components.chat.Message
|
||||||
import chat.revolt.components.chat.NativeMessageField
|
import chat.revolt.components.chat.NativeMessageField
|
||||||
import chat.revolt.components.chat.SystemMessage
|
import chat.revolt.components.chat.SystemMessage
|
||||||
import chat.revolt.components.emoji.EmojiPicker
|
import chat.revolt.components.emoji.EmojiPicker
|
||||||
|
import chat.revolt.components.generic.GroupIcon
|
||||||
|
import chat.revolt.components.generic.PresenceBadge
|
||||||
|
import chat.revolt.components.generic.UserAvatar
|
||||||
import chat.revolt.components.generic.UserAvatarWidthPlaceholder
|
import chat.revolt.components.generic.UserAvatarWidthPlaceholder
|
||||||
|
import chat.revolt.components.generic.presenceFromStatus
|
||||||
import chat.revolt.components.media.InbuiltMediaPicker
|
import chat.revolt.components.media.InbuiltMediaPicker
|
||||||
import chat.revolt.components.screens.chat.AttachmentManager
|
import chat.revolt.components.screens.chat.AttachmentManager
|
||||||
import chat.revolt.components.screens.chat.ChannelIcon
|
import chat.revolt.components.screens.chat.ChannelIcon
|
||||||
|
|
@ -402,12 +406,36 @@ fun ChannelScreen(
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
||||||
) {
|
) {
|
||||||
viewModel.channel?.let {
|
viewModel.channel?.let {
|
||||||
ChannelIcon(
|
when (it.channelType) {
|
||||||
channelType = it.channelType ?: ChannelType.TextChannel,
|
ChannelType.DirectMessage -> {
|
||||||
modifier = Modifier
|
val partner =
|
||||||
.size(24.dp)
|
RevoltAPI.userCache[ChannelUtils.resolveDMPartner(it)]
|
||||||
.alpha(0.8f)
|
UserAvatar(
|
||||||
)
|
username = it.name ?: stringResource(R.string.unknown),
|
||||||
|
userId = ChannelUtils.resolveDMPartner(it) ?: "",
|
||||||
|
size = 24.dp,
|
||||||
|
presenceSize = 12.dp,
|
||||||
|
avatar = partner?.avatar
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
ChannelType.Group -> {
|
||||||
|
GroupIcon(
|
||||||
|
name = it.name ?: stringResource(R.string.unknown),
|
||||||
|
size = 24.dp,
|
||||||
|
icon = it.icon
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
ChannelIcon(
|
||||||
|
channelType = it.channelType ?: ChannelType.TextChannel,
|
||||||
|
modifier = Modifier
|
||||||
|
.size(24.dp)
|
||||||
|
.alpha(0.8f)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CompositionLocalProvider(
|
CompositionLocalProvider(
|
||||||
LocalTextStyle provides LocalTextStyle.current.copy(
|
LocalTextStyle provides LocalTextStyle.current.copy(
|
||||||
|
|
@ -446,6 +474,18 @@ fun ChannelScreen(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (it.channelType == ChannelType.DirectMessage) {
|
||||||
|
val partner =
|
||||||
|
RevoltAPI.userCache[ChannelUtils.resolveDMPartner(it)]
|
||||||
|
PresenceBadge(
|
||||||
|
presence = presenceFromStatus(
|
||||||
|
partner?.status?.presence,
|
||||||
|
online = partner?.online == true
|
||||||
|
),
|
||||||
|
size = 12.dp
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.AutoMirrored.Default.KeyboardArrowRight,
|
imageVector = Icons.AutoMirrored.Default.KeyboardArrowRight,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue