Skip to content

Commit

Permalink
detekt
Browse files Browse the repository at this point in the history
  • Loading branch information
saleniuk committed Nov 7, 2024
1 parent 9b606ca commit 1986b83
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* along with this program. If not, see http://www.gnu.org/licenses/.
*/

@file:Suppress("TooManyFunctions")

package com.wire.android.ui.home.conversations.search

import androidx.compose.animation.AnimatedContent
Expand Down Expand Up @@ -282,28 +284,68 @@ fun PreviewShowButton() {
@PreviewMultipleThemes
@Composable
fun PreviewSearchAllPeopleScreen_Loading() = WireTheme {
SearchAllPeopleScreen("Search query", persistentListOf(), persistentListOf(), persistentSetOf(), true, false, ItemActionType.CHECK, { _, _ -> }, {})
SearchAllPeopleScreen(
searchQuery = "",
contactsSearchResult = persistentListOf(),
publicSearchResult = persistentListOf(),
contactsAddedToGroup = persistentSetOf(),
isLoading = true,
isSearchActive = false,
actionType = ItemActionType.CHECK,
onChecked = { _, _ -> },
onOpenUserProfile = {}
)
}

@PreviewMultipleThemes
@Composable
fun PreviewSearchAllPeopleScreen_InitialResults() = WireTheme {
val contacts = previewContactsList(count = 10, startIndex = 0, isContact = true).toPersistentList()
SearchAllPeopleScreen("", contacts, persistentListOf(), persistentSetOf(), false, false, ItemActionType.CHECK, { _, _ -> }, {})
SearchAllPeopleScreen(
searchQuery = "",
contactsSearchResult = contacts,
publicSearchResult = persistentListOf(),
contactsAddedToGroup = persistentSetOf(),
isLoading = false,
isSearchActive = false,
actionType = ItemActionType.CHECK,
onChecked = { _, _ -> },
onOpenUserProfile = {}
)
}

@PreviewMultipleThemes
@Composable
fun PreviewSearchAllPeopleScreen_EmptyInitialResults() = WireTheme {
SearchAllPeopleScreen("", persistentListOf(), persistentListOf(), persistentSetOf(), false, false, ItemActionType.CHECK, { _, _ -> }, {})
SearchAllPeopleScreen(
searchQuery = "",
contactsSearchResult = persistentListOf(),
publicSearchResult = persistentListOf(),
contactsAddedToGroup = persistentSetOf(),
isLoading = false,
isSearchActive = false,
actionType = ItemActionType.CHECK,
onChecked = { _, _ -> },
onOpenUserProfile = {}
)
}

@PreviewMultipleThemes
@Composable
fun PreviewSearchAllPeopleScreen_SearchResults_TypeClick() = WireTheme {
val contacts = previewContactsList(count = 10, startIndex = 0, isContact = true).toPersistentList()
val public = previewContactsList(count = 10, startIndex = 10, isContact = false).toPersistentList()
SearchAllPeopleScreen("Con", contacts, public, persistentSetOf(), false, true, ItemActionType.CLICK, { _, _ -> }, {})
SearchAllPeopleScreen(
searchQuery = "Con",
contactsSearchResult = contacts,
publicSearchResult = public,
contactsAddedToGroup = persistentSetOf(),
isLoading = false,
isSearchActive = true,
actionType = ItemActionType.CLICK,
onChecked = { _, _ -> },
onOpenUserProfile = {}
)
}

@PreviewMultipleThemes
Expand All @@ -312,13 +354,33 @@ fun PreviewSearchAllPeopleScreen_SearchResults_TypeCheck() = WireTheme {
val contacts = previewContactsList(count = 10, startIndex = 0, isContact = true).toPersistentList()
val public = previewContactsList(count = 10, startIndex = 10, isContact = false).toPersistentList()
val selectedContacts = contacts.filterIndexed { index, _ -> index % 3 == 0 }.toPersistentSet()
SearchAllPeopleScreen("Con", contacts, public, selectedContacts, false, true, ItemActionType.CHECK, { _, _ -> }, {})
SearchAllPeopleScreen(
searchQuery = "Con",
contactsSearchResult = contacts,
publicSearchResult = public,
contactsAddedToGroup = selectedContacts,
isLoading = false,
isSearchActive = true,
actionType = ItemActionType.CHECK,
onChecked = { _, _ -> },
onOpenUserProfile = {}
)
}

@PreviewMultipleThemes
@Composable
fun PreviewSearchAllPeopleScreen_EmptySearchResults() = WireTheme {
SearchAllPeopleScreen("Con", persistentListOf(), persistentListOf(), persistentSetOf(), false, true, ItemActionType.CLICK, { _, _ -> }, {})
SearchAllPeopleScreen(
searchQuery = "Con",
contactsSearchResult = persistentListOf(),
publicSearchResult = persistentListOf(),
contactsAddedToGroup = persistentSetOf(),
isLoading = false,
isSearchActive = true,
actionType = ItemActionType.CLICK,
onChecked = { _, _ -> },
onOpenUserProfile = {}
)
}

private fun previewContact(index: Int, isContact: Boolean) = Contact(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,6 @@ private fun previewService(index: Int) = Contact(
membership = Membership.Service,
)

private fun previewServiceList(count: Int): List<Contact> = buildList { repeat(count) { index -> add(previewService(index)) } }
private fun previewServiceList(count: Int): List<Contact> = buildList {
repeat(count) { index -> add(previewService(index)) }
}

0 comments on commit 1986b83

Please sign in to comment.