Skip to content

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

Merged
merged 4 commits into from
Dec 18, 2020

Conversation

amaury901130
Copy link
Collaborator

Description

  • Proposal coroutines on the network layer, over the ViewModelScope

Official doc:
https://developer.android.com/topic/libraries/architecture/coroutines

Issue: Add Kotlin Coroutines

networkState = NetworkState.idle
networkState = NetworkState.error
}
private fun mangeError(exception: Throwable?) {
Copy link
Contributor

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?) {
Copy link
Contributor

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
Copy link
Contributor

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"

Copy link
Contributor

@ximenaperez ximenaperez left a 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>> {
Copy link
Contributor

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
Copy link
Contributor

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.

@amaury901130 amaury901130 merged commit 62f5ff2 into master Dec 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants