Last active
March 17, 2020 04:03
-
-
Save markchristopherng/4c3691290199669ee07fa17a166274c8 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
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