- Clean Architecture: presentation, domain (agostic), data layers, and dependency injection (Hilt). ref
Dependencies between Layers
Diagram of Clean Architecture
-
Unit Testing: with JUnit and MockK.
-
Data Flow Management: Coroutine, Flow, and Paging3.
-
View Management: Jetpack Compose (Dark/Night).
-
Navigation Management: Jetpack Navigation.
The domain is the application's core containing the business logic and rules. The domain needs to be independent of other modules and libraries related to the UI, Android, etc. All classes (except models) and public methods should be tested.
The data layer allows retrieving and persisting application data through Repositories* and Data Sources, which can be local with a database or remote with an API.
*In practice, the "repository pattern" should be used to manage different data sources (DB, API, Cache), otherwise it is implemented to support "offline mode".
The UI's role is to display the application's data on the screen and serve as the main point of user interaction. The used pattern is MVVM (Model - View - ViewModel) / UDF.
- Unit tests for ViewModel. apparently a
ViewModel
using paging can only be tested on the UI side - Inject scope and dispatcher to facilitate testing. ✅
- Unit tests for PagingSource. ✅
- User interface tests.
- Support "offline first" mode.
- Add Room persistence library.
- Implement RemoteMediator.
- Have a module for each layer. ✅
- Add a "retry" button on the data loading error screen. ✅
- Add pull-to-refresh. ✅
- Scroll management. ✅
- Replace error message text with a snack bar.
- Add/handle empty screen case.
- Add navigation in the AppBar. ✅
- Add an "up" button to scroll to the top of the list. ✅
- Filter the list of posts based on a tag. ✅
- Remove the "material" dependency (as it is only used for "pull-to-refresh") and use Material3. ✅
- Improve error handling (via Retrofit
CallAdapter
). ✅- Use a
sealed class
to distinguish between an exception and an error. ✅
- Use a
- Add a buildSrc module for version management (Android/release). ✅
- Add Type-Safe Navigation for compose navigation.
- Add documentation.
- Configure CI via GitHub Actions:
- Code formatting with Spotless/Ktlint. ✅
- Unit test. ✅
- Generate the release.
- Threading error:
(Skipped 78 frames!)
✅ - Scroll position is reset to the top when navigating back from "Post" screen to "Home" screen (hint: after adding the search by tag feature).
- manager
stateful
andstateless
.