From 963c63104e019a118bd4f612b6e0a250e7bb97ae Mon Sep 17 00:00:00 2001 From: Abdourahamane Boinaidi Date: Tue, 17 Dec 2024 14:05:42 +0100 Subject: [PATCH 1/9] feat: Add ApiEnvironment --- .../common/utils/ApiEnvironment.kt | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/utils/ApiEnvironment.kt diff --git a/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/utils/ApiEnvironment.kt b/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/utils/ApiEnvironment.kt new file mode 100644 index 00000000..12e7d827 --- /dev/null +++ b/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/utils/ApiEnvironment.kt @@ -0,0 +1,24 @@ +/* + * Infomaniak SwissTransfer - Multiplatform + * Copyright (C) 2024 Infomaniak Network SA + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.infomaniak.multiplatform_swisstransfer.common.utils + +sealed class ApiEnvironment(val baseUrl: String) { + data object Preprod : ApiEnvironment("https://swisstransfer.preprod.dev.infomaniak.ch") + data object Prod : ApiEnvironment("https://www.swisstransfer.com") + data class Custom(private val url: String) : ApiEnvironment(url) +} From a81c8de2cfe8f601892ee8c36f3b1798712da175 Mon Sep 17 00:00:00 2001 From: Abdourahamane Boinaidi Date: Tue, 17 Dec 2024 14:06:33 +0100 Subject: [PATCH 2/9] chore: Add apiBaseUrl function from ApiRoutes --- .../multiplatform_swisstransfer/network/utils/ApiRoutes.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/utils/ApiRoutes.kt b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/utils/ApiRoutes.kt index b6787329..57847ac2 100644 --- a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/utils/ApiRoutes.kt +++ b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/utils/ApiRoutes.kt @@ -17,13 +17,16 @@ */ package com.infomaniak.multiplatform_swisstransfer.network.utils +import com.infomaniak.multiplatform_swisstransfer.common.utils.ApiEnvironment + internal object ApiRoutes { - private const val PROD_URL = "https://www.swisstransfer.com" private const val PREPROD_BASE_URL = "https://swisstransfer.preprod.dev.infomaniak.ch" const val BASE_URL = PREPROD_BASE_URL const val API_BASE_URL = "$BASE_URL/api/" + fun apiBaseUrl(environment: ApiEnvironment) = "${environment.baseUrl}/api/" + //region Transfer fun getTransfer(linkUUID: String): String = "links/$linkUUID" //endRegion From 7d55b80f40ceb4a8c14f13c5e544fc101252c0df Mon Sep 17 00:00:00 2001 From: Abdourahamane Boinaidi Date: Tue, 17 Dec 2024 14:07:19 +0100 Subject: [PATCH 3/9] chore: Use ApiEnvironment in all repositories --- .../network/repositories/TransferRepository.kt | 9 ++++++--- .../network/repositories/UploadRepository.kt | 14 +++++++++----- .../network/requests/BaseRequest.kt | 9 +++++++-- .../network/requests/TransferRequest.kt | 7 ++++++- .../network/requests/UploadRequest.kt | 7 ++++++- 5 files changed, 34 insertions(+), 12 deletions(-) diff --git a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/repositories/TransferRepository.kt b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/repositories/TransferRepository.kt index 1e2e0833..8c4f88b9 100644 --- a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/repositories/TransferRepository.kt +++ b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/repositories/TransferRepository.kt @@ -18,6 +18,7 @@ package com.infomaniak.multiplatform_swisstransfer.network.repositories import com.infomaniak.multiplatform_swisstransfer.common.exceptions.UnknownException +import com.infomaniak.multiplatform_swisstransfer.common.utils.ApiEnvironment import com.infomaniak.multiplatform_swisstransfer.network.ApiClientProvider import com.infomaniak.multiplatform_swisstransfer.network.exceptions.ApiException import com.infomaniak.multiplatform_swisstransfer.network.exceptions.NetworkException @@ -32,13 +33,15 @@ import kotlin.coroutines.cancellation.CancellationException class TransferRepository internal constructor(private val transferRequest: TransferRequest) { // for Obj-C https://youtrack.jetbrains.com/issue/KT-68288/KMP-Support-Kotlin-default-parameters-into-Swift-default-parameters-and-Objective-C-somehow-possibly-a-JvmOverloads-like - constructor() : this(ApiClientProvider()) - constructor(apiClientProvider: ApiClientProvider = ApiClientProvider()) : this( + constructor(environment: ApiEnvironment) : this(ApiClientProvider(), environment) + constructor(apiClientProvider: ApiClientProvider = ApiClientProvider(), environment: ApiEnvironment) : this( + environment = environment, json = apiClientProvider.json, httpClient = apiClientProvider.httpClient, ) - internal constructor(json: Json, httpClient: HttpClient) : this(TransferRequest(json, httpClient)) + internal constructor(environment: ApiEnvironment, json: Json, httpClient: HttpClient) : + this(TransferRequest(environment, json, httpClient)) @Throws( CancellationException::class, diff --git a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/repositories/UploadRepository.kt b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/repositories/UploadRepository.kt index 1f58c66c..54911ad6 100644 --- a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/repositories/UploadRepository.kt +++ b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/repositories/UploadRepository.kt @@ -18,6 +18,7 @@ package com.infomaniak.multiplatform_swisstransfer.network.repositories import com.infomaniak.multiplatform_swisstransfer.common.exceptions.UnknownException +import com.infomaniak.multiplatform_swisstransfer.common.utils.ApiEnvironment import com.infomaniak.multiplatform_swisstransfer.network.ApiClientProvider import com.infomaniak.multiplatform_swisstransfer.network.exceptions.* import com.infomaniak.multiplatform_swisstransfer.network.exceptions.ContainerErrorsException.Companion.toContainerErrorsException @@ -39,13 +40,16 @@ import kotlin.coroutines.cancellation.CancellationException class UploadRepository internal constructor(private val uploadRequest: UploadRequest) { // for Obj-C https://youtrack.jetbrains.com/issue/KT-68288/KMP-Support-Kotlin-default-parameters-into-Swift-default-parameters-and-Objective-C-somehow-possibly-a-JvmOverloads-like - constructor() : this(ApiClientProvider()) - constructor(apiClientProvider: ApiClientProvider = ApiClientProvider()) : this( - apiClientProvider.json, - apiClientProvider.httpClient, + constructor(environment: ApiEnvironment) : this(ApiClientProvider(), environment) + constructor(apiClientProvider: ApiClientProvider = ApiClientProvider(), environment: ApiEnvironment) : this( + environment = environment, + json = apiClientProvider.json, + httpClient = apiClientProvider.httpClient, ) - internal constructor(json: Json, httpClient: HttpClient) : this(UploadRequest(json, httpClient)) + internal constructor(environment: ApiEnvironment, json: Json, httpClient: HttpClient) : this( + UploadRequest(environment, json, httpClient) + ) @Throws( CancellationException::class, diff --git a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/BaseRequest.kt b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/BaseRequest.kt index 4c80dd53..a5548246 100644 --- a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/BaseRequest.kt +++ b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/BaseRequest.kt @@ -18,6 +18,7 @@ package com.infomaniak.multiplatform_swisstransfer.network.requests import com.infomaniak.multiplatform_swisstransfer.common.exceptions.UnknownException +import com.infomaniak.multiplatform_swisstransfer.common.utils.ApiEnvironment import com.infomaniak.multiplatform_swisstransfer.network.exceptions.ApiException import com.infomaniak.multiplatform_swisstransfer.network.exceptions.NetworkException import com.infomaniak.multiplatform_swisstransfer.network.exceptions.UnexpectedApiErrorFormatException @@ -29,10 +30,14 @@ import io.ktor.client.statement.HttpResponse import io.ktor.http.* import kotlinx.serialization.json.Json -internal open class BaseRequest(protected val json: Json, protected val httpClient: HttpClient) { +internal open class BaseRequest( + private val environment: ApiEnvironment, + protected val json: Json, + protected val httpClient: HttpClient, +) { protected fun createUrl(path: String, vararg queries: Pair): Url { - val baseUrl = Url(ApiRoutes.API_BASE_URL + path) + val baseUrl = Url(ApiRoutes.apiBaseUrl(environment) + path) return URLBuilder(baseUrl).apply { queries.forEach { parameters.append(it.first, it.second) } }.build() diff --git a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/TransferRequest.kt b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/TransferRequest.kt index 35946e4e..126a26cb 100644 --- a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/TransferRequest.kt +++ b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/TransferRequest.kt @@ -17,6 +17,7 @@ */ package com.infomaniak.multiplatform_swisstransfer.network.requests +import com.infomaniak.multiplatform_swisstransfer.common.utils.ApiEnvironment import com.infomaniak.multiplatform_swisstransfer.network.models.ApiResponse import com.infomaniak.multiplatform_swisstransfer.network.models.transfer.TransferApi import com.infomaniak.multiplatform_swisstransfer.network.utils.ApiRoutes @@ -26,7 +27,11 @@ import kotlinx.serialization.json.Json import kotlin.io.encoding.Base64 import kotlin.io.encoding.ExperimentalEncodingApi -internal class TransferRequest(json: Json, httpClient: HttpClient) : BaseRequest(json, httpClient) { +internal class TransferRequest( + environment: ApiEnvironment, + json: Json, + httpClient: HttpClient, +) : BaseRequest(environment, json, httpClient) { @OptIn(ExperimentalEncodingApi::class) suspend fun getTransfer(linkUUID: String, password: String? = null): ApiResponse { diff --git a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/UploadRequest.kt b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/UploadRequest.kt index 7e0acd10..3608923f 100644 --- a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/UploadRequest.kt +++ b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/requests/UploadRequest.kt @@ -17,6 +17,7 @@ */ package com.infomaniak.multiplatform_swisstransfer.network.requests +import com.infomaniak.multiplatform_swisstransfer.common.utils.ApiEnvironment import com.infomaniak.multiplatform_swisstransfer.network.models.upload.request.FinishUploadBody import com.infomaniak.multiplatform_swisstransfer.network.models.upload.request.InitUploadBody import com.infomaniak.multiplatform_swisstransfer.network.models.upload.request.ResendEmailCodeBody @@ -38,7 +39,11 @@ import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonObject -internal class UploadRequest(json: Json, httpClient: HttpClient) : BaseRequest(json, httpClient) { +internal class UploadRequest( + environment: ApiEnvironment, + json: Json, + httpClient: HttpClient, +) : BaseRequest(environment, json, httpClient) { suspend fun initUpload( initUploadBody: InitUploadBody, From 1786bcb305121db731cdee7e847241bb7b8b23c3 Mon Sep 17 00:00:00 2001 From: Abdourahamane Boinaidi Date: Tue, 17 Dec 2024 14:08:16 +0100 Subject: [PATCH 4/9] feat: Custom api environment (preprod, prod or custom) --- .../multiplatform_swisstransfer/SwissTransferInjection.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/SwissTransferInjection.kt b/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/SwissTransferInjection.kt index 8875e994..f5765a7a 100644 --- a/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/SwissTransferInjection.kt +++ b/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/SwissTransferInjection.kt @@ -17,6 +17,7 @@ */ package com.infomaniak.multiplatform_swisstransfer +import com.infomaniak.multiplatform_swisstransfer.common.utils.ApiEnvironment import com.infomaniak.multiplatform_swisstransfer.database.RealmProvider import com.infomaniak.multiplatform_swisstransfer.database.controllers.* import com.infomaniak.multiplatform_swisstransfer.managers.* @@ -42,14 +43,15 @@ import com.infomaniak.multiplatform_swisstransfer.utils.EmailLanguageUtils * @property sharedApiUrlCreator An utils to help use shared routes. */ class SwissTransferInjection( + private val environment: ApiEnvironment, private val userAgent: String, ) { private val realmProvider by lazy { RealmProvider() } private val apiClientProvider by lazy { ApiClientProvider(userAgent) } - private val uploadRepository by lazy { UploadRepository(apiClientProvider) } - private val transferRepository by lazy { TransferRepository(apiClientProvider) } + private val uploadRepository by lazy { UploadRepository(apiClientProvider, environment) } + private val transferRepository by lazy { TransferRepository(apiClientProvider, environment) } private val appSettingsController by lazy { AppSettingsController(realmProvider) } private val emailTokensController by lazy { EmailTokensController(realmProvider) } From 434dcbe6b6fe6497ce8a26225be40ba9903e5b8e Mon Sep 17 00:00:00 2001 From: Abdourahamane Boinaidi Date: Tue, 17 Dec 2024 14:13:11 +0100 Subject: [PATCH 5/9] chore: Use environment in SharedApiUrlCreator --- .../multiplatform_swisstransfer/SharedApiUrlCreator.kt | 6 ++++-- .../multiplatform_swisstransfer/SwissTransferInjection.kt | 2 +- .../network/utils/SharedApiRoutes.kt | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/SharedApiUrlCreator.kt b/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/SharedApiUrlCreator.kt index 03b68efd..728aaaae 100644 --- a/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/SharedApiUrlCreator.kt +++ b/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/SharedApiUrlCreator.kt @@ -18,6 +18,7 @@ package com.infomaniak.multiplatform_swisstransfer import com.infomaniak.multiplatform_swisstransfer.common.exceptions.RealmException +import com.infomaniak.multiplatform_swisstransfer.common.utils.ApiEnvironment import com.infomaniak.multiplatform_swisstransfer.database.controllers.TransferController import com.infomaniak.multiplatform_swisstransfer.database.controllers.UploadController import com.infomaniak.multiplatform_swisstransfer.network.utils.SharedApiRoutes @@ -27,12 +28,13 @@ import kotlin.coroutines.cancellation.CancellationException * Utility class responsible for creating API URLs for shared routes. */ class SharedApiUrlCreator internal constructor( + private val environment: ApiEnvironment, private val transferController: TransferController, private val uploadController: UploadController, ) { - val createUploadContainerUrl: String = SharedApiRoutes.createUploadContainer + val createUploadContainerUrl: String = SharedApiRoutes.createUploadContainer(environment) - fun shareTransferUrl(transferUUID: String) = SharedApiRoutes.shareTransfer(transferUUID) + fun shareTransferUrl(transferUUID: String) = SharedApiRoutes.shareTransfer(environment, transferUUID) @Throws(RealmException::class, CancellationException::class) suspend fun downloadFilesUrl(transferUUID: String): String? { diff --git a/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/SwissTransferInjection.kt b/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/SwissTransferInjection.kt index f5765a7a..c2c6cbef 100644 --- a/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/SwissTransferInjection.kt +++ b/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/SwissTransferInjection.kt @@ -88,5 +88,5 @@ class SwissTransferInjection( val uploadManager by lazy { UploadManager(uploadController, uploadRepository, transferManager, emailLanguageUtils) } /** An utils to help use shared routes */ - val sharedApiUrlCreator by lazy { SharedApiUrlCreator(transferController, uploadController) } + val sharedApiUrlCreator by lazy { SharedApiUrlCreator(environment, transferController, uploadController) } } diff --git a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/utils/SharedApiRoutes.kt b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/utils/SharedApiRoutes.kt index 28da316e..a73f6f08 100644 --- a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/utils/SharedApiRoutes.kt +++ b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/utils/SharedApiRoutes.kt @@ -17,11 +17,13 @@ */ package com.infomaniak.multiplatform_swisstransfer.network.utils +import com.infomaniak.multiplatform_swisstransfer.common.utils.ApiEnvironment + object SharedApiRoutes { - const val createUploadContainer: String = "${ApiRoutes.API_BASE_URL}${ApiRoutes.initUpload}" + fun createUploadContainer(environment: ApiEnvironment): String = "${ApiRoutes.apiBaseUrl(environment)}${ApiRoutes.initUpload}" - fun shareTransfer(linkUUID: String): String = "${ApiRoutes.BASE_URL}/d/$linkUUID" + fun shareTransfer(environment: ApiEnvironment, linkUUID: String): String = "${environment.baseUrl}/d/$linkUUID" fun downloadFiles(downloadHost: String, linkUUID: String): String = "https://$downloadHost/api/download/$linkUUID" From a57a9a9e89270dddcd01b4c75e660dec31b5d9a7 Mon Sep 17 00:00:00 2001 From: Abdourahamane Boinaidi Date: Tue, 17 Dec 2024 14:13:35 +0100 Subject: [PATCH 6/9] chore: Remove useless const --- .../multiplatform_swisstransfer/network/utils/ApiRoutes.kt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/utils/ApiRoutes.kt b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/utils/ApiRoutes.kt index 57847ac2..a8625741 100644 --- a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/utils/ApiRoutes.kt +++ b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/utils/ApiRoutes.kt @@ -21,10 +21,6 @@ import com.infomaniak.multiplatform_swisstransfer.common.utils.ApiEnvironment internal object ApiRoutes { - private const val PREPROD_BASE_URL = "https://swisstransfer.preprod.dev.infomaniak.ch" - const val BASE_URL = PREPROD_BASE_URL - const val API_BASE_URL = "$BASE_URL/api/" - fun apiBaseUrl(environment: ApiEnvironment) = "${environment.baseUrl}/api/" //region Transfer From 39d543fb62c476e0df76a18e2375b684fc2d178b Mon Sep 17 00:00:00 2001 From: Abdourahamane Boinaidi Date: Tue, 17 Dec 2024 14:16:05 +0100 Subject: [PATCH 7/9] chore: Update SwissTransferInjection kDoc --- .../multiplatform_swisstransfer/SwissTransferInjection.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/SwissTransferInjection.kt b/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/SwissTransferInjection.kt index c2c6cbef..91172553 100644 --- a/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/SwissTransferInjection.kt +++ b/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/SwissTransferInjection.kt @@ -34,6 +34,7 @@ import com.infomaniak.multiplatform_swisstransfer.utils.EmailLanguageUtils * * This class serves as the main access point. * + * @property environment Customize client api base url, for example [ApiEnvironment.Prod] * @property userAgent Customize client api userAgent. * @property transferManager A manager used to orchestrate transfer operations. * @property appSettingsManager A manager used to orchestrate AppSettings operations. From 7728753052f3f32cf3ce9825078a10257ab61585 Mon Sep 17 00:00:00 2001 From: Abdourahamane Boinaidi Date: Tue, 17 Dec 2024 14:24:46 +0100 Subject: [PATCH 8/9] chore: Update TransferRepositoryTest --- .../network/TransferRepositoryTest.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/STNetwork/src/commonTest/kotlin/com/infomaniak/multiplatform_swisstransfer/network/TransferRepositoryTest.kt b/STNetwork/src/commonTest/kotlin/com/infomaniak/multiplatform_swisstransfer/network/TransferRepositoryTest.kt index c575e91f..1c7d9074 100644 --- a/STNetwork/src/commonTest/kotlin/com/infomaniak/multiplatform_swisstransfer/network/TransferRepositoryTest.kt +++ b/STNetwork/src/commonTest/kotlin/com/infomaniak/multiplatform_swisstransfer/network/TransferRepositoryTest.kt @@ -17,6 +17,7 @@ */ package com.infomaniak.multiplatform_swisstransfer.network +import com.infomaniak.multiplatform_swisstransfer.common.utils.ApiEnvironment import com.infomaniak.multiplatform_swisstransfer.network.models.ApiResponse import com.infomaniak.multiplatform_swisstransfer.network.models.transfer.TransferApi import com.infomaniak.multiplatform_swisstransfer.network.repositories.TransferRepository @@ -27,7 +28,7 @@ import kotlin.test.* class TransferRepositoryTest { private val apiClientProvider = ApiClientProvider() - private val transferRepository = TransferRepository(apiClientProvider) // TODO: Use mock client + private val transferRepository = TransferRepository(apiClientProvider, ApiEnvironment.Preprod) // TODO: Use mock client @Test fun canExtractLinkUUIDFromUrl() { From 6355f4f7d978757a87f4b6752855fa668ad87073 Mon Sep 17 00:00:00 2001 From: Abdourahamane Boinaidi Date: Tue, 17 Dec 2024 15:11:06 +0100 Subject: [PATCH 9/9] chore: Remove www --- .../multiplatform_swisstransfer/common/utils/ApiEnvironment.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/utils/ApiEnvironment.kt b/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/utils/ApiEnvironment.kt index 12e7d827..2965e160 100644 --- a/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/utils/ApiEnvironment.kt +++ b/STCommon/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/common/utils/ApiEnvironment.kt @@ -19,6 +19,6 @@ package com.infomaniak.multiplatform_swisstransfer.common.utils sealed class ApiEnvironment(val baseUrl: String) { data object Preprod : ApiEnvironment("https://swisstransfer.preprod.dev.infomaniak.ch") - data object Prod : ApiEnvironment("https://www.swisstransfer.com") + data object Prod : ApiEnvironment("https://swisstransfer.com") data class Custom(private val url: String) : ApiEnvironment(url) }