From 7d5fc95f0cfef211c3223ab7bf806f39d70d98f4 Mon Sep 17 00:00:00 2001 From: Vincent TE Date: Wed, 27 Nov 2024 11:21:28 +0100 Subject: [PATCH] chore: Remove mock method --- .../main/transfers/TransfersViewModel.kt | 74 ------------------- settings.gradle.kts | 2 +- 2 files changed, 1 insertion(+), 75 deletions(-) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transfers/TransfersViewModel.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transfers/TransfersViewModel.kt index cfd0d03a5..5686ebe21 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transfers/TransfersViewModel.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transfers/TransfersViewModel.kt @@ -23,9 +23,6 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.infomaniak.multiplatform_swisstransfer.common.models.TransferDirection import com.infomaniak.multiplatform_swisstransfer.managers.TransferManager -import com.infomaniak.multiplatform_swisstransfer.network.models.transfer.ContainerApi -import com.infomaniak.multiplatform_swisstransfer.network.models.transfer.FileApi -import com.infomaniak.multiplatform_swisstransfer.network.models.transfer.TransferApi import com.infomaniak.sentry.SentryLog import com.infomaniak.swisstransfer.di.IoDispatcher import dagger.hilt.android.lifecycle.HiltViewModel @@ -52,77 +49,6 @@ class TransfersViewModel @Inject constructor( val selectedTransferUuids: SnapshotStateMap = mutableStateMapOf() - init { - //TODO Remove that when we'll have real transfers - viewModelScope.launch { - transferManager.removeAllTransfer() - val files = listOf( - generateFileApi(fileName = "file1.txt", path = ""), - generateFileApi(fileName = "file2.txt", path = ""), - generateFileApi(fileName = "file3_in_folder1.txt", path = "folder1"), - generateFileApi(fileName = "file3_in_folder2.txt", path = "folder2"), - generateFileApi(fileName = "file3_in_folder1_folder2.txt", path = "folder1/folder2/folder1") - ) - val containerApi = generateContainerApi(files) - transferManager.addDummyTransfer( - transfer = generateTransferApi(containerApi), - transferDirection = TransferDirection.RECEIVED - ) - } - } - //checker containerUUid dossier - - private fun generateTransferApi(containerApi: ContainerApi): TransferApi { - return TransferApi( - linkUUID = "dummy1", - containerUUID = "container1", - downloadCounterCredit = 100, - createdDateTimestamp = System.currentTimeMillis(), - expiredDateTimestamp = System.currentTimeMillis(), - hasBeenDownloadedOneTime = false, - isMailSent = false, - downloadHost = "", - container = containerApi, - ) - } - - private fun generateContainerApi(files: List): ContainerApi { - return ContainerApi( - uuid = "container1", - duration = 0L, - createdDateTimestamp = 0L, - expiredDateTimestamp = 0L, - numberOfFiles = 2, - message = null, - needPassword = false, - language = "", - sizeUploaded = 0L, - deletedDateTimestamp = null, - swiftVersion = 0, - downloadLimit = 0, - source = "ST", - files = files, - ) - } - - private fun generateFileApi(fileName: String, path: String): FileApi { - return FileApi().apply { - uuid = fileName - containerUUID = "container1" - this.fileName = fileName - fileSizeInBytes = 5000000L - downloadCounter = 0 - createdDateTimestamp = System.currentTimeMillis() - expiredDateTimestamp = System.currentTimeMillis() - eVirus = "" - deletedDate = null - mimeType = null - receivedSizeInBytes = 5000000L - this.path = path - thumbnailPath = null - } - } - fun fetchPendingTransfers() { viewModelScope.launch(ioDispatcher) { runCatching { diff --git a/settings.gradle.kts b/settings.gradle.kts index bbb4647c8..5e9ac91e7 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -17,7 +17,7 @@ dependencyResolutionManagement { @Suppress("UnstableApiUsage") repositories { google() - mavenLocal() // TODO: Do not put this in production + // mavenLocal() // TODO: Do not put this in production mavenCentral() maven { url = uri("https://jitpack.io") } }