I have 2 apps on android and ios side. Both of apps using apollo graphql library. So i decided to use it on kotlin multi library project. Everything works well with this type of usage
suspend fun addFeedback(request: AddFeedBackRequest): BaseResponseModel<Any> {
val feedBackType = if (request.type == AddFeedBackType.Bug) {
FeedbackType.BUG
} else {
FeedbackType.FEEDBACK
}
val input = AddFeedbackInput(request.note, Optional.presentIfNotNull(feedBackType))
val mutation = AddFeedbackMutation(input)
val response = executeMutation(mutation)
if (response.isFailed()) return onError()
return onSuccess()
}
and when i want to use this method on android application i can use it like this
lifecycleScope.launch {
HelpRepository().addFeedback(AddFeedBackRequest(AddFeedBackType.Bug, ""))
}
I've been searching about observable pattern i found [https://github.com/badoo/Reaktive1
library for observable rx kotlin usages
For example i want to use addFeedBack method on android side like this
HelpRepository()
.addFeedback()
.onSuccess { response ->
}
.onLoading { state ->
}
.onError { err ->
}
Last two days i searched about this structure but i couldn't much more anything. Any re-search subjects or example projects that you can help please ?
Thanks for that