Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add on profile account details btn WPB-970 #3654

Merged
merged 5 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,16 @@ package com.wire.android.mapper
import com.wire.android.ui.home.conversations.avatar
import com.wire.android.ui.userprofile.self.model.OtherAccount
import com.wire.android.util.ui.WireSessionImageLoader
import com.wire.kalium.logic.data.team.Team
import com.wire.kalium.logic.data.user.SelfUser
import javax.inject.Inject

class OtherAccountMapper @Inject constructor(
private val wireSessionImageLoader: WireSessionImageLoader
) {
fun toOtherAccount(selfUser: SelfUser, team: Team?): OtherAccount = OtherAccount(
fun toOtherAccount(selfUser: SelfUser): OtherAccount = OtherAccount(
id = selfUser.id,
fullName = selfUser.name ?: "",
avatarData = selfUser.avatar(wireSessionImageLoader, selfUser.connectionStatus),
teamName = team?.name
handle = selfUser.handle
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.wire.android.ui.userprofile.self

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import com.wire.android.R
import com.wire.android.model.Clickable
import com.wire.android.ui.common.ArrowRightIcon
import com.wire.android.ui.common.RowItemTemplate
import com.wire.android.ui.common.avatar.UserProfileAvatar
import com.wire.android.ui.common.dimensions
import com.wire.android.ui.home.conversations.search.HighlightName
import com.wire.android.ui.home.conversations.search.HighlightSubtitle
import com.wire.android.ui.home.conversationslist.common.FolderHeader
import com.wire.android.ui.theme.wireDimensions
import com.wire.android.ui.userprofile.self.model.OtherAccount

@Composable
internal fun OtherAccountsHeader() {
FolderHeader(stringResource(id = R.string.user_profile_other_accs))
}

@Composable
internal fun OtherAccountItem(
account: OtherAccount,
clickable: Clickable = Clickable(enabled = true) {},
) {
RowItemTemplate(
leadingIcon = { UserProfileAvatar(account.avatarData) },
titleStartPadding = dimensions().spacing0x,
title = {
Row(verticalAlignment = Alignment.CenterVertically) {
HighlightName(
name = account.fullName,
modifier = Modifier.weight(weight = 1f, fill = false),
searchQuery = ""
)
}
},
subtitle = {
val subTitle = buildString {
append(account.handle ?: "")
if (account.id.domain.isNotBlank()) {
append("@${account.id.domain}")
}
}
HighlightSubtitle(subTitle = subTitle)
},
actions = {
Box(
modifier = Modifier
.wrapContentWidth()
.padding(end = MaterialTheme.wireDimensions.spacing8x)
) {
ArrowRightIcon(Modifier.align(Alignment.TopEnd), R.string.content_description_empty)
}
},
clickable = clickable,
modifier = Modifier.padding(start = dimensions().spacing8x)
)
}
Loading
Loading