Skip to content

Feature/corutines network layer#36

Merged
amaury901130 merged 4 commits intomasterfrom
feature/corutines_network_layer
Dec 18, 2020
Merged

Feature/corutines network layer#36
amaury901130 merged 4 commits intomasterfrom
feature/corutines_network_layer

Conversation

@amaury901130
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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