Remove v1 version from v0 data source

This commit is contained in:
Kirill Kamakin
2022-10-29 16:50:13 +02:00
parent 1f5234d123
commit da33bc2730
2 changed files with 13 additions and 16 deletions

View File

@@ -46,25 +46,14 @@ class MealieDataSourceImpl @Inject constructor(
logParameters = { "baseUrl = $baseUrl" },
).getOrElse {
when (it) {
is HttpException, is SerializationException -> getVersionInfoV1(baseUrl)
is SocketTimeoutException,
is ConnectException -> throw NetworkError.NoServerConnection(it)
is HttpException, is SerializationException -> throw NetworkError.NotMealie(it)
is SocketTimeoutException, is ConnectException -> throw NetworkError.NoServerConnection(
it
)
else -> throw NetworkError.MalformedUrl(it)
}
}
private suspend fun getVersionInfoV1(baseUrl: String): VersionResponse = makeCall(
block = { getVersion("$baseUrl/api/app/about") },
logMethod = { "getVersionInfoV1" },
logParameters = { "baseUrl = $baseUrl" },
).getOrElse {
throw when (it) {
is HttpException, is SerializationException -> NetworkError.NotMealie(it)
is SocketTimeoutException, is ConnectException -> NetworkError.NoServerConnection(it)
else -> NetworkError.MalformedUrl(it)
}
}
override suspend fun requestRecipes(
baseUrl: String, token: String?, start: Int, limit: Int
): List<GetRecipeSummaryResponse> = makeCall(