-
Notifications
You must be signed in to change notification settings - Fork 6
Feature/corutines network layer #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
networkState = NetworkState.idle | ||
networkState = NetworkState.error | ||
} | ||
private fun mangeError(exception: Throwable?) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a typo in the method name, it should be manageError
@Subscribe | ||
fun signedUpFailure(event: FailureEvent) { | ||
error = null | ||
private fun mangeError(exception: Throwable?) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
class FailureEvent | ||
enum class ApiErrorType { | ||
apiError, | ||
uknownError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a typo here, it should be "unknown"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few typos to fix
response.errorBody()?.let { | ||
val error = Gson().fromJson(it.charStream(), ErrorModel::class.java) | ||
bus.post(ErrorEvent(ErrorUtil.handleCustomError(error))) | ||
private fun <T> manageResponse(response: Response<T>): Result<Data<T>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, handleResponse
is a more accurate name of what we are doing here. The same would apply for the other manageSomething
functions.
networkState = NetworkState.idle | ||
networkState = NetworkState.error | ||
networkState = NetworkState.idle | ||
state = SignUpState.signedUpSuccess |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is old, but it should be either signUpSuccess
or signedUpSuccessfully
.
Description
Official doc:
https://developer.android.com/topic/libraries/architecture/coroutines
Issue: Add Kotlin Coroutines