Skip to content

Commit

Permalink
refactor: Update kDoc and add Dispatches.IO
Browse files Browse the repository at this point in the history
  • Loading branch information
sirambd committed Oct 10, 2024
1 parent b729722 commit 7dbd102
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import com.infomaniak.multiplatform_swisstransfer.network.repositories.TransferR
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.IO
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.withContext
import kotlin.coroutines.cancellation.CancellationException

/**
Expand All @@ -39,8 +40,9 @@ import kotlin.coroutines.cancellation.CancellationException
* smooth and efficient data transfers, providing a centralized management point
* for transfer-related activities.
*
* @property realmProvider The provider for managing Realm database operations.
* @property clientProvider The provider for creating and configuring HTTP clients for API communication.
* @property transferController The provider for transfer data from database.
* @property transferRepository The provider for transfer data from api.
*/
class TransferManager internal constructor(
private val clientProvider: ApiClientProvider,
Expand All @@ -57,7 +59,7 @@ class TransferManager internal constructor(
NetworkException::class,
UnknownException::class,
)
suspend fun addTransferByLinkUuid(linkUuid: String) {
suspend fun addTransferByLinkUuid(linkUuid: String) = withContext(Dispatchers.IO) {
addTransfer(transferRepository.getTransferByLinkUuid(linkUuid).data)
}

Expand All @@ -68,7 +70,7 @@ class TransferManager internal constructor(
NetworkException::class,
UnknownException::class,
)
suspend fun addTransferByUrl(url: String) {
suspend fun addTransferByUrl(url: String) = withContext(Dispatchers.IO) {
addTransfer(transferRepository.getTransferByUrl(url).data)
}

Expand Down

0 comments on commit 7dbd102

Please sign in to comment.