Skip to content

Commit

Permalink
Merge branch 'release/candidate' into fix/mls-migration-sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Garzas committed Jan 2, 2025
2 parents 53e2a3f + 2ef3a8d commit 8e87920
Show file tree
Hide file tree
Showing 19 changed files with 393 additions and 167 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ private fun UsernameTile(
modifier: Modifier = Modifier,
) {
val color =
if (isSpeaking) colorsScheme().primary else darkColorsScheme().surfaceContainerLowest
if (isSpeaking) colorsScheme().primary else darkColorsScheme().inverseOnSurface
val nameLabelColor =
when {
isSpeaking -> colorsScheme().onPrimary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ import androidx.compose.runtime.setValue

@Composable
fun rememberSearchbarState(
initialIsSearchActive: Boolean = false,
searchQueryTextState: TextFieldState = rememberTextFieldState()
): SearchBarState = rememberSaveable(
saver = SearchBarState.saver(searchQueryTextState)
saver = SearchBarState.saver()
) {
SearchBarState(searchQueryTextState = searchQueryTextState)
SearchBarState(isSearchActive = initialIsSearchActive, searchQueryTextState = searchQueryTextState)
}

class SearchBarState(
Expand All @@ -57,14 +58,23 @@ class SearchBarState(
}

companion object {
fun saver(searchQueryTextState: TextFieldState): Saver<SearchBarState, *> = Saver(
fun saver(): Saver<SearchBarState, *> = Saver(
save = {
listOf(it.isSearchActive)
listOf(
it.isSearchActive,
with(TextFieldState.Saver) {
save(it.searchQueryTextState)
}
)
},
restore = {
SearchBarState(
isSearchActive = it[0],
searchQueryTextState = searchQueryTextState
isSearchActive = (it.getOrNull(0) as? Boolean) ?: false,
searchQueryTextState = it.getOrNull(1)?.let {
with(TextFieldState.Saver) {
restore(it)
}
} ?: TextFieldState()
)
}
)
Expand Down
33 changes: 27 additions & 6 deletions app/src/main/kotlin/com/wire/android/ui/home/HomeTopBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ fun HomeTopBar(
}
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)
}
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 {
Expand All @@ -87,7 +87,7 @@ fun HomeTopBar(
legalHoldIndicatorVisible = withLegalHoldIndicator
),
shouldShowCreateTeamUnreadIndicator = shouldShowCreateTeamUnreadIndicator,
contentDescription = contentDescription
contentDescription = contentDescription
)
}
},
Expand All @@ -112,6 +112,27 @@ fun PreviewTopBar() {
}
}

@PreviewMultipleThemes
@Composable
fun PreviewTopBarWithSelectedFilter() {
WireTheme {
HomeTopBar(
navigationItem = HomeDestination.Group,
userAvatarData = UserAvatarData(
asset = null,
availabilityStatus = UserAvailabilityStatus.AVAILABLE,
nameBasedAvatar = NameBasedAvatar("Jon Doe", -1)
),
elevation = 0.dp,
withLegalHoldIndicator = false,
shouldShowCreateTeamUnreadIndicator = false,
onHamburgerMenuClick = {},
onNavigateToSelfUserProfile = {},
onOpenConversationFilter = {}
)
}
}

@PreviewMultipleThemes
@Composable
fun PreviewSettingsTopBarWithoutAvatar() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import com.wire.android.ui.home.conversationslist.common.previewConversationFold
import com.wire.android.ui.home.conversationslist.model.ConversationsSource
import com.wire.android.ui.theme.WireTheme
import com.wire.android.util.ui.PreviewMultipleThemes
import kotlinx.coroutines.flow.flowOf

@HomeNavGraph
@WireDestination
Expand All @@ -57,7 +56,7 @@ fun PreviewArchiveEmptyScreen() = WireTheme {
searchBarState = rememberSearchbarState(),
conversationsSource = ConversationsSource.ARCHIVE,
emptyListContent = { ArchiveEmptyContent() },
conversationListViewModel = ConversationListViewModelPreview(flowOf()),
conversationListViewModel = ConversationListViewModelPreview(previewConversationFoldersFlow(list = listOf())),
)
}

Expand All @@ -66,10 +65,10 @@ fun PreviewArchiveEmptyScreen() = WireTheme {
fun PreviewArchiveEmptySearchScreen() = WireTheme {
ConversationsScreenContent(
navigator = rememberNavigator {},
searchBarState = rememberSearchbarState(searchQueryTextState = TextFieldState(initialText = "er")),
searchBarState = rememberSearchbarState(initialIsSearchActive = true, searchQueryTextState = TextFieldState(initialText = "er")),
conversationsSource = ConversationsSource.ARCHIVE,
emptyListContent = { ArchiveEmptyContent() },
conversationListViewModel = ConversationListViewModelPreview(flowOf()),
conversationListViewModel = ConversationListViewModelPreview(previewConversationFoldersFlow(searchQuery = "er", list = listOf())),
)
}

Expand All @@ -78,7 +77,7 @@ fun PreviewArchiveEmptySearchScreen() = WireTheme {
fun PreviewArchiveScreen() = WireTheme {
ConversationsScreenContent(
navigator = rememberNavigator {},
searchBarState = rememberSearchbarState(searchQueryTextState = TextFieldState(initialText = "er")),
searchBarState = rememberSearchbarState(initialIsSearchActive = true, searchQueryTextState = TextFieldState(initialText = "er")),
conversationsSource = ConversationsSource.ARCHIVE,
emptyListContent = { ArchiveEmptyContent() },
conversationListViewModel = ConversationListViewModelPreview(previewConversationFoldersFlow(searchQuery = "er")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,10 @@ fun GroupConversationSettings(
onCheckedChange = onReadReceiptSwitchClicked
)
}
if (state.mlsEnabled) {
item {
ConversationProtocolDetails(
protocolInfo = state.protocolInfo
)
}
item {
ConversationProtocolDetails(
protocolInfo = state.protocolInfo
)
}
}
}
Expand All @@ -186,12 +184,13 @@ fun ConversationProtocolDetails(
) {
Column(modifier = modifier) {
FolderHeader(name = stringResource(R.string.folder_label_protocol_details))
if (protocolInfo is Conversation.ProtocolInfo.MLS) {
ProtocolDetails(
label = UIText.StringResource(R.string.protocol),
text = UIText.DynamicString(protocolInfo.name())
)

ProtocolDetails(
label = UIText.StringResource(R.string.protocol),
text = UIText.DynamicString(protocolInfo.name())
)

if (protocolInfo is Conversation.ProtocolInfo.MLS) {
ProtocolDetails(
label = UIText.StringResource(R.string.cipher_suite),
text = UIText.DynamicString(protocolInfo.cipherSuite.toString())
Expand Down
Loading

0 comments on commit 8e87920

Please sign in to comment.