mayokunadeniyi / Instant-Weather

An Android weather application implemented using the MVVM pattern, Retrofit2, Dagger Hilt, LiveData, ViewModel, Coroutines, Room, Navigation Components, Data Binding and some other libraries from the Android Jetpack.
MIT License
767 stars 165 forks source link

Add Dependency Injection using Dagger2 #24

Closed forceporquillo closed 3 years ago

forceporquillo commented 3 years ago

Hello @mayokunthefirst saw this readme documentation of your app and I've found out that this project needs to incorporate Dagger2 as its DI framework.

I made some changes in your code to fit injecting those dependencies, and also, I made some comments on some of your code especially in InstantWeatherApplication.kt and ServiceLocation.kt class.

The DI comes with Injecting: • Repository • Local and Network DataSource • Local Database • ViewModel using Multibindings • Retrofit instance • Activity and fragment subcomponents

Lastly, I added Dagger 2.28.3 dependency

// Dagger2
kapt 'com.google.dagger:dagger-compiler:2.28.3'
implementation 'com.google.dagger:dagger-android-support:2.28.3'
kapt 'com.google.dagger:dagger-android-processor:2.28.3'

and fix some obsolete DSL elements.

dataBinding = true
 viewBinding = true

Thank you for your work learned a lot and I love it!

mayokunadeniyi commented 3 years ago

Wow! Hi, @forceporquillo so sorry for the late response and thank you for this PR!!! I've gone through your changes and they look good to me! 👍 Also, I'm glad you loved it and were able to learn a lot. Thank you!!!

mayokunadeniyi commented 3 years ago

Oh, and the comments you left are 💯 @forceporquillo