From 39c690be85bf76e15452a1fe7a822c956a0bea4c Mon Sep 17 00:00:00 2001 From: joragua Date: Tue, 17 Dec 2024 08:44:39 +0100 Subject: [PATCH] feat: added nullability to all classes that are related with `GetStoredQuotaAsStreamUseCase` --- .../android/data/user/datasources/LocalUserDataSource.kt | 2 +- .../user/datasources/implementation/OCLocalUserDataSource.kt | 4 ++-- .../main/java/com/owncloud/android/data/user/db/UserDao.kt | 2 +- .../owncloud/android/data/user/repository/OCUserRepository.kt | 2 +- .../java/com/owncloud/android/domain/user/UserRepository.kt | 2 +- .../domain/user/usecases/GetStoredQuotaAsStreamUseCase.kt | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/owncloudData/src/main/java/com/owncloud/android/data/user/datasources/LocalUserDataSource.kt b/owncloudData/src/main/java/com/owncloud/android/data/user/datasources/LocalUserDataSource.kt index d90aec4eccf..06167dcb833 100644 --- a/owncloudData/src/main/java/com/owncloud/android/data/user/datasources/LocalUserDataSource.kt +++ b/owncloudData/src/main/java/com/owncloud/android/data/user/datasources/LocalUserDataSource.kt @@ -36,7 +36,7 @@ interface LocalUserDataSource { fun getQuotaForAccountAsFlow( accountName: String - ): Flow + ): Flow fun getAllUserQuotas(): List diff --git a/owncloudData/src/main/java/com/owncloud/android/data/user/datasources/implementation/OCLocalUserDataSource.kt b/owncloudData/src/main/java/com/owncloud/android/data/user/datasources/implementation/OCLocalUserDataSource.kt index 97dd5bb0b67..098e0e9883b 100644 --- a/owncloudData/src/main/java/com/owncloud/android/data/user/datasources/implementation/OCLocalUserDataSource.kt +++ b/owncloudData/src/main/java/com/owncloud/android/data/user/datasources/implementation/OCLocalUserDataSource.kt @@ -41,8 +41,8 @@ class OCLocalUserDataSource( override fun getQuotaForAccount(accountName: String): UserQuota? = userDao.getQuotaForAccount(accountName = accountName)?.toModel() - override fun getQuotaForAccountAsFlow(accountName: String): Flow = - userDao.getQuotaForAccountAsFlow(accountName = accountName).map { it.toModel() } + override fun getQuotaForAccountAsFlow(accountName: String): Flow = + userDao.getQuotaForAccountAsFlow(accountName = accountName).map { it?.toModel() } override fun getAllUserQuotas(): List { return userDao.getAllUserQuotas().map { userQuotaEntity -> diff --git a/owncloudData/src/main/java/com/owncloud/android/data/user/db/UserDao.kt b/owncloudData/src/main/java/com/owncloud/android/data/user/db/UserDao.kt index 55527a944d2..a8d2649ebb0 100644 --- a/owncloudData/src/main/java/com/owncloud/android/data/user/db/UserDao.kt +++ b/owncloudData/src/main/java/com/owncloud/android/data/user/db/UserDao.kt @@ -38,7 +38,7 @@ interface UserDao { @Query(SELECT_QUOTA) fun getQuotaForAccountAsFlow( accountName: String - ): Flow + ): Flow @Query(SELECT_ALL_QUOTAS) fun getAllUserQuotas(): List diff --git a/owncloudData/src/main/java/com/owncloud/android/data/user/repository/OCUserRepository.kt b/owncloudData/src/main/java/com/owncloud/android/data/user/repository/OCUserRepository.kt index 2d095b8d27b..bc65fa73131 100644 --- a/owncloudData/src/main/java/com/owncloud/android/data/user/repository/OCUserRepository.kt +++ b/owncloudData/src/main/java/com/owncloud/android/data/user/repository/OCUserRepository.kt @@ -43,7 +43,7 @@ class OCUserRepository( override fun getStoredUserQuota(accountName: String): UserQuota? = localUserDataSource.getQuotaForAccount(accountName) - override fun getStoredUserQuotaAsFlow(accountName: String): Flow = + override fun getStoredUserQuotaAsFlow(accountName: String): Flow = localUserDataSource.getQuotaForAccountAsFlow(accountName) override fun getAllUserQuotas(): List = diff --git a/owncloudDomain/src/main/java/com/owncloud/android/domain/user/UserRepository.kt b/owncloudDomain/src/main/java/com/owncloud/android/domain/user/UserRepository.kt index 5e96a829e0d..38dd48bb86f 100644 --- a/owncloudDomain/src/main/java/com/owncloud/android/domain/user/UserRepository.kt +++ b/owncloudDomain/src/main/java/com/owncloud/android/domain/user/UserRepository.kt @@ -31,7 +31,7 @@ interface UserRepository { fun getUserInfo(accountName: String): UserInfo fun getUserQuota(accountName: String): UserQuota fun getStoredUserQuota(accountName: String): UserQuota? - fun getStoredUserQuotaAsFlow(accountName: String): Flow + fun getStoredUserQuotaAsFlow(accountName: String): Flow fun getAllUserQuotas(): List fun getAllUserQuotasAsFlow(): Flow> fun getUserAvatar(accountName: String): UserAvatar diff --git a/owncloudDomain/src/main/java/com/owncloud/android/domain/user/usecases/GetStoredQuotaAsStreamUseCase.kt b/owncloudDomain/src/main/java/com/owncloud/android/domain/user/usecases/GetStoredQuotaAsStreamUseCase.kt index 01f766923d6..3307ff00c01 100644 --- a/owncloudDomain/src/main/java/com/owncloud/android/domain/user/usecases/GetStoredQuotaAsStreamUseCase.kt +++ b/owncloudDomain/src/main/java/com/owncloud/android/domain/user/usecases/GetStoredQuotaAsStreamUseCase.kt @@ -27,9 +27,9 @@ import kotlinx.coroutines.flow.Flow class GetStoredQuotaAsStreamUseCase( private val userRepository: UserRepository -) : BaseUseCase, GetStoredQuotaAsStreamUseCase.Params>() { +) : BaseUseCase, GetStoredQuotaAsStreamUseCase.Params>() { - override fun run(params: Params): Flow = + override fun run(params: Params): Flow = userRepository.getStoredUserQuotaAsFlow(params.accountName) data class Params(val accountName: String)