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

Added Koin for DI #16

Closed GeorgCantor closed 4 years ago

GeorgCantor commented 4 years ago

Added Koin for dependency injection. Now we just inject the repository into the view model and we don’t need to initialize it every time.

mayokunadeniyi commented 4 years ago

Hello there @GeorgCantor 👋 thank you this PR!!! I apologize for not attending to it sooner. I've checked out the code and it LGTM! Thank you. There is currently one major problem, I am working on a major refactor as to ensure the code is testable, robust and losely coupled. If you go through the codebase, you'll notice some bad practices especially on how I implemented the Repository pattern here. There are currently no DataSources in the project and data is being fetched in the Repository instead of delegating that to the DataSource be it local or remote. The Repository is meant to:

All these I'm sure you are familiar with :)

This is also really important as we would need to write tests for this project. With all this in view, I would love to suggest we merge this PR into a separate branch which I have created koin-di then after the refactor is finished on this master branch, we would set out to do similar refactoring in the koin-di branch. Furthermore, I would love to have different flavours of DI frameworks for this project which we would seperate into different branches as time goes on i.e vanilla Dagger: Dagger2 and Hilt as it would help to serve as a demo on how to utilize these libraries.

Long story short, I'll love if you could close this PR and send it to the koin-di branch 😃 . I really appreciate the effort you made in writing this feature! Thank you once again. Looking forward to merging the PR :)