Simplify boolean returns

This commit is contained in:
davide 2022-07-25 14:10:50 +02:00
parent 73e6742cee
commit da4bdd2355

View File

@ -232,7 +232,6 @@ class RepositoryImpl(private val api: SelfossApi, private val apiDetails: ApiDet
filter: String filter: String
): Boolean { ): Boolean {
// TODO: Check connectivity // TODO: Check connectivity
var result = false
val response = api.createSourceForVersion( val response = api.createSourceForVersion(
title, title,
url, url,
@ -242,11 +241,7 @@ class RepositoryImpl(private val api: SelfossApi, private val apiDetails: ApiDet
apiMajorVersion apiMajorVersion
) )
if (response != null) { return response != null
result = true
}
return result
} }
override suspend fun deleteSource(id: Int): Boolean { override suspend fun deleteSource(id: Int): Boolean {
@ -263,11 +258,7 @@ class RepositoryImpl(private val api: SelfossApi, private val apiDetails: ApiDet
override suspend fun updateRemote(): Boolean { override suspend fun updateRemote(): Boolean {
// TODO: Handle connectivity issues // TODO: Handle connectivity issues
val response = api.update() val response = api.update()
return if (response != null) { return response?.isSuccess ?: false
response.isSuccess
} else {
false
}
} }
override suspend fun login(): Boolean { override suspend fun login(): Boolean {