Fixed detekt findings, removed test code

This commit is contained in:
Melih
2020-03-31 13:25:54 +02:00
parent 927c5c02ca
commit ef05fa7e05
12 changed files with 208 additions and 128 deletions
@@ -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
}