Created
June 1, 2022 13:45
-
-
Save myungpyo/8bca75f74095f99f0988e5ceff528634 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
fun fetchPrimaryInfo() = viewModelScope.launch { | |
val appInfoDeferred = async { fetchAppInfoUseCase().execute() } | |
val userInfoDeferred = async { fetchUserInfoUseCase().execute() } | |
runCatching { | |
PrimaryInfo( | |
appInfo = appInfoDeferred.await(), | |
userInfo = userInfoDeferred.await(), | |
) | |
}.onSuccess { primaryInfo -> | |
updatePrimaryInfo(primaryInfo) | |
}.onFailure { throwable -> | |
Timber.d("Failed to fetch primary info. $throwable") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment