From ec0fd2faee9f39ccab76aafbaa23d8e4ef874f4c Mon Sep 17 00:00:00 2001 From: davidoskky Date: Fri, 27 Jan 2023 00:25:27 +0100 Subject: [PATCH] Cleaning --- .../amine/apps/readerforselfossv2/android/ReaderActivity.kt | 2 +- .../bou/amine/apps/readerforselfossv2/model/SelfossModel.kt | 2 +- .../amine/apps/readerforselfossv2/repository/RepositoryImpl.kt | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/ReaderActivity.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/ReaderActivity.kt index 4b75c2f..8ca576d 100644 --- a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/ReaderActivity.kt +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/ReaderActivity.kt @@ -84,7 +84,7 @@ class ReaderActivity : AppCompatActivity(), DIAware { } private fun readItem(item: SelfossModel.Item) { - if (appSettingsService.isMarkOnScrollEnabled() and !appSettingsService.getPublicAccess()) { + if (appSettingsService.isMarkOnScrollEnabled() && !appSettingsService.getPublicAccess()) { CoroutineScope(Dispatchers.IO).launch { repository.markAsRead(item) } diff --git a/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/model/SelfossModel.kt b/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/model/SelfossModel.kt index 87c495c..8fdf5e8 100644 --- a/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/model/SelfossModel.kt +++ b/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/model/SelfossModel.kt @@ -51,7 +51,7 @@ class SelfossModel { fun getApiConfiguration() = configuration ?: ApiConfiguration(null, null) } - @kotlinx.serialization.Serializable + @Serializable data class ApiConfiguration( @Serializable(with = BooleanSerializer::class) val publicMode: Boolean?, 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 5dacf72..1bcf35e 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 @@ -448,6 +448,9 @@ class Repository( if (fetchedInformation.data.getApiMajorVersion() != apiMajorVersion) { appSettingsService.updateApiVersion(fetchedInformation.data.getApiMajorVersion()) } + // Check if we're accessing the instance in public mode + // This happens when auth and public mode are enabled but + // no credentials are provided to login if (appSettingsService.getUserName().isEmpty() && fetchedInformation.data.getApiConfiguration().isAuthEnabled() && fetchedInformation.data.getApiConfiguration().isPublicModeEnabled()) {