feat: inline badges for platform moderation and team
Signed-off-by: Infi <wingit@geist.ga>
This commit is contained in:
parent
96b0f1a69f
commit
4e18b556e9
|
|
@ -13,7 +13,7 @@ enum class InlineBadge {
|
|||
Bot,
|
||||
Bridge,
|
||||
PlatformModeration,
|
||||
Developer
|
||||
TeamMember
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
|
@ -29,14 +29,27 @@ fun InlineBadge(
|
|||
tint = colour,
|
||||
modifier = modifier
|
||||
)
|
||||
|
||||
InlineBadge.Bridge -> Icon(
|
||||
painter = painterResource(id = R.drawable.ic_link_variant_24dp),
|
||||
contentDescription = stringResource(id = R.string.badge_masquerade_alt),
|
||||
tint = colour,
|
||||
modifier = modifier
|
||||
)
|
||||
InlineBadge.PlatformModeration -> TODO()
|
||||
InlineBadge.Developer -> TODO()
|
||||
|
||||
InlineBadge.PlatformModeration -> Icon(
|
||||
painter = painterResource(id = R.drawable.ic_alert_decagram_24dp),
|
||||
contentDescription = stringResource(id = R.string.badge_bot_alt),
|
||||
tint = colour,
|
||||
modifier = modifier
|
||||
)
|
||||
|
||||
InlineBadge.TeamMember -> Icon(
|
||||
painter = painterResource(id = R.drawable.ic_hammer_wrench_24dp),
|
||||
contentDescription = stringResource(id = R.string.badge_team_member_alt),
|
||||
tint = colour,
|
||||
modifier = modifier
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -46,12 +59,12 @@ fun InlineBadges(
|
|||
bot: Boolean = false,
|
||||
bridge: Boolean = false,
|
||||
platformModeration: Boolean = false,
|
||||
developer: Boolean = false,
|
||||
teamMember: Boolean = false,
|
||||
colour: Color = Color.Unspecified,
|
||||
precedingIfAny: @Composable () -> Unit = {},
|
||||
followingIfAny: @Composable () -> Unit = {},
|
||||
) {
|
||||
val hasBadges = bot || bridge || platformModeration || developer
|
||||
val hasBadges = bot || bridge || platformModeration || teamMember
|
||||
|
||||
if (hasBadges) {
|
||||
precedingIfAny()
|
||||
|
|
@ -79,9 +92,9 @@ fun InlineBadges(
|
|||
colour = colour
|
||||
)
|
||||
}
|
||||
if (developer) {
|
||||
if (teamMember) {
|
||||
InlineBadge(
|
||||
badge = InlineBadge.Developer,
|
||||
badge = InlineBadge.TeamMember,
|
||||
modifier = modifier,
|
||||
colour = colour
|
||||
)
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ import chat.revolt.activities.media.ImageViewActivity
|
|||
import chat.revolt.activities.media.VideoViewActivity
|
||||
import chat.revolt.api.REVOLT_FILES
|
||||
import chat.revolt.api.RevoltAPI
|
||||
import chat.revolt.api.internals.SpecialUsers
|
||||
import chat.revolt.api.internals.ULID
|
||||
import chat.revolt.api.internals.WebCompat
|
||||
import chat.revolt.api.internals.solidColor
|
||||
|
|
@ -231,6 +232,8 @@ fun Message(
|
|||
InlineBadges(
|
||||
bot = author.bot != null && message.masquerade == null,
|
||||
bridge = message.masquerade != null && author.bot != null,
|
||||
platformModeration = author.id == SpecialUsers.PLATFORM_MODERATION_USER,
|
||||
teamMember = author.id in SpecialUsers.TEAM_MEMBER_FLAIRS.keys,
|
||||
colour = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.5f),
|
||||
modifier = Modifier.size(16.dp),
|
||||
precedingIfAny = {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#ffffff"
|
||||
android:pathData="M23,12L20.56,9.22L20.9,5.54L17.29,4.72L15.4,1.54L12,3L8.6,1.54L6.71,4.72L3.1,5.53L3.44,9.21L1,12L3.44,14.78L3.1,18.47L6.71,19.29L8.6,22.47L12,21L15.4,22.46L17.29,19.28L20.9,18.46L20.56,14.78L23,12M13,17H11V15H13V17M13,13H11V7H13V13Z" />
|
||||
</vector>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#ffffff"
|
||||
android:pathData="M13.78 15.3L19.78 21.3L21.89 19.14L15.89 13.14L13.78 15.3M17.5 10.1C17.11 10.1 16.69 10.05 16.36 9.91L4.97 21.25L2.86 19.14L10.27 11.74L8.5 9.96L7.78 10.66L6.33 9.25V12.11L5.63 12.81L2.11 9.25L2.81 8.55H5.62L4.22 7.14L7.78 3.58C8.95 2.41 10.83 2.41 12 3.58L9.89 5.74L11.3 7.14L10.59 7.85L12.38 9.63L14.2 7.75C14.06 7.42 14 7 14 6.63C14 4.66 15.56 3.11 17.5 3.11C18.09 3.11 18.61 3.25 19.08 3.53L16.41 6.2L17.91 7.7L20.58 5.03C20.86 5.5 21 6 21 6.63C21 8.55 19.45 10.1 17.5 10.1Z" />
|
||||
</vector>
|
||||
|
|
@ -100,6 +100,8 @@
|
|||
|
||||
<string name="badge_bot_alt">Bot</string>
|
||||
<string name="badge_masquerade_alt">From linked channel</string>
|
||||
<string name="badge_platform_moderation_alt">Platform moderation</string>
|
||||
<string name="badge_team_member_alt">Revolt team member</string>
|
||||
|
||||
<string name="unknown">Unknown</string>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue