mirror of
				https://github.com/AdrianKuta/android-challange-adrian-kuta.git
				synced 2025-10-31 05:53:39 +01:00 
			
		
		
		
	Refactor: Format code and update lint baselines
This commit applies code formatting changes across multiple files and updates lint baseline files. Key changes: - Added trailing commas to data classes in the `domain/types` module and related files. - Formatted `HomeScreenViewModel.kt`, `Result.kt`, `ObserveAirportsUseCase.kt`, `AirportService.kt`, `ObserveAirportsUseCaseModule.kt`, `AirportInfoDomainMapper.kt`, `AirportInfoModelMapper.kt`, `AirportsDatasourceModule.kt`, `AirportsDatasourceImpl.kt`, `FlightService.kt`, `Cache.kt`, and `CacheImpl.kt`. - Updated `README.md` and `LICENCE.md` with minor formatting adjustments. - Updated various `lint-baseline.xml` files due to changes in cached dependencies or formatting. - Added new `lint-baseline.xml` files for `model/datasource/airports`, `model/datasource/shared`, `domain/search`, and `model/data/api`. - Removed unused imports from `app/build.gradle.kts`. - Reformatted XML files: `ic_launcher_round.xml`, `ic_launcher.xml`, `strings.xml`, `ic_launcher_background.xml`. - Added project code style configuration files: `.idea/codeStyles/codeStyleConfig.xml` and `.idea/codeStyles/Project.xml`. - Reformatted `characters.json`. - Updated response data classes in `model/data/api/entities` with trailing commas and minor formatting.
This commit is contained in:
		
							
								
								
									
										11
									
								
								model/data/api/lint-baseline.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								model/data/api/lint-baseline.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <issues format="6" by="lint 8.10.1" type="baseline" client="gradle" dependencies="false" name="AGP (8.10.1)" variant="all" version="8.10.1"> | ||||
