feat: user presence improvements
Signed-off-by: Infi <wingit@geist.ga>
This commit is contained in:
parent
da6a26a8d6
commit
26e825779e
|
|
@ -33,7 +33,9 @@ enum class Presence {
|
|||
Offline
|
||||
}
|
||||
|
||||
fun presenceFromStatus(status: String): Presence {
|
||||
fun presenceFromStatus(status: String, online: Boolean = true): Presence {
|
||||
if (!online) return Presence.Offline
|
||||
|
||||
return when (status) {
|
||||
"Online" -> Presence.Online
|
||||
"Idle" -> Presence.Idle
|
||||
|
|
@ -45,10 +47,10 @@ fun presenceFromStatus(status: String): Presence {
|
|||
|
||||
fun presenceColour(presence: Presence): Color {
|
||||
return when (presence) {
|
||||
Presence.Online -> Color(0xff73b258)
|
||||
Presence.Idle -> Color(0xffecc73c)
|
||||
Presence.Dnd -> Color(0xffd24c41)
|
||||
Presence.Focus -> Color(0xff69a2ef)
|
||||
Presence.Online -> Color(0xFF00C853)
|
||||
Presence.Idle -> Color(0xFFFFD600)
|
||||
Presence.Dnd -> Color(0xFFD50000)
|
||||
Presence.Focus -> Color(0xFF0091EA)
|
||||
Presence.Offline -> Color(0xff546e7a)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -172,7 +172,8 @@ fun RowScope.ChannelList(
|
|||
dmPartnerId = partner?.id,
|
||||
dmPartnerName = partner?.let { p -> User.resolveDefaultName(p) },
|
||||
dmPartnerStatus = presenceFromStatus(
|
||||
partner?.status?.presence ?: "Offline"
|
||||
status = partner?.status?.presence ?: "Offline",
|
||||
online = partner?.online ?: false
|
||||
),
|
||||
onClick = {
|
||||
onChannelClick(channel.id ?: return@DrawerChannel)
|
||||
|
|
|
|||
|
|
@ -22,4 +22,5 @@ kotlin.code.style=official
|
|||
# thereby reducing the size of the R class for that library
|
||||
android.nonTransitiveRClass=true
|
||||
android.defaults.buildfeatures.buildconfig=true
|
||||
android.nonFinalResIds=false
|
||||
android.nonFinalResIds=false
|
||||
org.gradle.configuration-cache=true
|
||||
Loading…
Reference in New Issue