Skip to content

Conversation

@MarcinMoskala
Copy link
Contributor

No description provided.

# Conflicts:
#	app/src/main/kotlin/io/github/plastix/kotlinboilerplate/data/network/NetworkInteractorImpl.kt
#	app/src/main/kotlin/io/github/plastix/kotlinboilerplate/data/remote/ApiModule.kt
#	app/src/main/kotlin/io/github/plastix/kotlinboilerplate/extensions/ViewExtensions.kt
#	app/src/main/kotlin/io/github/plastix/kotlinboilerplate/ui/detail/DetailActivity.kt
#	app/src/main/kotlin/io/github/plastix/kotlinboilerplate/ui/list/ListActivity.kt
@Plastix
Copy link
Owner

Plastix commented Mar 20, 2017

I've already merged the first two commits of this PR into master. Can you remove these and rebase before I review this. Thanks!

@Plastix
Copy link
Owner

Plastix commented Mar 20, 2017

I'm referring to commits 2aa57b1 and 8e2843a.

@MarcinMoskala
Copy link
Contributor Author

I added them to allow GitHub merge for you. Don't worry - these changes are not visible on Files changed. Example: ViewModelLoader was changed on 2aa57b1 but there is nothing about it on Files changed because it is already in Plastix:master (thanks to the previous merge).

Copy link
Owner

@Plastix Plastix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once you fix the small changes can you squash into one commit?

fun provideApiService(retrofit: Retrofit): GithubApiService {
return retrofit.create(GithubApiService::class.java)
}
fun provideApiService(retrofit: Retrofit) = retrofit.create(GithubApiService::class.java)!!
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is !! needed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid phantom type that is returned by create function, while it is Java function. It can be either solved by not null assertion (!!) or by setting function type. In situations like this, where it is obvious for all experienced Android developers that this will return GithubApiService I prefer to use !! because it is shorter. But I can change to:

fun provideApiService(retrofit: Retrofit): GithubApiService =
        retrofit.create(GithubApiService::class.java)

what is also totally reasonable.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the explicit return type is better.

}

private fun onRequestError(e: Throwable) {
System.out.println(e.toString())
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this debug print.


class ListViewModel @Inject constructor(
private val apiService: GithubApiService,
apiService: GithubApiService,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for making apiService not a private val anymore?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that one of your next commits fixes this so nevermind.

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.

2 participants