Skip to content

Commit

Permalink
Introduce badges in room appbar
Browse files Browse the repository at this point in the history
  • Loading branch information
yostyle committed Jan 22, 2025
1 parent 53c4f7e commit 9501c4c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ class MessagesPresenter @AssistedInject constructor(

return MessagesState(
isDebugBuild = buildMeta.isDebuggable,
isEncrypted = room.isEncrypted,
isPublic = room.isPublic,
isExternal = true, // TCHAP TODO get value from room
roomId = room.roomId,
roomName = roomName,
roomAvatar = roomAvatar,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ import kotlinx.collections.immutable.ImmutableList
@Immutable
data class MessagesState(
val isDebugBuild: Boolean,
val isEncrypted: Boolean,
val isPublic: Boolean,
val isExternal: Boolean,
val roomId: RoomId,
val roomName: AsyncData<String>,
val roomAvatar: AsyncData<AvatarData>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ fun aMessagesState(
eventSink: (MessagesEvents) -> Unit = {},
) = MessagesState(
isDebugBuild = false,
isEncrypted = true,
isPublic = true,
isExternal = true,
roomId = RoomId("!id:domain"),
roomName = roomName,
roomAvatar = roomAvatar,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ fun MessagesView(
Column {
ConnectivityIndicatorView(isOnline = state.hasNetworkConnection)
MessagesViewTopBar(
isEncrypted = state.isEncrypted,
isPublic = state.isPublic,
isExternal = state.isExternal,
roomName = state.roomName.dataOrNull(),
roomAvatar = state.roomAvatar.dataOrNull(),
heroes = state.heroes,
Expand Down Expand Up @@ -443,6 +446,9 @@ private fun MessagesViewComposerBottomSheetContents(
@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun MessagesViewTopBar(
isEncrypted: Boolean,
isPublic: Boolean,
isExternal: Boolean,
roomName: String?,
roomAvatar: AvatarData?,
heroes: ImmutableList<AvatarData>,
Expand All @@ -461,12 +467,18 @@ private fun MessagesViewTopBar(
.clip(roundedCornerShape)
.clickable { onRoomDetailsClick() }
if (roomName != null && roomAvatar != null) {
RoomAvatarAndNameRow(
roomName = roomName,
roomAvatar = roomAvatar,
heroes = heroes,
modifier = titleModifier
)
Column {
RoomAvatarAndNameRow(
roomName = roomName,
roomAvatar = roomAvatar,
heroes = heroes,
modifier = titleModifier
)
Text(
text = "mes badges",
style = MaterialTheme.typography.titleSmall
)
}
} else {
IconTitlePlaceholdersRowMolecule(
iconSize = AvatarSize.TimelineRoom.dp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
package io.element.android.libraries.designsystem.atomic.atoms

import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import io.element.android.compound.annotations.CoreColorToken
import io.element.android.compound.theme.ElementTheme
import io.element.android.compound.tokens.generated.CompoundIcons
import io.element.android.compound.tokens.generated.internal.LightColorTokens
import io.element.android.libraries.designsystem.components.Badge
import io.element.android.libraries.designsystem.preview.ElementPreview
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
Expand All @@ -40,7 +38,6 @@ object MatrixBadgeAtom {
Negative
}

@OptIn(CoreColorToken::class)
@Composable
fun View(
data: MatrixBadgeData,
Expand Down

0 comments on commit 9501c4c

Please sign in to comment.