in azure-communication-ui/demo-app/src/call-with-chat/java/com/azure/android/communication/ui/callwithchatdemoapp/CallLauncherViewModel.kt [53:100]
fun doLaunch(
context: Context,
alertHandler: AlertHandler,
authApiUrl: String?,
acsToken: String?,
communicationUserId: String?,
userName: String?,
acsEndpoint: String,
groupId: UUID?,
chatThreadId: String?,
meetingLink: String?,
) {
val authService: AuthService = when {
isTokenFunctionOptionSelected && authApiUrl != null && urlIsValid(authApiUrl) ->
AuthServiceRemote(authApiUrl)
acsToken != null && acsToken.isNotBlank() && communicationUserId != null ->
AuthServiceLocal(acsToken, communicationUserId)
else -> {
fetchResultInternal.postValue(
Result.failure(
IllegalStateException(
"Invalid Token function URL or acs Token or CommunicationUserId"
)
)
)
return@doLaunch
}
}
viewModelScope.launch {
authService.ensureAuthInfo()
fetchResultInternal.postValue(Result.success(null))
val launcher = getLauncher()
launcher.launch(
context,
alertHandler,
authService,
userName,
acsEndpoint,
groupId,
chatThreadId,
meetingLink,
)
}
}