Ivan
02/23/2021, 7:17 AMNiklas Gürtler
02/23/2021, 7:22 AMIvan
02/23/2021, 7:27 AM@FunctionalInterface
public interface CurrentUserProvider {
Object currentUser();
}
But i can declase currentUser as suspend function, and this function is called from library as an internal callbackNiklas Gürtler
02/23/2021, 7:33 AM@FunctionalInterface
class MyCurrentUserProvider (val coroScope : CoroutineScope) : CurrentUserProvider () {
fun currentUser() : java.lang.Object () {
coroScope.whatever ()
}
}
Ivan
02/23/2021, 7:58 AMNiklas Gürtler
02/23/2021, 8:06 AMIvan
02/23/2021, 8:07 AMNiklas Gürtler
02/23/2021, 8:08 AMIvan
02/23/2021, 8:12 AMNiklas Gürtler
02/23/2021, 8:13 AMIvan
02/23/2021, 8:14 AMNiklas Gürtler
02/23/2021, 8:15 AMtateisu
02/23/2021, 9:47 AMtateisu
02/23/2021, 9:47 AMYou need to pass it explicitly to your function as parameter or receiver.
tateisu
02/23/2021, 9:48 AMTechnically, it would be even possible to exposeas acoroutineContext
.ThreadLocal