Skip to content

Commit

Permalink
fixed detekt issues
Browse files Browse the repository at this point in the history
  • Loading branch information
saleniuk committed Oct 15, 2024
1 parent 3c0c69f commit 32635d6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -177,12 +177,13 @@ fun previewConversationFoldersFlow(
list: List<ConversationFolderItem> = 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
Expand Down

0 comments on commit 32635d6

Please sign in to comment.