Logic of app:
- At the start of the application, an API call is made to get the list of dogs.
- For Search, First it will go through the data that is shown to user to check if any name contains the keyword.
- If no result is found from step [2] it would call the search api with query param to get the list of items.
At the start of the app internet should be connected in order to fetch the data, otherwise internet error message shown to user. This application supports both the orientation. The test case coverage for ViewModel/Business logic is over ~85%.
- MVVM: Used MVVM with ViewModel and LiveData to maintain updated state of UI during configuration change. ViewModel has used UDF and ViewState to maintain a single point of communication rather than exposing multiple livedata objects.
- Kotlin: Used Kotlin for business, view, and test cases 100%.
- RxJava : To fetch the response from API.
- Retrofit : Called API with query params.
- Dagger : Dependency injector.
- Mockito : Tested ViewModel since it is handling business logic to call api etc. The code coverage for ViewModel is 94% line coverage%.
Note: If I had more time I could have done the better job in UI. I could have made this application connection aware.
What things I will do before going to PROD:-
- More alerting and logging to see the user behaviour.
- A/B testing with alternative UI. Fallback UI if API is down or error cases.
- It depends if API provide pagination capability or not.
- Use ROOM to store data as data might become big in PROD.
- Add e2e test cases.
Test Report https://github.com/Jaggrat-Singh/dog-app/blob/main/report.png