From 244fab35fdadcdd8e798cec936816ffbcc673e21 Mon Sep 17 00:00:00 2001 From: alexandreferris Date: Wed, 13 Dec 2023 16:49:36 +0100 Subject: [PATCH] chore: adjust naming of extension functions --- .../main/kotlin/com/wire/android/ui/common/Extensions.kt | 4 ++-- .../ui/home/conversations/media/ImageAssetsContent.kt | 4 ++-- .../usecase/GetAssetMessagesFromConversationUseCase.kt | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/common/Extensions.kt b/app/src/main/kotlin/com/wire/android/ui/common/Extensions.kt index e6ca907ab1d..3b4a3287fe9 100644 --- a/app/src/main/kotlin/com/wire/android/ui/common/Extensions.kt +++ b/app/src/main/kotlin/com/wire/android/ui/common/Extensions.kt @@ -170,12 +170,12 @@ private fun monthYearHeader(month: Int, year: Int): String { } } -fun List.toGroupedByMonthAndYear(timeZone: TimeZone) = this.groupBy { asset -> +fun List.toImageAssetGroupedByMonthAndYear(timeZone: TimeZone) = this.groupBy { asset -> val localDateTime = asset.time.toLocalDateTime(timeZone) monthYearHeader(year = localDateTime.year, month = localDateTime.monthNumber) } -fun List.toGroupedByMonthAndYear(timeZone: TimeZone) = this.groupBy { message -> +fun List.toGenericAssetGroupedByMonthAndYear(timeZone: TimeZone) = this.groupBy { message -> val localDateTime = message.date.toInstant().toLocalDateTime(timeZone) monthYearHeader(year = localDateTime.year, month = localDateTime.monthNumber) } diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/media/ImageAssetsContent.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/media/ImageAssetsContent.kt index f51017c8956..387f5db41c5 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/media/ImageAssetsContent.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/media/ImageAssetsContent.kt @@ -39,7 +39,7 @@ import androidx.compose.ui.Modifier import com.wire.android.model.Clickable import com.wire.android.ui.common.colorsScheme import com.wire.android.ui.common.dimensions -import com.wire.android.ui.common.toGroupedByMonthAndYear +import com.wire.android.ui.common.toImageAssetGroupedByMonthAndYear import com.wire.android.ui.home.conversations.model.MediaAssetImage import com.wire.android.ui.home.conversations.model.messagetypes.asset.UIAssetMessage import com.wire.android.ui.home.conversationslist.common.FolderHeader @@ -63,7 +63,7 @@ fun ImageAssetGrid( ) { val timeZone = remember { TimeZone.currentSystemDefault() } val groupedAssets = remember(uiAssetMessageList) { - uiAssetMessageList.toGroupedByMonthAndYear(timeZone = timeZone) + uiAssetMessageList.toImageAssetGroupedByMonthAndYear(timeZone = timeZone) } val scrollState = rememberLazyGridState() diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/usecase/GetAssetMessagesFromConversationUseCase.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/usecase/GetAssetMessagesFromConversationUseCase.kt index 4e34eebc3f7..a16953bcc4e 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/usecase/GetAssetMessagesFromConversationUseCase.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/usecase/GetAssetMessagesFromConversationUseCase.kt @@ -18,7 +18,7 @@ package com.wire.android.ui.home.conversations.usecase import com.wire.android.mapper.MessageMapper -import com.wire.android.ui.common.toGroupedByMonthAndYear +import com.wire.android.ui.common.toGenericAssetGroupedByMonthAndYear import com.wire.android.ui.home.conversations.model.UIMessage import com.wire.android.util.dispatchers.DispatcherProvider import com.wire.kalium.logic.data.id.ConversationId @@ -51,9 +51,9 @@ class GetAssetMessagesFromConversationUseCase @Inject constructor( conversationId = conversationId, limit = 35, offset = 0 - ).let { + ).let { assetMessageList -> val timeZone = TimeZone.currentSystemDefault() - it.toGroupedByMonthAndYear(timeZone = timeZone) + assetMessageList.toGenericAssetGroupedByMonthAndYear(timeZone = timeZone) }.map { val values: List = it.value.map { message ->