Created
February 9, 2021 07:06
-
-
Save EmmanuelGuther/04b5f1da8f2e34010da44edd17d6f451 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private suspend fun getToken(foo: String): String? = suspendCoroutine { continuation -> | |
val fooToken = tokenApiExample.Token(foo).start | |
fooToken.onCreateTokenListener { data -> | |
when { | |
data.has("id") -> { | |
val token = data.getString("id") | |
continuation.resume(token) | |
} | |
else -> { | |
continuation.resume(null) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment