Skip to content

Commit

Permalink
feat: Update with list extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
sirambd authored and tevincent committed Oct 17, 2024
1 parent 1a39aad commit 979ddec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package com.infomaniak.multiplatform_swisstransfer.common.interfaces.ui

import com.infomaniak.multiplatform_swisstransfer.common.interfaces.transfers.Transfer
import com.infomaniak.multiplatform_swisstransfer.common.utils.DateUtils
import com.infomaniak.multiplatform_swisstransfer.common.utils.mapToList

data class TransferUi(
val uuid: String,
Expand All @@ -40,6 +41,6 @@ data class TransferUi(
downloadLimit = transfer.container?.downloadLimit ?: 0,
downloadLeft = transfer.downloadCounterCredit,
message = transfer.container?.message,
files = transfer.container?.files?.mapTo(mutableListOf()) { FileUi(it) } ?: emptyList()
files = transfer.container?.files?.mapToList { FileUi(it) } ?: emptyList()
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import com.infomaniak.multiplatform_swisstransfer.common.exceptions.UnknownExcep
import com.infomaniak.multiplatform_swisstransfer.common.interfaces.transfers.Transfer
import com.infomaniak.multiplatform_swisstransfer.common.interfaces.ui.TransferUi
import com.infomaniak.multiplatform_swisstransfer.common.models.TransferDirection
import com.infomaniak.multiplatform_swisstransfer.common.utils.mapToList
import com.infomaniak.multiplatform_swisstransfer.database.controllers.TransferController
import com.infomaniak.multiplatform_swisstransfer.network.ApiClientProvider
import com.infomaniak.multiplatform_swisstransfer.network.exceptions.ApiException
Expand Down Expand Up @@ -67,7 +68,7 @@ class TransferManager internal constructor(
@Throws(RealmException::class)
fun getTransfers(transferDirection: TransferDirection): Flow<List<TransferUi>> {
return transferController.getTransfersFlow(transferDirection)
.map { it.mapTo(mutableListOf()) { transfer -> TransferUi(transfer) } }
.map { it.mapToList { transfer -> TransferUi(transfer) } }
.flowOn(Dispatchers.IO)
}

Expand Down

0 comments on commit 979ddec

Please sign in to comment.