diff --git a/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/managers/EmailTokensManager.kt b/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/managers/EmailTokensManager.kt index 1199ee06..16860efc 100644 --- a/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/managers/EmailTokensManager.kt +++ b/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/managers/EmailTokensManager.kt @@ -19,7 +19,6 @@ package com.infomaniak.multiplatform_swisstransfer.managers import com.infomaniak.multiplatform_swisstransfer.common.exceptions.RealmException import com.infomaniak.multiplatform_swisstransfer.database.controllers.EmailTokensController -import com.infomaniak.multiplatform_swisstransfer.network.models.upload.response.AuthorEmailToken import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.IO import kotlinx.coroutines.withContext @@ -46,13 +45,13 @@ class EmailTokensManager(private val emailTokensController: EmailTokensControlle * Asynchronously sets the email and it's corresponding token. * * @param email The validated email. - * @param authorEmailToken The valid token associated to the email. + * @param emailToken The valid token associated to the email. * * @throws RealmException If an error occurs during database access. * @throws CancellationException If the operation is cancelled. */ @Throws(RealmException::class, CancellationException::class) - suspend fun setEmailToken(email: String, authorEmailToken: AuthorEmailToken): Unit = withContext(Dispatchers.IO) { - emailTokensController.setEmailToken(email, authorEmailToken.token) + suspend fun setEmailToken(email: String, emailToken: String): Unit = withContext(Dispatchers.IO) { + emailTokensController.setEmailToken(email, emailToken) } } diff --git a/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/managers/UploadManager.kt b/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/managers/UploadManager.kt index 09043604..4d358f30 100644 --- a/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/managers/UploadManager.kt +++ b/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/managers/UploadManager.kt @@ -113,19 +113,19 @@ class UploadManager( * Stores the email address token in DB for future uses and updates the * current uploadSession stored in DB with this new email address token. * - * @param authorEmail The email to which the [authorEmailToken] is associated with. - * @param authorEmailToken The token returned by the API that proves the user owns [authorEmail]. + * @param authorEmail The email to which the [emailToken] is associated with. + * @param emailToken The token returned by the API that proves the user owns [authorEmail]. * * @throws RealmException If an error occurs during database access. * @throws CancellationException If the operation is cancelled. * @throws NotFoundException If we can't find any upload to update. */ @Throws(RealmException::class, CancellationException::class, NotFoundException::class) - suspend fun updateAuthorEmailToken(authorEmail: String, authorEmailToken: AuthorEmailToken) { - emailTokensManager.setEmailToken(authorEmail, authorEmailToken) + suspend fun updateAuthorEmailToken(authorEmail: String, emailToken: String) { + emailTokensManager.setEmailToken(authorEmail, emailToken) runCatching { - uploadController.updateLastUploadSessionAuthorEmailToken(authorEmailToken.token) + uploadController.updateLastUploadSessionAuthorEmailToken(emailToken) }.onFailure { when (it) { is NoSuchElementException -> throw NotFoundException(it.message ?: "")