From 8cf462a755a95b2044e25228a8771ff3782e5133 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Fri, 26 Aug 2022 22:58:02 +0200 Subject: [PATCH] Fixing api version issue on login. --- .../bou/amine/apps/readerforselfossv2/android/LoginActivity.kt | 2 ++ .../amine/apps/readerforselfossv2/repository/RepositoryImpl.kt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/LoginActivity.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/LoginActivity.kt index cb8c9da..9bac400 100644 --- a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/LoginActivity.kt +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/LoginActivity.kt @@ -17,6 +17,7 @@ import bou.amine.apps.readerforselfossv2.android.themes.AppColors import bou.amine.apps.readerforselfossv2.android.utils.isBaseUrlValid import bou.amine.apps.readerforselfossv2.repository.Repository import bou.amine.apps.readerforselfossv2.service.AppSettingsService +import bou.amine.apps.readerforselfossv2.utils.DateUtils import com.mikepenz.aboutlibraries.LibsBuilder import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -164,6 +165,7 @@ class LoginActivity : AppCompatActivity(), DIAware { CoroutineScope(Dispatchers.IO).launch { val result = repository.login() if (result) { + repository.updateApiVersion() goToMain() } else { CoroutineScope(Dispatchers.Main).launch { 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 0f17810..74a3fbe 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 @@ -354,7 +354,7 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap api.refreshLoginInformation() } - private suspend fun updateApiVersion() { + suspend fun updateApiVersion() { val apiMajorVersion = appSettingsService.getApiVersion() if (isNetworkAvailable()) {