Skip to content

Commit

Permalink
feat: Update verifyEmailCode call to new kmp version
Browse files Browse the repository at this point in the history
  • Loading branch information
LunarX committed Dec 18, 2024
1 parent 4a13692 commit e776e53
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.infomaniak.multiplatform_swisstransfer.managers.UploadManager
import com.infomaniak.multiplatform_swisstransfer.network.exceptions.EmailValidationException
import com.infomaniak.multiplatform_swisstransfer.network.models.upload.request.VerifyEmailCodeBody
import com.infomaniak.multiplatform_swisstransfer.network.repositories.UploadRepository
import com.infomaniak.swisstransfer.di.IoDispatcher
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.CoroutineDispatcher
Expand All @@ -37,8 +35,6 @@ class ValidateUserEmailViewModel @Inject constructor(
private val uploadManager: UploadManager
) : ViewModel() {

private val uploadRepository: UploadRepository by lazy { UploadRepository() }

private val _uiState = MutableStateFlow(ValidateEmailUiState.Default)
val uiState = _uiState.asStateFlow()

Expand All @@ -47,7 +43,7 @@ class ValidateUserEmailViewModel @Inject constructor(
_uiState.value = ValidateEmailUiState.Loading

runCatching {
uploadRepository.verifyEmailCode(VerifyEmailCodeBody(otpCode, email))
uploadManager.verifyEmailCode(otpCode, email)
}.onFailure {
when (it) {
is EmailValidationException.InvalidPasswordException -> _uiState.value = ValidateEmailUiState.Error
Expand Down

0 comments on commit e776e53

Please sign in to comment.