mirror of
https://github.com/melihaksoy/Android-Kotlin-Modulerized-CleanArchitecture.git
synced 2026-05-18 05:37:25 +02:00
Fixed detekt findings, removed test code
This commit is contained in:
@@ -39,4 +39,4 @@ interface InteractorParameters
|
||||
/**
|
||||
* Symbolizes absence of parameters for an [interactor][BaseInteractor]
|
||||
*/
|
||||
class None : Any(), InteractorParameters
|
||||
class None : InteractorParameters
|
||||
|
||||
@@ -143,21 +143,18 @@ internal class LaunchesSource @Inject constructor(
|
||||
launch
|
||||
}
|
||||
|
||||
private fun transformImageUrl(imageUrl: String, supportedSizes: IntArray) =
|
||||
try {
|
||||
val urlSplit = imageUrl.split("_")
|
||||
val url = urlSplit[0]
|
||||
val format = urlSplit[1].split(".")[1]
|
||||
private fun transformImageUrl(imageUrl: String, supportedSizes: IntArray): String {
|
||||
val urlSplit = imageUrl.split("_")
|
||||
val url = urlSplit[0]
|
||||
val format = urlSplit[1].split(".")[1]
|
||||
|
||||
val requestedSize = if (!supportedSizes.contains(DEFAULT_IMAGE_SIZE)) {
|
||||
supportedSizes.last { it < DEFAULT_IMAGE_SIZE }
|
||||
} else {
|
||||
DEFAULT_IMAGE_SIZE
|
||||
}
|
||||
|
||||
"${url}_$requestedSize.$format"
|
||||
} catch (e: Exception) {
|
||||
imageUrl
|
||||
val requestedSize = if (!supportedSizes.contains(DEFAULT_IMAGE_SIZE)) {
|
||||
supportedSizes.last { it < DEFAULT_IMAGE_SIZE }
|
||||
} else {
|
||||
DEFAULT_IMAGE_SIZE
|
||||
}
|
||||
|
||||
return "${url}_$requestedSize.$format"
|
||||
}
|
||||
//endregion
|
||||
}
|
||||
|
||||
@@ -10,26 +10,26 @@ import com.melih.definitions.entities.LaunchEntity
|
||||
* DAO for list of [launches][LaunchEntity]
|
||||
*/
|
||||
@Dao
|
||||
abstract class LaunchesDao {
|
||||
interface LaunchesDao {
|
||||
|
||||
//region Queries
|
||||
|
||||
@Query("SELECT * FROM Launches ORDER BY launchStartTime DESC LIMIT :count OFFSET :page*:count")
|
||||
abstract suspend fun getLaunches(count: Int, page: Int): List<LaunchEntity>
|
||||
suspend fun getLaunches(count: Int, page: Int): List<LaunchEntity>
|
||||
|
||||
@Query("SELECT * FROM Launches WHERE id=:id LIMIT 1")
|
||||
abstract suspend fun getLaunchById(id: Long): LaunchEntity?
|
||||
suspend fun getLaunchById(id: Long): LaunchEntity?
|
||||
|
||||
@Query("DELETE FROM Launches")
|
||||
abstract suspend fun nukeLaunches()
|
||||
suspend fun nukeLaunches()
|
||||
//endregion
|
||||
|
||||
//region Insertion
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
abstract suspend fun saveLaunches(launches: List<LaunchEntity>)
|
||||
suspend fun saveLaunches(launches: List<LaunchEntity>)
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
abstract suspend fun saveLaunch(launch: LaunchEntity)
|
||||
suspend fun saveLaunch(launch: LaunchEntity)
|
||||
//endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user