From c25e8889a45946cb33e29cd563a42e42f30d90c6 Mon Sep 17 00:00:00 2001 From: davidoskky Date: Mon, 17 Oct 2022 19:35:52 +0200 Subject: [PATCH] Prevent crash when logging in --- .../readerforselfossv2/repository/RepositoryImpl.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 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 e0ae5e0..8ed6387 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 @@ -43,10 +43,11 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap init { // TODO: Dispatchers.IO not available in KMM, an alternative solution should be found connectivityStatus.start() - runBlocking { - updateApiVersion() - dateUtils = DateUtils(appSettingsService) - reloadBadges() + if (appSettingsService.getBaseUrl() != "") { + runBlocking { + updateApiVersion() + reloadBadges() + } } } @@ -408,6 +409,7 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap appSettingsService.updateApiVersion(fetchedVersion.data.getApiMajorVersion()) } } + dateUtils = DateUtils(appSettingsService) } fun isNetworkAvailable() = isConnectionAvailable.value && !offlineOverride