chanjungskim
suspend fun requestChat(hisId: Long): ApiResponse<RequestableResponse>{ val result = userService.checkRequestableUser(hisId = hisId) result.onSuccess { if(this.data.message == RequestStatusType.AVAILABLE.name){ userService.requestChat(RequestChat(respondentId = hisId, chatStarterId = AppConfigure.myId))) } } }
Chrimaeon
checkRequestableUser
Dmitry
Flow
fun fetchedTrackedLaws() { val lawCodes = cacheRepository.lawCodes.toTypedArray() viewModelScope.launch { flowOf(*lawCodes) .flatMapMerge { it -> repository.getLawByNumber(it) } .onStart { state.update { state -> state.copy(isLoading = false) } } .collect { result -> when(result) { is Response.Data -> { state.update { state -> state.copy(billsWhichTracked = result.data, isLoading = false) } } is Response.Error -> { state.update { state -> state.copy(errors = state.errors.plus(getErrorMessage(result)), isLoading = false) } } } } } }
A modern programming language that makes developers happier.