From d9d057c8dc11d0799c114b076ccb72b30d6939fb Mon Sep 17 00:00:00 2001 From: aminecmi Date: Thu, 9 Mar 2023 20:46:09 +0100 Subject: [PATCH] fix: Unread and starred can be null. --- .../bou/amine/apps/readerforselfossv2/model/SelfossModel.kt | 4 ++-- .../apps/readerforselfossv2/repository/RepositoryImpl.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 632ed55..4d68efc 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 @@ -24,8 +24,8 @@ class SelfossModel { @Serializable class Stats( val total: Int, - val unread: Int, - val starred: Int + val unread: Int?, + val starred: Int? ) @Serializable 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 1bcf35e..940e3d1 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 @@ -132,9 +132,9 @@ class Repository( if (isNetworkAvailable()) { val response = api.stats() if (response.success && response.data != null) { - _badgeUnread.value = response.data.unread + _badgeUnread.value = response.data.unread ?: 0 _badgeAll.value = response.data.total - _badgeStarred.value = response.data.starred + _badgeStarred.value = response.data.starred ?: 0 success = true } } else if (appSettingsService.isItemCachingEnabled()) {