Skip to content

Commit

Permalink
Merge pull request #4 from GitLiveApp/ios-context-missing
Browse files Browse the repository at this point in the history
Added fix for ios, was missing context for token request
  • Loading branch information
nbransby authored Dec 13, 2022
2 parents b7d6a79 + c56e981 commit 36bc4f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ signing.keyId=""
signing.password=""

MODULE_PACKAGE_NAME=dev.gitlive
MODULE_VERSION_NUMBER=0.0.1
MODULE_VERSION_NUMBER=0.0.3
MODULE_NAME=appauth-kotlin

OPEN_SOURCE_REPO=https://oss.sonatype.org/service/local/staging/deploy/maven2/
Expand Down
13 changes: 8 additions & 5 deletions src/iosMain/kotlin/dev/gitlive/appauth/iosMain.kt
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,13 @@ actual class AuthorizationService actual constructor(private val context: () ->
}
}

actual suspend fun performTokenRequest(request: TokenRequest): TokenResponse = suspendCoroutine { cont ->
OIDAuthorizationService.performTokenRequest(request.ios) { response, error ->
response?.let { cont.resume(TokenResponse(it)) }
?: cont.resumeWithException(error!!.toException())
actual suspend fun performTokenRequest(request: TokenRequest): TokenResponse =
withContext(Dispatchers.Main) {
suspendCoroutine { cont ->
OIDAuthorizationService.performTokenRequest(request.ios) { response, error ->
response?.let { cont.resume(TokenResponse(it)) }
?: cont.resumeWithException(error!!.toException())
}
}
}
}
}

0 comments on commit 36bc4f3

Please sign in to comment.