-
Notifications
You must be signed in to change notification settings - Fork 49
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
Deeper clean up #15
base: master
Are you sure you want to change the base?
Deeper clean up #15
Conversation
…ventions.html Bump kotlin version to 1.1
# 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
I've already merged the first two commits of this PR into |
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). |
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.
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)!! |
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.
Why is !!
needed here?
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.
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.
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 think the explicit return type is better.
} | ||
|
||
private fun onRequestError(e: Throwable) { | ||
System.out.println(e.toString()) |
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.
Remove this debug print.
@@ -18,7 +19,7 @@ import io.reactivex.subjects.PublishSubject | |||
import javax.inject.Inject | |||
|
|||
class ListViewModel @Inject constructor( | |||
private val apiService: GithubApiService, | |||
apiService: GithubApiService, |
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.
Is there a reason for making apiService
not a private val anymore?
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 noticed that one of your next commits fixes this so nevermind.
No description provided.