diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/ConversationListViewModel.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/ConversationListViewModel.kt index e1b5188bd7..ad6e64c555 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/ConversationListViewModel.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/ConversationListViewModel.kt @@ -108,7 +108,7 @@ class ConversationListViewModelPreview( @HiltViewModel(assistedFactory = ConversationListViewModelImpl.Factory::class) class ConversationListViewModelImpl @AssistedInject constructor( @Assisted val conversationsSource: ConversationsSource, - private val dispatcher: DispatcherProvider, + dispatcher: DispatcherProvider, private val updateConversationMutedStatus: UpdateConversationMutedStatusUseCase, private val getConversationsPaginated: GetConversationsFromSearchUseCase, private val leaveConversation: LeaveConversationUseCase, @@ -172,7 +172,9 @@ class ConversationListViewModelImpl @AssistedInject constructor( } .flowOn(dispatcher.io()) - override val conversationListState: ConversationListState = ConversationListState(foldersWithConversations = conversationsFlow) + override val conversationListState: ConversationListState = ConversationListState( + foldersWithConversations = conversationsFlow + ) override fun searchQueryChanged(searchQuery: String) { viewModelScope.launch { diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/ConversationItemFactory.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/ConversationItemFactory.kt index 0da585d75e..00af94244a 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/ConversationItemFactory.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/ConversationItemFactory.kt @@ -262,20 +262,21 @@ fun LoadingConversationItem(modifier: Modifier = Modifier) { ) }, title = { - Box(modifier = Modifier - .height(dimensions().spacing16x) - .padding(vertical = dimensions().spacing1x) - .shimmerPlaceholder(visible = true) - .fillMaxWidth(0.75f) - + Box( + modifier = Modifier + .height(dimensions().spacing16x) + .padding(vertical = dimensions().spacing1x) + .shimmerPlaceholder(visible = true) + .fillMaxWidth(0.75f) ) }, subTitle = { - Box(modifier = Modifier - .padding(top = dimensions().spacing8x) + Box( + modifier = Modifier + .padding(top = dimensions().spacing8x) .shimmerPlaceholder(visible = true) .fillMaxWidth(0.5f) - .height(dimensions().spacing6x) + .height(dimensions().spacing6x) ) }, clickable = remember { Clickable(false) }, diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/ConversationList.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/ConversationList.kt index f5e53189fc..a7248234db 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/ConversationList.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/ConversationList.kt @@ -94,10 +94,10 @@ fun ConversationList( ) { index -> Box( modifier = Modifier - .fillMaxWidth() - .let { // for some reasons animateItem doesn't work with LazyPagingItems and shows empty composables on previews - if (LocalInspectionMode.current) it else it.animateItem() - } + .fillMaxWidth() + .let { // for some reasons animateItem doesn't work with LazyPagingItems and shows empty composables on previews + if (LocalInspectionMode.current) it else it.animateItem() + } ) { when (val item = lazyPagingConversations[index]) { is ConversationFolder -> FolderHeader( @@ -177,12 +177,13 @@ fun previewConversationFoldersFlow( list: List = previewConversationFolders(searchQuery = searchQuery) ) = flowOf(PagingData.from(list)) -fun previewConversationFolders(withFolders: Boolean = true, searchQuery: String = "") = buildList { - if (withFolders) add(ConversationFolder.Predefined.NewActivities) - addAll(previewConversationList(3, 0, true, searchQuery)) - if (withFolders) add(ConversationFolder.Predefined.Conversations) - addAll(previewConversationList(6, 3, false, searchQuery)) -} +fun previewConversationFolders(withFolders: Boolean = true, searchQuery: String = "", unreadCount: Int = 3, readCount: Int = 6) = + buildList { + if (withFolders) add(ConversationFolder.Predefined.NewActivities) + addAll(previewConversationList(unreadCount, 0, true, searchQuery)) + if (withFolders) add(ConversationFolder.Predefined.Conversations) + addAll(previewConversationList(readCount, unreadCount, false, searchQuery)) + } @PreviewMultipleThemes @Composable