This commit introduces a generic `Result` sealed interface to represent success, error, and loading states for asynchronous operations. It also updates the home screen UI and ViewModel to utilize this `Result` type for displaying different states.
Key changes:
- Added `Result.kt` in `core:util` defining the `Result` sealed interface and an `asResult()` Flow extension.
- Updated `HomeScreenViewModel` to use `asResult()` and map the `ObserveAirportsUseCase` output to `HomeUiState` (Loading, Success, Error).
- Modified `HomeUiState` to be a sealed interface with `Loading`, `Success`, and `Error` subtypes.
- Updated `HomeScreen` to handle different `HomeUiState` values and display appropriate UI (Loading text, Error text, or list of airports).
- Added `core.util` dependency to `ui:home`.
- Updated Moshi and Retrofit Moshi converter dependencies in `model/data/api/build.gradle.kts` and `gradle/libs.versions.toml`.
- Added `moshi` and `moshiKotlinCodegen` versions to `gradle/libs.versions.toml`.
- Removed `converter-moshi` and added `retrofit-converter-moshi` in `gradle/libs.versions.toml`.
- Added `ksp(libs.moshi.kotlin.codegen)` to `model/data/api/build.gradle.kts`.
- Added `INTERNET` permission to `app/src/main/AndroidManifest.xml`.
- Updated `ObserveAirportsUseCaseImpl` to use `cacheKey` when setting airports info and to fetch airports for "pl" (lowercase).
- Added `.editorconfig` file with Kotlin trailing comma settings.
This commit introduces the functionality to fetch airport data from the Ryanair API and display it in the UI.
Key changes:
- Added `AirportInfoModel` interface and its implementation `AirportInfoModelImpl` to represent airport data in the data layer.
- Created `AirportInfoModelMapper` to map `AirportResponse` to `AirportInfoModel`.
- Set the base URL for Retrofit in `NetworkModule` to `https://services-api.ryanair.com`.
- Added new Gradle modules: `model:data:shared`, `model:datasource:airports`, `model:datasource:shared`, and `domain:search`.
- Implemented `CacheImpl` in `model:data:shared` for generic caching.
- Defined `ObserveAirportsUseCase` interface in `domain:search` to observe airport data.
- Added Detekt configuration for the `domain:search` and `model:datasource:shared` modules.
- Created `AirportsDatasource` interface and its implementation `AirportsDatasourceImpl` to manage airport data.
- Implemented `AirportInfoDomainMapper` to map `AirportInfoModel` to the domain `AirportInfo`.
- Updated `HomeScreen` to display a list of airports using `LazyColumn`.
- Updated `HomeScreenViewModel` to fetch and expose airport data via `ObserveAirportsUseCase`.
- Added `ObserveAirportsUseCaseModule` to provide the `ObserveAirportsUseCase` implementation.
- Implemented `ObserveAirportsUseCaseImpl` in the repository layer to fetch data from the API and update the datasource.
- Added `kotlinx-datetime` dependency.
- Created `AirportsDatasourceModule` to provide `AirportsDatasource` and its implementation.
- Added `CacheObservers.kt` with a utility function `loadData` to handle cache observation and data loading logic.
- Updated dependencies in `model:data:simple`, `model:repository`, and `ui:home` build files.
- Updated `settings.gradle.kts` to include new modules.
- Defined `Cache` interface in `model:datasource:shared`.
This commit introduces Retrofit and Moshi to handle network requests and JSON parsing.
Key changes include:
- Added Retrofit, Moshi, OkHttp, and OkHttp Logging Interceptor dependencies to `libs.versions.toml` and `model/data/api/build.gradle.kts`.
- Created data classes for API responses: `AirportResponse`, `RouteResponse`, and `FlightResponse`.
- Defined Retrofit service interfaces: `AirportService`, `RoutesService`, and `FlightService`.
- Implemented a Hilt `NetworkModule` to provide Retrofit, Moshi, and OkHttpClient instances.
- Added a Detekt configuration file for the `model/data/api` module.
- Temporarily commented out `configureFlavors` in `AndroidApplicationConvention.kt` and `ConfigureLibrary.kt`.