FinNews is a Jetpack Compose app using Material 3 design elements. This Android app sample is the leading FinTech and finance news app which allows the user to display a list of articles, view the details and has visually decorative actions such as: Search, Favourite and Bookmark.
Before running the app, ensure you have the following installed on your system:
- Android Studio - [Minimum Android SDK Version: 24 | Target Android SDK Version: 34]
- Java Development Kit (JDK) - [JDK Version: 17]
Build System
- Gradle
- Kotlin
Latest App version : 1.0.0
Follow these steps to run the app:
-
Clone the Repository: -> Clone this GitHub repository to your local machine using Git:
git clone https://github.com/nomadiqltd/FinNews.git
-
- On Github, check out the 'main' branch.
-
- Request a new Guardian News API key from here.
-
- Navigate to the build.gradle file within the app module (not the build.gradle at the root of the directory).
- Replace the current Guardian News Api key inside the buildTypes{} closure (within the build.gradle file) with your new Guardian News Api Key.
- Note: If you do not replace the API Key, you may be presented with a blue screen containing a error message similar to: "errorCode : 401 ==> ".
val apiKey = "\"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\""
-
- Select Build -> Rebuild Project and then select Run after the project successfully builds.
The chosen architecture is MVVM (Model View ViewModel) with a Clean-ish approach.
The main 3 layers are:
Presentation Layer
- This layer displays the application data on the screen. This includes the Jetpack Compose functions, ViewModels and UI State.
Domain Layer
- The domain layer is the mediator between the data layer and the presentation layer.
- This app is a pretty small sample but for future scalability it will become more complex and all that logic that would have lived in the ViewModel would now reside in smaller UseCases instead (optional layer).
Data Layer
- The data layer contains repositories that abstract away the complexity of the data's origins. In this case, it's all remote data but it has the capability to extend to a form of local storage i.e. a Database.
Project Dependencies
Below is a brief summary of the main dependencies below:
Compose
- Declarative UI with composable functions as opposed to the older Android View system (old school XML layouts)
Arch Core
- Helper for other arch dependencies, including JUnit test rules
Hilt
- Dependency injection library to allow the various app components to best utlisie their dependencies and improve testability
Navigation
- Default navigation library for Compose
Kotlinx Coroutines
- Asynchronous programming to obtain data from the network and leverage concurrency concepts for a more performant app
Retrofit
- HTTP client that supports coroutines
Moshi
- JSON Parser, used to parse requests on the data layer for Entities (coupled with okhhtp interceptors)
JUnit
- This was used for unit testing the use cases, ViewModels, and the Repositories
Mockk / Mockito
- Used to provide test fakes / doubles to aid in testing other components by reducing side effects of their intrinsic dependencies
Truth
- Readable Assertions Library to aid test fidelity
Espresso
- Used for writing Android UI tests (that require the Android system components i.e. Activities, some Composables)
Coil
- Image loading for Android backed by Kotlin Coroutines.
Coverage can always be improved. Included a small sample of various test types to cover all three layers. Mainly unit, integrated, instrumented tests.
- @Composables, ViewModels, Usecases, Repositories have automated tests.
- Offline support - use of a snackbar to inform the user there is poor or no internet connectivity. Currently just a basic message.
- Offline mode
- Minor testing in obfuscated mode / Proguard mode only
- Persist the Articles to local storage so the user always has access even when offline