mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 03:07:25 +01:00
Fix Kitsu toasting "Logged in" when there is an error (#4329)
This commit is contained in:
parent
837d8f5f30
commit
2a5102a457
@ -101,14 +101,10 @@ class Kitsu(private val context: Context, id: Int) : TrackService(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun login(username: String, password: String) {
|
override suspend fun login(username: String, password: String) {
|
||||||
try {
|
val token = api.login(username, password)
|
||||||
val token = api.login(username, password)
|
interceptor.newAuth(token)
|
||||||
interceptor.newAuth(token)
|
val userId = api.getCurrentUser()
|
||||||
val userId = api.getCurrentUser()
|
saveCredentials(username, userId)
|
||||||
saveCredentials(username, userId)
|
|
||||||
} catch (e: Throwable) {
|
|
||||||
logout()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun logout() {
|
override fun logout() {
|
||||||
|
@ -48,6 +48,7 @@ class TrackLoginDialog(
|
|||||||
dialog?.dismiss()
|
dialog?.dismiss()
|
||||||
withUIContext { view?.context?.toast(R.string.login_success) }
|
withUIContext { view?.context?.toast(R.string.login_success) }
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
|
service.logout()
|
||||||
binding?.login?.progress = -1
|
binding?.login?.progress = -1
|
||||||
binding?.login?.setText(R.string.unknown_error)
|
binding?.login?.setText(R.string.unknown_error)
|
||||||
withUIContext { e.message?.let { view?.context?.toast(it) } }
|
withUIContext { e.message?.let { view?.context?.toast(it) } }
|
||||||
|
Loading…
Reference in New Issue
Block a user