Skip to content

Commit

Permalink
refactor: Take an AuthorEmailToken instead of a String
Browse files Browse the repository at this point in the history
  • Loading branch information
LunarX committed Dec 18, 2024
1 parent 77f206b commit 3bf30df
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ 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
Expand All @@ -45,13 +46,13 @@ class EmailTokensManager(private val emailTokensController: EmailTokensControlle
* Asynchronously sets the email and it's corresponding token.
*
* @param email The validated email.
* @param token The valid token associated to the email.
* @param authorEmailToken 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, token: String): Unit = withContext(Dispatchers.IO) {
emailTokensController.setEmailToken(email, token)
suspend fun setEmailToken(email: String, authorEmailToken: AuthorEmailToken): Unit = withContext(Dispatchers.IO) {
emailTokensController.setEmailToken(email, authorEmailToken.token)
}
}

0 comments on commit 3bf30df

Please sign in to comment.