Skip to content

Commit

Permalink
Clean up optional intent handling based on code review
Browse files Browse the repository at this point in the history
  • Loading branch information
tcobbs-bentley committed Feb 29, 2024
1 parent f40e4c8 commit c53b934
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,14 @@ open class ITMOIDCAuthorizationClient(private val itmApplication: ITMApplication
return requireAuthService().getAuthorizationRequestIntent(authRequest)
}

private suspend fun launchRequestAuthorization(authState: AuthState): AccessToken {
val intent = getAuthorizationRequestIntent(authState) ?: return AccessToken()
return getAuthorizationResponse(intent).takeIf { result ->
result.resultCode == Activity.RESULT_OK
}?.data?.let {
handleAuthorizationResponse(it)
private suspend fun launchRequestAuthorization(authState: AuthState) =
getAuthorizationRequestIntent(authState)?.let { intent ->
getAuthorizationResponse(intent).takeIf { result ->
result.resultCode == Activity.RESULT_OK
}?.data?.let {
handleAuthorizationResponse(it)
}
} ?: AccessToken()
}

private suspend fun tryRefresh() = try {
authStateManager.current.performActionWithFreshTokens(requireAuthService())
Expand Down

0 comments on commit c53b934

Please sign in to comment.