Samer Hobeika
05/08/2019, 5:12 PMbloder
05/08/2019, 5:18 PMsuspend fun getFirstResult() : Data? = try {
getData().await()
} catch(e: Exception) {
null
}
suspend fun getSecondResult(data: Data) {}
fun getContent() = launch {
getFirstResult()?.let{ getSecondResult(it) }
}streetsofboston
05/08/2019, 5:20 PMgetContent a bit:
fun CoroutineScope.getContent() = async {
getFirstResult()?.let { getSecondResult(it) }
}Samer Hobeika
05/08/2019, 5:26 PMSamer Hobeika
05/08/2019, 5:26 PMbloder
05/08/2019, 5:27 PMgetContent I have at the final a handleResponse() to make the communication to my view with states, then my getContent needs to launch, or am I missing something?Samer Hobeika
05/08/2019, 5:28 PMstreetsofboston
05/08/2019, 5:28 PMasync. And there’s a need of a CoroutineScope to call async (or launch).Samer Hobeika
05/08/2019, 5:29 PMstreetsofboston
05/08/2019, 5:29 PMSamer Hobeika
05/08/2019, 5:30 PMstreetsofboston
05/08/2019, 5:30 PMbloder
05/08/2019, 5:31 PMSamer Hobeika
05/08/2019, 5:31 PMbloder
05/08/2019, 5:31 PMstreetsofboston
05/08/2019, 5:31 PMSamer Hobeika
05/08/2019, 5:31 PMstreetsofboston
05/08/2019, 5:34 PMSamer Hobeika
05/08/2019, 5:35 PM