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
suspend fun <T> Task<T>.await(): T { | |
if (isComplete) return if (isSuccessful) result else throw exception!! | |
return suspendCoroutine { c: Continuation<T> -> | |
addOnSuccessListener { c.resume(it) } | |
addOnFailureListener { c.resumeWithException(it) } | |
} | |
} | |
fun <T> Deferred<T>.asTask(): Task<T> { | |
val source = TaskCompletionSource<T>() |
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
class RxErrorHandlingCallAdapterFactory private constructor(private val original: RxJava2CallAdapterFactory) : CallAdapter.Factory() { | |
override fun get(returnType: Type, annotations: Array<Annotation>, retrofit: Retrofit): CallAdapter<*, *>? = | |
original.get(returnType, annotations, retrofit)?.let { | |
RxCallAdapterWrapper(it as CallAdapter<Any, Any>) | |
} | |
private class RxCallAdapterWrapper(private val wrapped: CallAdapter<Any, Any>) : CallAdapter<Any, Any> by wrapped { | |
override fun adapt(call: Call<Any>): Any { |
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
/** | |
* Author: Michael Weibel <[email protected]> | |
* License: MIT | |
*/ | |
var passport = require('passport') | |
, StrategyMock = require('./strategy-mock'); | |
module.exports = function(app, options) { | |
// create your verify function on your own -- should do similar things as |