From 99b34cfa41abfe1a0b53c12f8bf677384d7b82d4 Mon Sep 17 00:00:00 2001 From: davidoskky Date: Sat, 20 Aug 2022 21:12:39 +0200 Subject: [PATCH] Consider offline override before updating remote --- .../apps/readerforselfossv2/repository/RepositoryImpl.kt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/repository/RepositoryImpl.kt b/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/repository/RepositoryImpl.kt index a8ba4c3..a12bcb2 100644 --- a/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/repository/RepositoryImpl.kt +++ b/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/repository/RepositoryImpl.kt @@ -298,13 +298,8 @@ class Repository(private val api: SelfossApi, private val apiDetails: ApiDetails return success } - suspend fun updateRemote(): Boolean { - var response = false - if (isConnectionAvailable.value) { - response = api.update()?.isSuccess == true - } - return response - } + suspend fun updateRemote(): Boolean = + isNetworkAvailable() && api.update()?.isSuccess == true suspend fun login(): Boolean { var result = false