Skip to content

Commit

Permalink
chore: adjust naming of extension functions
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandreferris committed Dec 13, 2023
1 parent 9e7028e commit 244fab3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/src/main/kotlin/com/wire/android/ui/common/Extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@ private fun monthYearHeader(month: Int, year: Int): String {
}
}

fun List<UIAssetMessage>.toGroupedByMonthAndYear(timeZone: TimeZone) = this.groupBy { asset ->
fun List<UIAssetMessage>.toImageAssetGroupedByMonthAndYear(timeZone: TimeZone) = this.groupBy { asset ->
val localDateTime = asset.time.toLocalDateTime(timeZone)
monthYearHeader(year = localDateTime.year, month = localDateTime.monthNumber)
}

fun List<Message.Standalone>.toGroupedByMonthAndYear(timeZone: TimeZone) = this.groupBy { message ->
fun List<Message.Standalone>.toGenericAssetGroupedByMonthAndYear(timeZone: TimeZone) = this.groupBy { message ->
val localDateTime = message.date.toInstant().toLocalDateTime(timeZone)
monthYearHeader(year = localDateTime.year, month = localDateTime.monthNumber)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<UIMessage> = it.value.map { message ->
Expand Down

0 comments on commit 244fab3

Please sign in to comment.