|  | ||||
|     <issue | ||||
|         id="Aligned16KB" | ||||
|         message="The native library `arm64-v8a/libmockkjvmtiagent.so` (from `io.mockk:mockk-agent-android:1.14.2`) is not 16 KB aligned"> | ||||
|         <location | ||||
|             file="$GRADLE_USER_HOME/caches/8.11.1/transforms/78a476c196dc0b141a854b3fe010ce3f/transformed/mockk-agent-android-1.14.2/jni/arm64-v8a/libmockkjvmtiagent.so"/> | ||||
|     </issue> | ||||
|  | ||||
| </issues> | ||||
| @@ -8,5 +8,4 @@ interface AirportService { | ||||
|  | ||||
|     @GET("/views/locate/5/airports/{language}/active") | ||||
|     suspend fun getAirports(@Path("language") languageCode: String): List<AirportResponse> | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -10,9 +10,10 @@ interface FlightService { | ||||
|     // example query: v4/en-gb/Availability?dateout=2025-09-17&origin=WRO&destination=DUB&adt=1&ToUs=AGREED | ||||
|     @Headers( | ||||
|         "client: android", | ||||
|         "client-version: 3.300.0" | ||||
|         "client-version: 3.300.0", | ||||
|     ) | ||||
|     @GET("v4/en-gb/Availability") | ||||
|     @Suppress("LongParameterList") | ||||
|     suspend fun getFlights( | ||||
|         @Query("dateout") date: String, | ||||
|         @Query("origin") origin: String, | ||||
| @@ -21,6 +22,6 @@ interface FlightService { | ||||
|         @Query("teen") teen: Int, | ||||
|         @Query("chd") child: Int, | ||||
|         @Query("inf") inf: Int = 0, | ||||
|         @Query("ToUs") toUs: String = "AGREED" | ||||
|         @Query("ToUs") toUs: String = "AGREED", | ||||
|     ): FlightResponse | ||||
| } | ||||
|   | ||||
| @@ -14,38 +14,38 @@ data class AirportResponse( | ||||
|     @Json(name = "macCity") val macCity: MacCity?, | ||||
|     @Json(name = "region") val region: Region?, | ||||
|     @Json(name = "country") val country: Country?, | ||||
|     @Json(name = "coordinates") val coordinates: Coordinates? | ||||
|     @Json(name = "coordinates") val coordinates: Coordinates?, | ||||
| ) { | ||||
|  | ||||
|     @JsonClass(generateAdapter = true) | ||||
|     data class City( | ||||
|         @Json(name = "code") val code: String?, | ||||
|         @Json(name = "name") val name: String? | ||||
|         @Json(name = "name") val name: String?, | ||||
|     ) | ||||
|  | ||||
|     @JsonClass(generateAdapter = true) | ||||
|     data class MacCity( | ||||
|         @Json(name = "code") val code: String?, | ||||
|         @Json(name = "macCode") val macCode: String?, | ||||
|         @Json(name = "name") val name: String? | ||||
|         @Json(name = "name") val name: String?, | ||||
|     ) | ||||
|  | ||||
|     @JsonClass(generateAdapter = true) | ||||
|     data class Region( | ||||
|         @Json(name = "code") val code: String?, | ||||
|         @Json(name = "name") val name: String? | ||||
|         @Json(name = "name") val name: String?, | ||||
|     ) | ||||
|  | ||||
|     @JsonClass(generateAdapter = true) | ||||
|     data class Country( | ||||
|         @Json(name = "code") val code: String?, | ||||
|         @Json(name = "name") val name: String?, | ||||
|         @Json(name = "currency") val currencyCode: String? | ||||
|         @Json(name = "currency") val currencyCode: String?, | ||||
|     ) | ||||
|  | ||||
|     @JsonClass(generateAdapter = true) | ||||
|     data class Coordinates( | ||||
|         @Json(name = "latitude") val latitude: Double?, | ||||
|         @Json(name = "longitude") val longitude: Double? | ||||
|         @Json(name = "longitude") val longitude: Double?, | ||||
|     ) | ||||
| } | ||||
|   | ||||
| @@ -1,6 +1,5 @@ | ||||
| package dev.adriankuta.model.data.api.entities | ||||
|  | ||||
|  | ||||
| import com.squareup.moshi.Json | ||||
| import com.squareup.moshi.JsonClass | ||||
|  | ||||
| @@ -8,20 +7,20 @@ import com.squareup.moshi.JsonClass | ||||
| data class FlightResponse( | ||||
|     @Json(name = "currency") val currency: String?, | ||||
|     @Json(name = "currPrecision") val currPrecision: Int?, | ||||
|     @Json(name = "trips") val trips: List<Trip>? | ||||
|     @Json(name = "trips") val trips: List<Trip>?, | ||||
| ) | ||||
|  | ||||
| @JsonClass(generateAdapter = true) | ||||
| data class Trip( | ||||
|     @Json(name = "dates") val dates: List<TripDate>?, | ||||
|     @Json(name = "origin") val origin: String?, | ||||
|     @Json(name = "destination") val destination: String? | ||||
|     @Json(name = "destination") val destination: String?, | ||||
| ) | ||||
|  | ||||
| @JsonClass(generateAdapter = true) | ||||
| data class TripDate( | ||||
|     @Json(name = "dateOut") val dateOut: String?, | ||||
|     @Json(name = "flights") val flights: List<TripFlight>? | ||||
|     @Json(name = "flights") val flights: List<TripFlight>?, | ||||
| ) | ||||
|  | ||||
| @JsonClass(generateAdapter = true) | ||||
| @@ -37,14 +36,14 @@ data class TripFlight( | ||||
|  | ||||
| @JsonClass(generateAdapter = true) | ||||
| data class RegularFare( | ||||
|     @Json(name = "fares") val fares: List<TripFare>? | ||||
|     @Json(name = "fares") val fares: List<TripFare>?, | ||||
| ) | ||||
|  | ||||
| @JsonClass(generateAdapter = true) | ||||
| data class TripFare( | ||||
|     @Json(name = "type") val type: String?, | ||||
|     @Json(name = "amount") val amount: Double?, | ||||
|     @Json(name = "count") val count: Int? | ||||
|     @Json(name = "count") val count: Int?, | ||||
| ) | ||||
|  | ||||
| @JsonClass(generateAdapter = true) | ||||
| @@ -53,5 +52,5 @@ data class Segment( | ||||
|     @Json(name = "destination") val destination: String?, | ||||
|     @Json(name = "flightNumber") val flightNumber: String?, | ||||
|     @Json(name = "time") val dateTimes: List<String>?, | ||||
|     @Json(name = "duration") val duration: String? | ||||
| ) | ||||
|     @Json(name = "duration") val duration: String?, | ||||
| ) | ||||
|   | ||||
| @@ -7,7 +7,7 @@ import com.squareup.moshi.JsonClass | ||||
| data class RouteResponse( | ||||
|     @Json(name = "departureAirport") val departureAirport: Airport.Departure?, | ||||
|     @Json(name = "arrivalAirport") val arrivalAirport: Airport.Arrival?, | ||||
|     @Json(name = "connectingAirport") val connectingAirport: Airport.Connecting? | ||||
|     @Json(name = "connectingAirport") val connectingAirport: Airport.Connecting?, | ||||
| ) { | ||||
|  | ||||
|     sealed interface Airport { | ||||
| @@ -32,19 +32,19 @@ data class RouteResponse( | ||||
|         data class Arrival( | ||||
|             override val code: String?, | ||||
|             override val name: String?, | ||||
|             override val macCity: MacCity? | ||||
|             override val macCity: MacCity?, | ||||
|         ) : Airport | ||||
|  | ||||
|         @JsonClass(generateAdapter = true) | ||||
|         data class Connecting( | ||||
|             override val code: String?, | ||||
|             override val name: String?, | ||||
|             override val macCity: MacCity? | ||||
|             override val macCity: MacCity?, | ||||
|         ) : Airport | ||||
|  | ||||
|         @JsonClass(generateAdapter = true) | ||||
|         data class MacCity( | ||||
|             @Json(name = "macCode") val macCode: String? | ||||
|             @Json(name = "macCode") val macCode: String?, | ||||
|         ) | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
|         id="Aligned16KB" | ||||
|         message="The native library `arm64-v8a/libmockkjvmtiagent.so` (from `io.mockk:mockk-agent-android:1.14.2`) is not 16 KB aligned"> | ||||
|         <location | ||||
|             file="$GRADLE_USER_HOME/caches/8.11.1/transforms/9ee3fe20033b4dd897c7dfcf7c303d16/transformed/mockk-agent-android-1.14.2/jni/arm64-v8a/libmockkjvmtiagent.so"/> | ||||
|             file="$GRADLE_USER_HOME/caches/8.11.1/transforms/78a476c196dc0b141a854b3fe010ce3f/transformed/mockk-agent-android-1.14.2/jni/arm64-v8a/libmockkjvmtiagent.so"/> | ||||
|     </issue> | ||||
|  | ||||
| </issues> | ||||
|   | ||||
							
								
								
									
										11
									
								
								model/data/shared/lint-baseline.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								model/data/shared/lint-baseline.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <issues format="6" by="lint 8.10.1" type="baseline" client="gradle" dependencies="false" name="AGP (8.10.1)" variant="all" version="8.10.1"> | ||||
|  | ||||
|     <issue | ||||
|         id="Aligned16KB" | ||||
|         message="The native library `arm64-v8a/libmockkjvmtiagent.so` (from `io.mockk:mockk-agent-android:1.14.2`) is not 16 KB aligned"> | ||||
|         <location | ||||
|             file="$GRADLE_USER_HOME/caches/8.11.1/transforms/78a476c196dc0b141a854b3fe010ce3f/transformed/mockk-agent-android-1.14.2/jni/arm64-v8a/libmockkjvmtiagent.so"/> | ||||
|     </issue> | ||||
|  | ||||
| </issues> | ||||
| @@ -2,13 +2,13 @@ package dev.adriankuta.flights.model.data.shared | ||||
|  | ||||
| import dev.adriankuta.flights.model.datasource.shared.Cache | ||||
|  | ||||
| public data class CacheImpl<T>(override val cacheKey: String?, override val data: T?) : | ||||
| data class CacheImpl<T>(override val cacheKey: String?, override val data: T?) : | ||||
|     Cache<T> { | ||||
|     public companion object { | ||||
|         public inline fun <reified T> emptyCache(): CacheImpl<T> = | ||||
|     companion object { | ||||
|         inline fun <reified T> emptyCache(): CacheImpl<T> = | ||||
|             CacheImpl(null, null) | ||||
|  | ||||
|         public inline fun <reified T> Cache<T>?.orEmpty(): Cache<T> = | ||||
|         inline fun <reified T> Cache<T>?.orEmpty(): Cache<T> = | ||||
|             this ?: emptyCache() | ||||
|     } | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
|         id="Aligned16KB" | ||||
|         message="The native library `arm64-v8a/libmockkjvmtiagent.so` (from `io.mockk:mockk-agent-android:1.14.2`) is not 16 KB aligned"> | ||||
|         <location | ||||
|             file="$GRADLE_USER_HOME/caches/8.11.1/transforms/9ee3fe20033b4dd897c7dfcf7c303d16/transformed/mockk-agent-android-1.14.2/jni/arm64-v8a/libmockkjvmtiagent.so"/> | ||||
|             file="$GRADLE_USER_HOME/caches/8.11.1/transforms/78a476c196dc0b141a854b3fe010ce3f/transformed/mockk-agent-android-1.14.2/jni/arm64-v8a/libmockkjvmtiagent.so"/> | ||||
|     </issue> | ||||
|  | ||||
| </issues> | ||||
|   | ||||
| @@ -2,56 +2,77 @@ | ||||
|   "data": [ | ||||
|     { | ||||
|       "name": "Adam Małysz" | ||||
|     }, { | ||||
|     }, | ||||
|     { | ||||
|       "name": "Harry Potter" | ||||
|     }, { | ||||
|     }, | ||||
|     { | ||||
|       "name": "SpongeBob" | ||||
|     }, { | ||||
|     }, | ||||
|     { | ||||
|       "name": "Miś uszatek" | ||||
|     }, { | ||||
|     }, | ||||
|     { | ||||
|       "name": "Brzydkie kaczątko" | ||||
|     }, { | ||||
|     }, | ||||
|     { | ||||
|       "name": "Papa Smerf" | ||||
|     }, { | ||||
|     }, | ||||
|     { | ||||
|       "name": "Smerfetka" | ||||
|     }, { | ||||
|     }, | ||||
|     { | ||||
|       "name": "Gargamel", | ||||
|       "category": "Smerfy" | ||||
|     }, { | ||||
|     }, | ||||
|     { | ||||
|       "name": "Ważniak", | ||||
|       "category": "Smerfy" | ||||
|     }, { | ||||
|     }, | ||||
|     { | ||||
|       "name": "Roszpunka" | ||||
|     }, { | ||||
|     }, | ||||
|     { | ||||
|       "name": "Myszka Miki" | ||||
|     }, { | ||||
|     }, | ||||
|     { | ||||
|       "name": "Król Lew" | ||||
|     }, { | ||||
|     }, | ||||
|     { | ||||
|       "name": "Elsa", | ||||
|       "category": "Kraina lodu" | ||||
|     }, { | ||||
|     }, | ||||
|     { | ||||
|       "name": "Olaf", | ||||
|       "category": "Kraina lodu" | ||||
|     }, { | ||||
|     }, | ||||
|     { | ||||
|       "name": "Mała syrenka" | ||||
|     }, { | ||||
|     }, | ||||
|     { | ||||
|       "name": "Kubuś Puchatek" | ||||
|     }, { | ||||
|     }, | ||||
|     { | ||||
|       "name": "Prosiaczek", | ||||
|       "category": "Kubuś Puchatek" | ||||
|     }, { | ||||
|     }, | ||||
|     { | ||||
|       "name": "Kłapouchy", | ||||
|       "category": "Kubuś Puchatek" | ||||
|     }, { | ||||
|     }, | ||||
|     { | ||||
|       "name": "Królik", | ||||
|       "category": "Kubuś Puchatek" | ||||
|     }, { | ||||
|     }, | ||||
|     { | ||||
|       "name": "Maleństwo", | ||||
|       "category": "Kubuś Puchatek" | ||||
|     }, { | ||||
|     }, | ||||
|     { | ||||
|       "name": "Pan Sowa", | ||||
|       "category": "Kubuś Puchatek" | ||||
|     }, { | ||||
|     }, | ||||
|     { | ||||
|       "name": "Krzyś", | ||||
|       "category": "Kubuś Puchatek" | ||||
|     } | ||||
|   | ||||
| @@ -18,11 +18,11 @@ internal class AirportsDatasourceImpl : AirportsDatasource { | ||||
|  | ||||
|     override suspend fun setAirportsInfo( | ||||
|         airports: List<AirportResponse>, | ||||
|         cacheKey: String | ||||
|         cacheKey: String, | ||||
|     ) { | ||||
|         _airports.value = CacheImpl( | ||||
|             cacheKey = cacheKey, | ||||
|             data = airports.map { it.toModel() } | ||||
|             data = airports.map { it.toModel() }, | ||||
|         ) | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -27,4 +27,4 @@ internal class AirportsDatasourceImplModule { | ||||
|     @Provides | ||||
|     @Singleton | ||||
|     fun provide(): AirportsDatasourceImpl = AirportsDatasourceImpl() | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -19,7 +19,7 @@ internal fun AirportResponse.toModel(): AirportInfoModel { | ||||
|         countryName = country?.name.orEmpty(), | ||||
|         countryCurrencyCode = country?.currencyCode.orEmpty(), | ||||
|         latitude = coordinates?.latitude ?: 0.0, | ||||
|         longitude = coordinates?.longitude ?: 0.0 | ||||
|         longitude = coordinates?.longitude ?: 0.0, | ||||
|     ) | ||||
| } | ||||
|  | ||||
| @@ -38,5 +38,5 @@ private data class AirportInfoModelImpl( | ||||
|     override val countryName: String, | ||||
|     override val countryCurrencyCode: String, | ||||
|     override val latitude: Double, | ||||
|     override val longitude: Double | ||||
|     override val longitude: Double, | ||||
| ) : AirportInfoModel | ||||
|   | ||||
		Reference in New Issue
	
	Block a user