Commit ee5ee290 authored by Eugene Shapovalov's avatar Eugene Shapovalov 💬

Resolve discussion comments.

parent 8ea9c7e7
......@@ -62,13 +62,14 @@ class AuthInteractor(
}
}
fun login(customServerPath: String, privateToken: String) = Completable.fromAction {
var serverPath = customServerPath
if (!customServerPath.endsWith("/")) serverPath += "/"
fun login(customServerPath: String, privateToken: String) =
Completable.fromAction {
var serverPath = customServerPath
if (!customServerPath.endsWith("/")) serverPath += "/"
authRepository.saveAuthData(privateToken, serverPath, false)
switchServerIfNeeded(customServerPath)
}
authRepository.saveAuthData(privateToken, serverPath, false)
switchServerIfNeeded(serverPath)
}
fun logout() {
authRepository.clearAuthData()
......
......@@ -38,7 +38,7 @@ class CustomServerAuthFragment : BottomSheetDialogFragment() {
}
privateTokenValue.setOnEditorActionListener { _, actionId, _ ->
return@setOnEditorActionListener if (actionId == EditorInfo.IME_ACTION_DONE) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
login()
true
} else {
......@@ -59,7 +59,7 @@ class CustomServerAuthFragment : BottomSheetDialogFragment() {
}
if (URLUtil.isValidUrl(url)) {
listener.customLogin.invoke(if (url.endsWith("/")) url else "$url/", token)
listener.customLogin.invoke(url, token)
dismiss()
} else {
Toast.makeText(this.context, getString(R.string.invalid_server_url), Toast.LENGTH_SHORT).show()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment