Skip to content

Commit

Permalink
spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
lalwani committed Dec 23, 2024
1 parent 43ed8c4 commit 86edab2
Showing 1 changed file with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 86edab2

Please sign in to comment.