Skip to content

Instantly share code, notes, and snippets.

@markchristopherng
Last active March 17, 2020 04:03
Show Gist options
  • Save markchristopherng/4c3691290199669ee07fa17a166274c8 to your computer and use it in GitHub Desktop.
Save markchristopherng/4c3691290199669ee07fa17a166274c8 to your computer and use it in GitHub Desktop.
suspend fun getOnboardingInfoAndSmartMessage() = supervisorScope {
withContext(Dispatchers.IO) {
var onBoardingFacades: Array<OnBoardingFacade> = try {
async {
facadeManager.getOnBoardingInfo()
}.await()
} catch (throwable: Throwable) {
val onBoardingFacade = OnBoardingFacade().apply {
error = throwable
}
arrayOf(onBoardingFacade)
}
var smartMessages: List<SmartMessage> = try {
async {
smartMessageManager.getSmartMessage()
}.await()
} catch (throwable: Throwable) {
arrayListOf()
}
mergeOnboardingResponse(onBoardingFacades, smartMessages)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment