From 3ab9602865073a5dbb47e45be6484063021e5e2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Mon, 17 Oct 2022 16:06:13 +0200 Subject: [PATCH] [API/Usos] Fix re-logging in after user action. --- .../data/api/edziennik/usos/login/UsosLoginApi.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/usos/login/UsosLoginApi.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/usos/login/UsosLoginApi.kt index 11172d7d..06651477 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/usos/login/UsosLoginApi.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/usos/login/UsosLoginApi.kt @@ -10,10 +10,7 @@ import pl.szczodrzynski.edziennik.data.api.edziennik.usos.DataUsos import pl.szczodrzynski.edziennik.data.api.edziennik.usos.data.UsosApi import pl.szczodrzynski.edziennik.data.api.events.UserActionRequiredEvent import pl.szczodrzynski.edziennik.data.api.models.ApiError -import pl.szczodrzynski.edziennik.ext.Bundle -import pl.szczodrzynski.edziennik.ext.fromQueryString -import pl.szczodrzynski.edziennik.ext.toBundle -import pl.szczodrzynski.edziennik.ext.toQueryString +import pl.szczodrzynski.edziennik.ext.* import pl.szczodrzynski.edziennik.utils.Utils.d class UsosLoginApi(val data: DataUsos, val onSuccess: () -> Unit) { @@ -25,6 +22,9 @@ class UsosLoginApi(val data: DataUsos, val onSuccess: () -> Unit) { init { run { + data.arguments?.getString("oauthLoginResponse")?.let { + data.oauthLoginResponse = it + } if (data.isApiLoginValid()) { onSuccess() } else if (data.oauthLoginResponse != null) { @@ -36,6 +36,8 @@ class UsosLoginApi(val data: DataUsos, val onSuccess: () -> Unit) { } private fun authorize() { + data.oauthTokenKey = null + data.oauthTokenSecret = null api.apiRequest( tag = TAG, service = "oauth/request_token",