Skip to content

Instantly share code, notes, and snippets.

@alexeenkoff
Created February 21, 2018 14:46
Show Gist options
  • Save alexeenkoff/79a1bc29922c8465238ac3fbfc0eebd5 to your computer and use it in GitHub Desktop.
Save alexeenkoff/79a1bc29922c8465238ac3fbfc0eebd5 to your computer and use it in GitHub Desktop.
package com.kaspersky.security_pulse_android.buisness.interactor
import com.kaspersky.security_pulse_android.buisness.repository.ILanguageRepository
import com.kaspersky.security_pulse_android.buisness.repository.ILoginRepository
import kotlinx.coroutines.experimental.async
import java.util.*
class LoginInteractor(private val languageRepository: ILanguageRepository,
private val loginRepository: ILoginRepository) : ILoginInteractor {
override suspend fun skipAuthLogin() {
val uuid = UUID.randomUUID().toString()
val systemLanguage = Locale.getDefault().language
val languages = async { languageRepository.getLanguages() }.await()
val actualLanguage = languages.find { it.code == systemLanguage }
actualLanguage?.let {
return async { loginRepository.loginWithDeviceUuid(uuid, it.id) }.await()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment