Skip to content

Commit

Permalink
Merge branch 'develop' into hide-personal-to-team-migration-feature-i…
Browse files Browse the repository at this point in the history
…f-not-supported-by-backend
  • Loading branch information
ohassine authored Nov 28, 2024
2 parents 4cd6d31 + 8a60716 commit 33654b1
Show file tree
Hide file tree
Showing 34 changed files with 776 additions and 475 deletions.
1 change: 1 addition & 0 deletions .github/workflows/gradle-run-ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
with:
api-level: ${{ matrix.api-level }}
target: google_apis
arch: x86_64
script: ./gradlew runAcceptanceTests
env:
GITHUB_USER: ${{ github.actor }}
Expand Down
8 changes: 8 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ private fun getFlavorsSettings(): NormalizedFlavorSettings =

android {
defaultConfig {
ndk {
abiFilters.apply {
add("armeabi-v7a")
add("arm64-v8a")
add("x86_64")
}
}

val datadogApiKeyKey = "DATADOG_CLIENT_TOKEN"
val datadogApiKey: String? = System.getenv(datadogApiKeyKey) ?: project.getLocalProperty(datadogApiKeyKey, null)
buildConfigField("String", datadogApiKeyKey, datadogApiKey?.let { "\"$it\"" } ?: "null")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import com.wire.kalium.logic.data.conversation.ConversationDetails.Self
import com.wire.kalium.logic.data.conversation.ConversationDetailsWithEvents
import com.wire.kalium.logic.data.conversation.MutedConversationStatus
import com.wire.kalium.logic.data.conversation.UnreadEventCount
import com.wire.kalium.logic.data.id.TeamId
import com.wire.kalium.logic.data.message.UnreadEventType
import com.wire.kalium.logic.data.user.ConnectionState
import com.wire.kalium.logic.data.user.UserAvailabilityStatus
Expand All @@ -43,6 +44,7 @@ fun ConversationDetailsWithEvents.toConversationItem(
wireSessionImageLoader: WireSessionImageLoader,
userTypeMapper: UserTypeMapper,
searchQuery: String,
selfUserTeamId: TeamId?
): ConversationItem = when (val conversationDetails = this.conversationDetails) {
is Group -> {
ConversationItem.GroupConversation(
Expand All @@ -56,7 +58,7 @@ fun ConversationDetailsWithEvents.toConversationItem(
unreadEventCount = unreadEventCount
),
hasOnGoingCall = conversationDetails.hasOngoingCall && conversationDetails.isSelfUserMember,
isSelfUserCreator = conversationDetails.isSelfUserCreator,
isFromTheSameTeam = conversationDetails.conversation.teamId == selfUserTeamId,
isSelfUserMember = conversationDetails.isSelfUserMember,
teamId = conversationDetails.conversation.teamId,
selfMemberRole = conversationDetails.selfRole,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ sealed class HomeDestination(
@DrawableRes val icon: Int,
val isSearchable: Boolean = false,
val withNewConversationFab: Boolean = false,
val withUserAvatar: Boolean = true,
val direction: Direction
) {
data object Conversations : HomeDestination(
Expand Down Expand Up @@ -75,6 +76,7 @@ sealed class HomeDestination(
data object Settings : HomeDestination(
title = R.string.settings_screen_title,
icon = R.drawable.ic_settings,
withUserAvatar = false,
direction = SettingsScreenDestination
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package com.wire.android.ui.common

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.runtime.Composable
Expand All @@ -37,6 +38,7 @@ fun RowItemTemplate(
titleStartPadding: Dp = dimensions().spacing8x,
subtitle: @Composable () -> Unit = {},
actions: @Composable () -> Unit = {},
wrapTitleContentWidth: Boolean = false,
clickable: Clickable = Clickable(false) {}
) {
RowItem(
Expand All @@ -46,12 +48,18 @@ fun RowItemTemplate(
leadingIcon()
Column(
modifier = Modifier
.weight(1f)
.padding(start = titleStartPadding)
.then(
if (wrapTitleContentWidth) Modifier.wrapContentWidth() else Modifier.weight(1f)
)
) {
title()
subtitle()
}
if (wrapTitleContentWidth) {
// Add a spacer to push the actions to the end of the row when weight is not set
Spacer(modifier = Modifier.weight(1f))
}
Box(
modifier = Modifier
.wrapContentWidth()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ sealed class ConversationOptionNavigation {
}

sealed class ConversationTypeDetail {
data class Group(val conversationId: ConversationId, val isCreator: Boolean) : ConversationTypeDetail()
data class Group(val conversationId: ConversationId, val isFromTheSameTeam: Boolean) : ConversationTypeDetail()
data class Private(
val avatarAsset: UserAvatarAsset?,
val userId: UserId,
Expand Down Expand Up @@ -134,10 +134,11 @@ data class ConversationSheetContent(
&& (conversationTypeDetail.blockingState != BlockingState.BLOCKED))
|| conversationTypeDetail is ConversationTypeDetail.Group)

fun canDeleteGroup(): Boolean =
conversationTypeDetail is ConversationTypeDetail.Group &&
fun canDeleteGroup(): Boolean {
return conversationTypeDetail is ConversationTypeDetail.Group &&
selfRole == Conversation.Member.Role.Admin &&
conversationTypeDetail.isCreator && isTeamConversation
conversationTypeDetail.isFromTheSameTeam && isTeamConversation
}

fun canLeaveTheGroup(): Boolean = conversationTypeDetail is ConversationTypeDetail.Group && isSelfUserMember

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fun rememberConversationSheetState(
mutingConversationState = mutedStatus,
conversationTypeDetail = ConversationTypeDetail.Group(
conversationId = conversationId,
isCreator = isSelfUserCreator
isFromTheSameTeam = isFromTheSameTeam
),
isTeamConversation = teamId != null,
selfRole = selfMemberRole,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.LocalMinimumInteractiveComponentEnforcement
import androidx.compose.material3.LocalMinimumInteractiveComponentSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand All @@ -45,6 +45,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
Expand Down Expand Up @@ -80,7 +81,7 @@ fun ReactionOption(
) {
listOf("❤️", "👍", "😁", "🙂", "☹️", "👎").forEach { emoji ->
CompositionLocalProvider(
LocalMinimumInteractiveComponentEnforcement provides false
LocalMinimumInteractiveComponentSize provides Dp.Unspecified,
) {
Button(
onClick = {
Expand Down
42 changes: 33 additions & 9 deletions app/src/main/kotlin/com/wire/android/ui/home/HomeTopBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,28 @@ fun HomeTopBar(
onButtonClicked = { onOpenConversationFilter(navigationItem.currentFilter()) }
)
}
val openLabel = stringResource(R.string.content_description_open_label)
if (navigationItem.withUserAvatar) {
val openLabel = stringResource(R.string.content_description_open_label)
val contentDescription = if (shouldShowCreateTeamUnreadIndicator) {
stringResource(R.string.content_description_home_profile_btn_with_notification)
} else {
stringResource(R.string.content_description_home_profile_btn)
}
UserProfileAvatar(
avatarData = userAvatarData,
clickable = remember {
Clickable(enabled = true, onClickDescription = openLabel) { onNavigateToSelfUserProfile() }
},
type = UserProfileAvatarType.WithIndicators.RegularUser(legalHoldIndicatorVisible = withLegalHoldIndicator),
shouldShowCreateTeamUnreadIndicator = shouldShowCreateTeamUnreadIndicator,
UserProfileAvatar(
avatarData = userAvatarData,
clickable = remember {
Clickable(
enabled = true,
onClickDescription = openLabel
) { onNavigateToSelfUserProfile() }
},
type = UserProfileAvatarType.WithIndicators.RegularUser(
legalHoldIndicatorVisible = withLegalHoldIndicator
),
shouldShowCreateTeamUnreadIndicator = shouldShowCreateTeamUnreadIndicator,
contentDescription = contentDescription
)
)
}
},
elevation = elevation,
)
Expand All @@ -105,6 +112,23 @@ fun PreviewTopBar() {
}
}

@PreviewMultipleThemes
@Composable
fun PreviewSettingsTopBarWithoutAvatar() {
WireTheme {
HomeTopBar(
navigationItem = HomeDestination.Settings,
userAvatarData = UserAvatarData(null, UserAvailabilityStatus.AVAILABLE),
elevation = 0.dp,
withLegalHoldIndicator = false,
shouldShowCreateTeamUnreadIndicator = false,
onHamburgerMenuClick = {},
onNavigateToSelfUserProfile = {},
onOpenConversationFilter = {}
)
}
}

@PreviewMultipleThemes
@Composable
fun PreviewTopBarWithNameBasedAvatar() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.filterIsInstance
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.shareIn
Expand Down Expand Up @@ -150,7 +151,10 @@ class GroupConversationDetailsViewModel @Inject constructor(
title = groupDetails.conversation.name.orEmpty(),
conversationId = conversationId,
mutingConversationState = groupDetails.conversation.mutedStatus,
conversationTypeDetail = ConversationTypeDetail.Group(conversationId, groupDetails.isSelfUserCreator),
conversationTypeDetail = ConversationTypeDetail.Group(
conversationId = conversationId,
isFromTheSameTeam = groupDetails.conversation.teamId == observerSelfUser().firstOrNull()?.teamId
),
isTeamConversation = groupDetails.conversation.teamId?.value != null,
selfRole = groupDetails.selfRole,
isArchived = groupDetails.conversation.archived,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.text.ClickableText
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
Expand Down Expand Up @@ -72,7 +72,7 @@ fun MessageDetailsEmptyScreenText(
append(learnMoreText)
addStyle(
style = SpanStyle(
color = MaterialTheme.colorScheme.primary,
color = MaterialTheme.colorScheme.onBackground,
textDecoration = TextDecoration.Underline
),
start = 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import com.wire.android.R
import com.wire.android.ui.common.preview.MultipleThemePreviews
import com.wire.android.ui.home.conversations.details.participants.folderWithElements
import com.wire.android.ui.home.conversations.messagedetails.model.MessageDetailsReactionsData
import com.wire.android.ui.theme.WireTheme

@Composable
fun MessageDetailsReactions(
Expand Down Expand Up @@ -69,8 +70,10 @@ fun MessageDetailsReactions(
@MultipleThemePreviews
@Composable
fun PreviewMessageDetailsReactions() {
MessageDetailsReactions(
reactionsData = MessageDetailsReactionsData(),
onReactionsLearnMore = {}
)
WireTheme {
MessageDetailsReactions(
reactionsData = MessageDetailsReactionsData(),
onReactionsLearnMore = {}
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import com.wire.android.R
import com.wire.android.ui.common.preview.MultipleThemePreviews
import com.wire.android.ui.home.conversations.details.participants.folderWithElements
import com.wire.android.ui.home.conversations.messagedetails.model.MessageDetailsReadReceiptsData
import com.wire.android.ui.theme.WireTheme

@Composable
fun MessageDetailsReadReceipts(
Expand Down Expand Up @@ -64,11 +65,13 @@ fun MessageDetailsReadReceipts(
}
}

@Preview(showBackground = true)
@MultipleThemePreviews
@Composable
fun PreviewMessageDetailsReadReceipts() {
MessageDetailsReadReceipts(
readReceiptsData = MessageDetailsReadReceiptsData(),
onReadReceiptsLearnMore = {}
)
WireTheme {
MessageDetailsReadReceipts(
readReceiptsData = MessageDetailsReadReceiptsData(),
onReadReceiptsLearnMore = {}
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,21 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.LocalMinimumInteractiveComponentEnforcement
import androidx.compose.material3.LocalMinimumInteractiveComponentSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.wire.android.ui.common.dimensions
import com.wire.android.ui.theme.wireColorScheme
import com.wire.android.ui.theme.wireTypography
import com.wire.android.util.ui.PreviewMultipleThemes

@OptIn(ExperimentalMaterial3Api::class)
@Composable
Expand Down Expand Up @@ -69,7 +71,7 @@ fun ReactionPill(
}

CompositionLocalProvider(
LocalMinimumInteractiveComponentEnforcement provides false
LocalMinimumInteractiveComponentSize provides Dp.Unspecified
) {
OutlinedButton(
onClick = onTap,
Expand All @@ -93,6 +95,17 @@ fun ReactionPill(
}
}

@PreviewMultipleThemes
@Composable
fun ReactionPillPreview() {
ReactionPill(
emoji = "👍",
count = 5,
isOwn = false,
onTap = {}
)
}

private val minDimension = 1.dp
private val borderRadius = 12.dp
private val borderStrokeWidth = 1.dp
Expand Down
Loading

0 comments on commit 33654b1

Please sign in to comment.