Created
December 5, 2018 08:13
-
-
Save AlexGladkov/0330671a0d1b8c436f3365f6da0d3561 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.reactivex.Observable | |
import io.reactivex.Single | |
import ru.sddhelp.base.BaseConverter | |
import ru.sddhelp.data.providers.models.ApiLogin | |
import ru.sddhelp.data.providers.models.ApiPhone | |
import ru.sddhelp.data.providers.models.ApiResponse | |
import ru.sddhelp.data.providers.services.RemoteLoginService | |
import javax.inject.Inject | |
/** | |
* Created by agladkov on 02.03.18. | |
*/ | |
class LoginProviderImpl(private val remoteLoginService: RemoteLoginService): LoginProvider { | |
override fun sendPhone(phone: String, campaign: String): Observable<ApiResponse<ApiPhone?>> { | |
return remoteLoginService.sendPhone(phone = phone, campaign = campaign) | |
.map { BaseConverter.convertGsonResponse<ApiPhone>(it) } | |
} | |
override fun getToken(login: String, password: String, type: String): Observable<ApiResponse<ApiLogin?>> { | |
return remoteLoginService.getToken(login = login, password = password, type = type) | |
.map { BaseConverter.convertGsonResponse<ApiLogin>(it) } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment