From 86edab2fba0f52d2200ffb96f836e1666c41a0e2 Mon Sep 17 00:00:00 2001 From: lalwani Date: Mon, 23 Dec 2024 10:08:19 -0800 Subject: [PATCH] spotless --- .../uber/sdk2/auth/internal/AuthActivity.kt | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/authentication/src/main/kotlin/com/uber/sdk2/auth/internal/AuthActivity.kt b/authentication/src/main/kotlin/com/uber/sdk2/auth/internal/AuthActivity.kt index f3d65d1..d0a6383 100644 --- a/authentication/src/main/kotlin/com/uber/sdk2/auth/internal/AuthActivity.kt +++ b/authentication/src/main/kotlin/com/uber/sdk2/auth/internal/AuthActivity.kt @@ -91,18 +91,24 @@ class AuthActivity : AppCompatActivity() { } private fun handleResponse(uri: Uri) { - val authCode = uri.getQueryParameter(KEY_AUTHENTICATION_CODE) - ?: uri.fragment?.takeIf { it.isNotEmpty() } - ?.let { Uri.Builder().encodedQuery(it).build().getQueryParameter(KEY_AUTHENTICATION_CODE) } - ?: "" + val authCode = + uri.getQueryParameter(KEY_AUTHENTICATION_CODE) + ?: uri.fragment + ?.takeIf { it.isNotEmpty() } + ?.let { + Uri.Builder().encodedQuery(it).build().getQueryParameter(KEY_AUTHENTICATION_CODE) + } + ?: "" if (authCode.isNotEmpty()) { authProvider?.handleAuthCode(authCode) } else { - val error = uri.getQueryParameter(KEY_ERROR) - ?: uri.fragment?.takeIf { it.isNotEmpty() } - ?.let { Uri.Builder().encodedQuery(it).build().getQueryParameter(KEY_ERROR) } - ?: CANCELED + val error = + uri.getQueryParameter(KEY_ERROR) + ?: uri.fragment + ?.takeIf { it.isNotEmpty() } + ?.let { Uri.Builder().encodedQuery(it).build().getQueryParameter(KEY_ERROR) } + ?: CANCELED finishAuthWithError(error) } }